TclCommandNew.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from tclCommands.TclCommand import TclCommand
  2. import collections
  3. class TclCommandNew(TclCommand):
  4. """
  5. Tcl shell command to starts a new project. Clears objects from memory
  6. """
  7. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  8. aliases = ['new']
  9. description = '%s %s' % ("--", "Starts a new project. Clears objects from memory.")
  10. # dictionary of types from Tcl command, needs to be ordered
  11. arg_names = collections.OrderedDict()
  12. # dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  13. option_types = collections.OrderedDict()
  14. # array of mandatory options for current Tcl command: required = {'name','outname'}
  15. required = []
  16. # structured help for current command, args needs to be ordered
  17. help = {
  18. 'main': "Starts a new project. Clears objects from memory.",
  19. 'args': collections.OrderedDict(),
  20. 'examples': ['new']
  21. }
  22. def execute(self, args, unnamed_args):
  23. """
  24. execute current TCL shell command
  25. :param args: array of known named arguments and options
  26. :param unnamed_args: array of other values which were passed into command
  27. without -somename and we do not have them in known arg_names
  28. :return: None or exception
  29. """
  30. self.app.f_handlers.on_file_new(cli=True)