TclCommandGetPath.py 1.9 KB

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