TclCommandGetPath.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # File Author: Marius Adrian Stanciu (c) #
  4. # Date: 4/28/2020 #
  5. # MIT Licence #
  6. # ##########################################################
  7. from tclCommands.TclCommand import TclCommand
  8. import collections
  9. import os
  10. import logging
  11. import gettext
  12. import appTranslation as fcTranslate
  13. import builtins
  14. fcTranslate.apply_language('strings')
  15. if '_' not in builtins.__dict__:
  16. _ = gettext.gettext
  17. log = logging.getLogger('base')
  18. class TclCommandGetPath(TclCommand):
  19. """
  20. Tcl shell command to get the current default path set for Tcl.
  21. example:
  22. """
  23. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  24. aliases = ['get_path']
  25. description = '%s %s' % ("--", "Get the default Tcl Shell folder path.")
  26. # Dictionary of types from Tcl command, needs to be ordered
  27. arg_names = collections.OrderedDict([
  28. ])
  29. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  30. option_types = collections.OrderedDict([
  31. ])
  32. # array of mandatory options for current Tcl command: required = {'name','outname'}
  33. required = []
  34. # structured help for current command, args needs to be ordered
  35. help = {
  36. 'main': "Will get the folder path used as a fallback path for opening files.",
  37. 'args': collections.OrderedDict([
  38. ]),
  39. 'examples': ['get_path']
  40. }
  41. def execute(self, args, unnamed_args):
  42. """
  43. :param args:
  44. :param unnamed_args:
  45. :return:
  46. """
  47. self.app.shell.append_output("Current default Tcl Shell path is: ")
  48. path = self.app.defaults["global_tcl_path"]
  49. return path