Przeglądaj źródła

- updated the App.final_save() function

Marius Stanciu 6 lat temu
rodzic
commit
3c2cc96b62
3 zmienionych plików z 14 dodań i 21 usunięć
  1. 13 1
      FlatCAMApp.py
  2. 0 20
      FlatCAMGUI.py
  3. 1 0
      README.md

+ 13 - 1
FlatCAMApp.py

@@ -2932,7 +2932,19 @@ class App(QtCore.QObject):
                 self.should_we_quit = False
                 return
         self.save_defaults()
-        log.debug("Application defaults saved ... Exit event.")
+        log.debug("App.final_save() --> App Defaults saved.")
+
+        if self.should_we_quit is True:
+
+            # 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())
+
+            # This will write the setting to the platform specific storage.
+            del settings
+            log.debug("App.final_save() --> App UI state saved.")
+            QtWidgets.qApp.quit()
 
     def on_toggle_shell(self):
         """

+ 0 - 20
FlatCAMGUI.py

@@ -2565,26 +2565,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 
         self.final_save.emit()
 
-        if self.app.should_we_quit is True:
-            # # save toolbar state to file
-            # with open(self.app.data_path + '\gui_state.config', 'wb') as stream:
-            #     stream.write(self.saveState().data())
-            #     log.debug("FlatCAMGUI.__init__() --> UI state saved.")
-            # QtWidgets.qApp.quit()
-
-            # save toolbar state to file
-            settings = QSettings("Open Source", "FlatCAM")
-            settings.setValue('saved_gui_state', self.saveState())
-            settings.setValue('maximized_gui', self.isMaximized())
-
-            # This will write the setting to the platform specific storage.
-            del settings
-            log.debug("FlatCAMGUI.__init__() --> UI state saved.")
-            QtWidgets.qApp.quit()
-        else:
-            self.app.should_we_quit = True
-            event.ignore()
-
 
 class GeneralPreferencesUI(QtWidgets.QWidget):
     def __init__(self, parent=None):

+ 1 - 0
README.md

@@ -20,6 +20,7 @@ CAD program, and create G-Code for Isolation routing.
 - added some test translation for the ToolCalculators (in Romanian)
 - fixed bug in ToolCutOut where for each tool invocation the signals were reconnected
 - fixed some issues with ToolMeasurement due of above changes
+- updated the App.final_save() function
 
 8.03.2019