Jelajahi Sumber

- 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

Marius Stanciu 6 tahun lalu
induk
melakukan
26fe1bf5e1
5 mengubah file dengan 28 tambahan dan 12 penghapusan
  1. 0 7
      FlatCAM.py
  2. 23 3
      FlatCAMApp.py
  3. 2 1
      README.md
  4. 2 1
      camlib.py
  5. 1 0
      config/configuration.txt

+ 0 - 7
FlatCAM.py

@@ -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_())

+ 23 - 3
FlatCAMApp.py

@@ -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()

+ 2 - 1
README.md

@@ -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
 

+ 2 - 1
camlib.py

@@ -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.")

+ 1 - 0
config/configuration.txt

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