TclCommandGetNames.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from tclCommands.TclCommand import TclCommand
  2. import collections
  3. class TclCommandGetNames(TclCommand):
  4. """
  5. Tcl shell command to set an object as active in the GUI.
  6. example:
  7. """
  8. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  9. aliases = ['get_names']
  10. description = '%s %s' % ("--", "Return to TCL the list of the project objects names "
  11. "as a string with names separated by the '\\n' char.")
  12. # Dictionary of types from Tcl command, needs to be ordered
  13. arg_names = collections.OrderedDict([
  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 = []
  20. # structured help for current command, args needs to be ordered
  21. help = {
  22. 'main': 'Lists the names of objects in the project. '
  23. 'It returns a string with names separated by "\\n" character',
  24. 'args': collections.OrderedDict([
  25. ]),
  26. 'examples': ['get_names']
  27. }
  28. def execute(self, args, unnamed_args):
  29. """
  30. :param args:
  31. :param unnamed_args:
  32. :return:
  33. """
  34. return '\n'.join(self.app.collection.get_names())