- made sure that if the user closes the app with an editor open, before the exit the editor is closed and signals disconnected

This commit is contained in:
Marius Stanciu 2020-06-03 22:47:29 +03:00 committed by Marius
parent bbf878bebb
commit adfd6d40b9
3 changed files with 28 additions and 1 deletions

View File

@ -20,6 +20,7 @@ CHANGELOG for FlatCAM beta
- fixed the preferences not being saved to a file when the Save button is pressed in Edit -> Preferences
- fixed and updated the Transform Tools in the Editors
- updated the language translation strings (and Google_Translated some of them)
- made sure that if the user closes the app with an editor open, before the exit the editor is closed and signals disconnected
2.06.2020

View File

@ -3739,7 +3739,6 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.disconnect_canvas_event_handlers()
self.app.ui.grb_edit_toolbar.setDisabled(True)
settings = QSettings("Open Source", "FlatCAM")
self.app.ui.corner_snap_btn.setVisible(False)
self.app.ui.snap_magnet.setVisible(False)

View File

@ -3191,6 +3191,32 @@ class App(QtCore.QObject):
:return: None
"""
# close editors before quiting the app, if they are open
if self.geo_editor.editor_active is True:
self.geo_editor.deactivate()
try:
self.geo_editor.disconnect()
except TypeError:
pass
log.debug("App.quit_application() --> Geo Editor deactivated.")
if self.exc_editor.editor_active is True:
self.exc_editor.deactivate()
try:
self.grb_editor.disconnect()
except TypeError:
pass
log.debug("App.quit_application() --> Excellon Editor deactivated.")
if self.grb_editor.editor_active is True:
self.grb_editor.deactivate_grb_editor()
try:
self.exc_editor.disconnect()
except TypeError:
pass
log.debug("App.quit_application() --> Gerber Editor deactivated.")
self.preferencesUiManager.save_defaults(silent=True)
log.debug("App.quit_application() --> App Defaults saved.")
@ -3249,6 +3275,7 @@ class App(QtCore.QObject):
# quit app by signalling for self.kill_app() method
# self.close_app_signal.emit()
QtWidgets.qApp.quit()
# QtCore.QCoreApplication.quit()
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
# we use the following command