- added a new TclCommand named quit_flatcam which will ... quit FlatCAM from Tcl Shell or from a script

This commit is contained in:
Marius Stanciu 2019-09-19 04:04:18 +03:00 committed by Marius
parent 1d26247fc4
commit 4540066731
4 changed files with 71 additions and 15 deletions

View File

@ -2050,7 +2050,8 @@ class App(QtCore.QObject):
'mirror', 'ncc',
'ncc_clear', 'ncr', 'new', 'new_geometry', 'non_copper_regions', 'offset',
'open_excellon', 'open_gcode', 'open_gerber', 'open_project', 'options', 'paint',
'pan', 'panel', 'panelize', 'plot_all', 'plot_objects', 'save', 'save_project',
'pan', 'panel', 'panelize', 'plot_all', 'plot_objects', 'quit_flatcam',
'save', 'save_project',
'save_sys', 'scale',
'set_active', 'set_sys', 'setsys', 'skew', 'subtract_poly', 'subtract_rectangle',
'version', 'write_gcode'
@ -4536,21 +4537,27 @@ class App(QtCore.QObject):
self.save_defaults()
log.debug("App.final_save() --> App Defaults saved.")
# save toolbar state to file
settings = QSettings("Open Source", "FlatCAM")
settings.setValue('saved_gui_state', self.ui.saveState())
settings.setValue('maximized_gui', self.ui.isMaximized())
settings.setValue('language', self.ui.general_defaults_form.general_app_group.language_cb.get_value())
settings.setValue('notebook_font_size',
self.ui.general_defaults_form.general_gui_set_group.notebook_font_size_spinner.get_value())
settings.setValue('axis_font_size',
self.ui.general_defaults_form.general_gui_set_group.axis_font_size_spinner.get_value())
settings.setValue('textbox_font_size',
self.ui.general_defaults_form.general_gui_set_group.textbox_font_size_spinner.get_value())
settings.setValue('toolbar_lock', self.ui.lock_action.isChecked())
if self.cmd_line_headless != 1:
# save app state to file
settings = QSettings("Open Source", "FlatCAM")
settings.setValue('saved_gui_state', self.ui.saveState())
settings.setValue('maximized_gui', self.ui.isMaximized())
settings.setValue('language', self.ui.general_defaults_form.general_app_group.language_cb.get_value())
settings.setValue(
'notebook_font_size',
self.ui.general_defaults_form.general_gui_set_group.notebook_font_size_spinner.get_value()
)
settings.setValue('axis_font_size',
self.ui.general_defaults_form.general_gui_set_group.axis_font_size_spinner.get_value())
settings.setValue(
'textbox_font_size',
self.ui.general_defaults_form.general_gui_set_group.textbox_font_size_spinner.get_value()
)
settings.setValue('toolbar_lock', self.ui.lock_action.isChecked())
# This will write the setting to the platform specific storage.
del settings
# This will write the setting to the platform specific storage.
del settings
log.debug("App.final_save() --> App UI state saved.")
QtWidgets.qApp.quit()

View File

@ -18,6 +18,7 @@ CAD program, and create G-Code for Isolation routing.
- added control over the display of Sys Tray Icon in Edit -> Preferences -> General -> GUI Settings -> Sys Tray Icon checkbox
- updated some of the default values to more reasonable ones
- FlatCAM can be run in HEADLESS mode now. This node can be selected by using the --headless=1 command line argument or by changing the line headless=False to True in config/configuration.txt file. In this mod the Sys Tray Icon menu will hold only the Run Scrip menu entry and Exit entry.
- added a new TclCommand named quit_flatcam which will ... quit FlatCAM from Tcl Shell or from a script
18.09.2019

View File

@ -0,0 +1,47 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
class TclCommandQuit(TclCommand):
"""
Tcl shell command to quit FlatCAM from Tcl shell.
example:
"""
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
aliases = ['quit_flatcam']
# Dictionary of types from Tcl command, needs to be ordered
arg_names = collections.OrderedDict([
])
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
option_types = collections.OrderedDict([
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
required = []
# structured help for current command, args needs to be ordered
help = {
'main': "Tcl shell command to quit FlatCAM from Tcl shell.",
'args': collections.OrderedDict([
]),
'examples': ['quit_flatcam']
}
def execute(self, args, unnamed_args):
"""
:param args:
:param unnamed_args:
:return:
"""
self.app.quit_application()

View File

@ -48,6 +48,7 @@ import tclCommands.TclCommandPaint
import tclCommands.TclCommandPanelize
import tclCommands.TclCommandPlotAll
import tclCommands.TclCommandPlotObjects
import tclCommands.TclCommandQuit
import tclCommands.TclCommandSaveProject
import tclCommands.TclCommandSaveSys
import tclCommands.TclCommandScale