diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index f49983143f..e5975b9b2b 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -66,7 +66,10 @@ class CrashHandler: for part in line.rstrip("\n").split("\n"): Logger.log("c", part) - if exception_type not in fatal_exception_types: + # If Cura has fully started, we only show fatal errors. + # If Cura has not fully started yet, we always show the early crash dialog. Otherwise, Cura will just crash + # without any information. + if has_started and exception_type not in fatal_exception_types: return self._send_report_checkbox = None diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index e2efaeb517..c39ce1d079 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -106,14 +106,6 @@ if not MYPY: CuraDebugMode = False -# -# A global signal which is triggered when CuraApplication has finished its start up. -# This is used to initialise some plugins such as AutoSave which should only be started after the application passed -# the start up successfully. -# -applicationStarted = pyqtSignal() - - class CuraApplication(QtApplication): # SettingVersion represents the set of settings available in the machine/extruder definitions. # You need to make sure that this version number needs to be increased if there is any non-backwards-compatible diff --git a/cura_app.py b/cura_app.py index 4bab1d5a7b..d1cf215fc5 100755 --- a/cura_app.py +++ b/cura_app.py @@ -108,6 +108,7 @@ def exceptHook(hook_type, value, traceback): sys.exit(1) else: application = QApplication(sys.argv) + application.removePostedEvents(None) _crash_handler = CrashHandler(hook_type, value, traceback, has_started) _crash_handler.early_crash_dialog.show() sys.exit(application.exec_()) diff --git a/plugins/AutoSave/AutoSave.py b/plugins/AutoSave/AutoSave.py index 30c12b5424..a549e6ff0a 100644 --- a/plugins/AutoSave/AutoSave.py +++ b/plugins/AutoSave/AutoSave.py @@ -30,12 +30,21 @@ class AutoSave(Extension): # At this point, the Application instance has not finished its constructor call yet, so directly using something # like Application.getInstance() is not correct. The initialisation now will only gets triggered after the # application finishes its start up successfully. - from cura.CuraApplication import applicationStarted - applicationStarted.connect(self.initialize) + self._init_timer = QTimer() + self._init_timer.setInterval(1000) + self._init_timer.setSingleShot(True) + self._init_timer.timeout.connect(self.initialize) + self._init_timer.start() def initialize(self): - from cura.CuraApplication import applicationStarted - applicationStarted.disconnect(self.initialize) + # only initialise if the application is created and has started + from cura.CuraApplication import CuraApplication + if not CuraApplication.Created: + self._init_timer.start() + return + if not CuraApplication.getInstance().started: + self._init_timer.start() + return Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged) self._onGlobalStackChanged()