TclCommandOpenProject.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from tclCommands.TclCommand import *
  2. class TclCommandOpenProject(TclCommandSignaled):
  3. """
  4. Tcl shell command to open a FlatCAM project.
  5. """
  6. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  7. aliases = ['open_project']
  8. # Dictionary of types from Tcl command, needs to be ordered.
  9. # For positional arguments
  10. arg_names = collections.OrderedDict([
  11. ('filename', 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 = ['filename']
  19. # structured help for current command, args needs to be ordered
  20. help = {
  21. 'main': "Opens a FlatCAM project.",
  22. 'args': collections.OrderedDict([
  23. ('filename', 'Path to file to open.'),
  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. self.app.open_project(args['filename'])