- if FlatCAM is started with the 'quit' or 'exit' as argument it will close immediately and it will close also another instance of FlatCAM that may be running

This commit is contained in:
Marius Stanciu 2019-09-17 14:08:57 +03:00
parent 49ac19a221
commit 26fe1bf5e1
5 changed files with 28 additions and 12 deletions

View File

@ -60,11 +60,4 @@ if __name__ == '__main__':
fc = App()
if settings.contains("maximized_gui"):
maximized_ui = settings.value('maximized_gui', type=bool)
if maximized_ui is True:
fc.ui.showMaximized()
else:
fc.ui.show()
sys.exit(app.exec_())

View File

@ -1905,7 +1905,7 @@ class App(QtCore.QObject):
self.on_excellon_options_button)
# when there are arguments at application startup this get launched
self.args_at_startup[list].connect(lambda: self.on_startup_args())
self.args_at_startup[list].connect(self.on_startup_args)
# connect the 'Apply' buttons from the Preferences/File Associations
self.ui.fa_defaults_form.fa_excellon_group.exc_list_btn.clicked.connect(
@ -2415,6 +2415,18 @@ class App(QtCore.QObject):
# finish the splash
self.splash.finish(self.ui)
# #####################################################################################
# ########################## SHOW GUI #################################################
# #####################################################################################
settings = QSettings("Open Source", "FlatCAM")
if settings.contains("maximized_gui"):
maximized_ui = settings.value('maximized_gui', type=bool)
if maximized_ui is True:
self.ui.showMaximized()
else:
self.ui.show()
@staticmethod
def copy_and_overwrite(from_path, to_path):
"""
@ -2433,14 +2445,15 @@ class App(QtCore.QObject):
from_new_path = os.path.dirname(os.path.realpath(__file__)) + '\\flatcamGUI\\VisPyData\\data'
shutil.copytree(from_new_path, to_path)
def on_startup_args(self, args=None):
def on_startup_args(self, args):
"""
This will process any arguments provided to the application at startup. Like trying to launch a file or project.
:param args: a list containing the application args at startup
:return: None
"""
if args:
if args is not None:
args_to_process = args
else:
args_to_process = App.args
@ -2491,6 +2504,13 @@ class App(QtCore.QObject):
except Exception as e:
log.debug("Could not open FlatCAM Script file as App parameter due: %s" % str(e))
elif 'quit' in argument or 'exit' in argument:
log.debug("App.on_startup_args() --> Quit event.")
sys.exit()
elif 'save' in argument:
log.debug("App.on_startup_args() --> Save event. App Defaults saved.")
self.save_defaults()
else:
exc_list = self.ui.fa_defaults_form.fa_excellon_group.exc_list_text.get_value().split(',')
proc_arg = argument.lower()

View File

@ -15,7 +15,8 @@ CAD program, and create G-Code for Isolation routing.
- fixed issue #315 where a script run with the --shellfile argument crashed the program if it contained a TclCommand New
- added messages in the Splash Screen when running FlatCAM with arguments at startup
- fixed issue #313 where TclCommand drillcncjob is spitting errors in Tcl Shell which should be ignored
- fixed an bug where the pywrapcp name from Google OR-Tools is not defined
- fixed an bug where the pywrapcp name from Google OR-Tools is not defined; fix issue #316
- if FlatCAM is started with the 'quit' or 'exit' as argument it will close immediately and it will close also another instance of FlatCAM that may be running
16.09.2019

View File

@ -5867,8 +5867,9 @@ class CNCjob(Geometry):
self.app.inform.emit('%s...' %
_("Starting G-Code"))
current_platform = platform.architecture()[0]
if current_platform != '64bit':
if current_platform == '64bit':
used_excellon_optimization_type = excellon_optimization_type
if used_excellon_optimization_type == 'M':
log.debug("Using OR-Tools Metaheuristic Guided Local Search drill path optimization.")

View File

@ -1 +1,2 @@
portable=False
headless=False