TclCommandOptions.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from tclCommands.TclCommand import *
  2. class TclCommandOptions(TclCommandSignaled):
  3. """
  4. Tcl shell command to open an Excellon file.
  5. """
  6. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  7. aliases = ['options']
  8. # Dictionary of types from Tcl command, needs to be ordered.
  9. # For positional arguments
  10. arg_names = collections.OrderedDict([
  11. ('name', str)
  12. ])
  13. # Dictionary of types from Tcl command, needs to be ordered.
  14. # 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 = ['name']
  19. # structured help for current command, args needs to be ordered
  20. help = {
  21. 'main': "Shows the settings for an object.",
  22. 'args': collections.OrderedDict([
  23. ('name', 'Object name.'),
  24. ]),
  25. 'examples': []
  26. }
  27. def execute(self, args, unnamed_args):
  28. """
  29. execute current TCL shell command
  30. :param args: array of known named arguments and options
  31. :param unnamed_args: array of other values which were passed into command
  32. without -somename and we do not have them in known arg_names
  33. :return: None or exception
  34. """
  35. name = args['name']
  36. ops = self.app.collection.get_by_name(str(name)).options
  37. return '\n'.join(["%s: %s" % (o, ops[o]) for o in ops])