TclCommandGetSys.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # File Author: Marius Adrian Stanciu (c) #
  4. # Date: 8/17/2019 #
  5. # MIT Licence #
  6. # ##########################################################
  7. from tclCommands.TclCommand import TclCommand
  8. import collections
  9. class TclCommandGetSys(TclCommand):
  10. """
  11. Tcl shell command to get the value of a system variable
  12. example:
  13. get_sys excellon_zeros
  14. """
  15. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  16. aliases = ['get_sys', 'getsys']
  17. description = '%s %s' % ("--", "Returns to TCL the value for the entered system variable.")
  18. # Dictionary of types from Tcl command, needs to be ordered
  19. arg_names = collections.OrderedDict([
  20. ('name', str)
  21. ])
  22. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  23. option_types = collections.OrderedDict([
  24. ])
  25. # array of mandatory options for current Tcl command: required = {'name','outname'}
  26. required = ['name']
  27. # structured help for current command, args needs to be ordered
  28. help = {
  29. 'main': "Returns to TCL the value for the entered system variable.",
  30. 'args': collections.OrderedDict([
  31. ('name', 'Name of the system variable. Required.'),
  32. ]),
  33. 'examples': ['get_sys excellon_zeros']
  34. }
  35. def execute(self, args, unnamed_args):
  36. """
  37. :param args:
  38. :param unnamed_args:
  39. :return:
  40. """
  41. name = args['name']
  42. if name in self.app.defaults:
  43. return self.app.defaults[name]