From 396d960f4a5095ff9a29a498720235776e59d9bb Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 17 Oct 2017 09:30:49 +0200 Subject: [PATCH 1/2] Fix code style CURA-4195 --- cura/CrashHandler.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index 04f04a1c37..ac3a1ad32b 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -44,11 +44,11 @@ fatal_exception_types = [ SystemError, ] + class CrashHandler: crash_url = "https://stats.ultimaker.com/api/cura" def __init__(self, exception_type, value, tb): - self.exception_type = exception_type self.value = value self.traceback = tb @@ -73,7 +73,6 @@ class CrashHandler: ## Creates a modal dialog. def _createDialog(self): - self.dialog = QDialog() self.dialog.setMinimumWidth(640) self.dialog.setMinimumHeight(640) @@ -226,7 +225,6 @@ class CrashHandler: return group - def _userDescriptionWidget(self): group = QGroupBox() group.setTitle(catalog.i18nc("@title:groupbox", "User description")) From 44d53237799e14b02f1ba0240dfc8a03cd7006f8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 17 Oct 2017 09:38:43 +0200 Subject: [PATCH 2/2] Run crash dialog on Qt thread so the GUI gets updated correctly CURA-4195 --- cura/CrashHandler.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index ac3a1ad32b..a78ecb8a72 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -15,8 +15,9 @@ import urllib.request import urllib.error from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit, QGroupBox, QPushButton +from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit, QGroupBox +from UM.Application import Application from UM.Logger import Logger from UM.View.GL.OpenGL import OpenGL from UM.i18n import i18nCatalog @@ -275,5 +276,9 @@ class CrashHandler: os._exit(1) def show(self): + # must run the GUI code on the Qt thread, otherwise the widgets on the dialog won't react correctly. + Application.getInstance().callLater(self._show) + + def _show(self): self.dialog.exec_() - os._exit(1) \ No newline at end of file + os._exit(1)