TclCommandGetSys.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from ObjectCollection import *
  2. from tclCommands.TclCommand import TclCommand
  3. class TclCommandGetSys(TclCommand):
  4. """
  5. Tcl shell command to get the value of a system variable
  6. example:
  7. get_sys excellon_zeros
  8. """
  9. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  10. aliases = ['get_sys', 'getsys']
  11. # Dictionary of types from Tcl command, needs to be ordered
  12. arg_names = collections.OrderedDict([
  13. ('name', str)
  14. ])
  15. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  16. option_types = collections.OrderedDict([
  17. ])
  18. # array of mandatory options for current Tcl command: required = {'name','outname'}
  19. required = ['name']
  20. # structured help for current command, args needs to be ordered
  21. help = {
  22. 'main': "Returns the value of the system variable.",
  23. 'args': collections.OrderedDict([
  24. ('name', 'Name of the system variable.'),
  25. ]),
  26. 'examples': ['get_sys excellon_zeros']
  27. }
  28. def execute(self, args, unnamed_args):
  29. """
  30. :param args:
  31. :param unnamed_args:
  32. :return:
  33. """
  34. name = args['name']
  35. if name in self.app.defaults:
  36. return self.app.defaults[name]