TclCommandListSys.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from tclCommands.TclCommand import *
  2. class TclCommandListSys(TclCommand):
  3. """
  4. Tcl shell command to get the list of system variables
  5. example:
  6. list_sys
  7. """
  8. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  9. aliases = ['list_sys', 'listsys']
  10. # Dictionary of types from Tcl command, needs to be ordered
  11. arg_names = collections.OrderedDict([
  12. ('selection', str),
  13. ])
  14. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  15. option_types = collections.OrderedDict([
  16. ])
  17. # array of mandatory options for current Tcl command: required = {'name','outname'}
  18. required = []
  19. # structured help for current command, args needs to be ordered
  20. help = {
  21. 'main': "Returns the list of the names of system variables.\n"
  22. "Without an argument it will list all the system parameters. "
  23. "As an argument use first letter or first letters from the name "
  24. "of the system variable.\n"
  25. "In that case it will list only the system variables that starts with that string.\n"
  26. "Main categories start with: gerber or excellon or geometry or cncjob or global.\n"
  27. "Note: Use get_sys TclCommand to get the value and set_sys TclCommand to set it.\n",
  28. 'args': collections.OrderedDict([
  29. ]),
  30. 'examples': ['list_sys',
  31. 'list_sys ser',
  32. 'list_sys gerber',
  33. 'list_sys cncj']
  34. }
  35. def execute(self, args, unnamed_args):
  36. """
  37. :param args:
  38. :param unnamed_args:
  39. :return:
  40. """
  41. if 'selection' in args:
  42. argument = args['selection']
  43. return str([k for k in self.app.defaults.keys() if str(k).startswith(str(argument))])
  44. else:
  45. return str([*self.app.defaults])