TclCommandSaveProject.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from ObjectCollection import *
  2. from tclCommands.TclCommand import TclCommandSignaled
  3. class TclCommandSaveProject(TclCommandSignaled):
  4. """
  5. Tcl shell command to save the FlatCAM project to file.
  6. """
  7. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  8. aliases = ['save_project']
  9. # Dictionary of types from Tcl command, needs to be ordered.
  10. # For positional arguments
  11. arg_names = collections.OrderedDict([
  12. ('filename', str)
  13. ])
  14. # Dictionary of types from Tcl command, needs to be ordered.
  15. # 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 = ['filename']
  20. # structured help for current command, args needs to be ordered
  21. help = {
  22. 'main': "Saves the FlatCAM project to file.",
  23. 'args': collections.OrderedDict([
  24. ('filename', 'Path to file.'),
  25. ]),
  26. 'examples': []
  27. }
  28. def execute(self, args, unnamed_args):
  29. """
  30. execute current TCL shell command
  31. :param args: array of known named arguments and options
  32. :param unnamed_args: array of other values which were passed into command
  33. without -somename and we do not have them in known arg_names
  34. :return: None or exception
  35. """
  36. self.app.save_project(args['filename'])