From 8a25605413cd5b2d07d23a67d1ceadfbc7818050 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 9 Oct 2017 15:04:27 +0200 Subject: [PATCH 1/2] Fix lock issue with workspace dialog CURA-4405 - Add try-except around lock release - Fix closing the dialog with ESC --- plugins/3MFReader/WorkspaceDialog.py | 19 ++++++++++++++++--- plugins/3MFReader/WorkspaceDialog.qml | 10 +++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index 7c803486eb..5e5eaf985e 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -272,12 +272,26 @@ class WorkspaceDialog(QObject): def notifyClosed(self): self._result = {} # The result should be cleared before hide, because after it is released the main thread lock self._visible = False - self._lock.release() + try: + self._lock.release() + except: + pass def hide(self): self._visible = False self._view.hide() - self._lock.release() + try: + self._lock.release() + except: + pass + + @pyqtSlot(bool) + def _onVisibilityChanged(self, visible): + if not visible: + try: + self._lock.release() + except: + pass @pyqtSlot() def onOkButtonClicked(self): @@ -290,7 +304,6 @@ class WorkspaceDialog(QObject): self._view.hide() self.hide() - ## Block thread until the dialog is closed. def waitForClose(self): if self._visible: diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index e9ef14dfa5..a633491248 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -10,6 +10,7 @@ import UM 1.1 as UM UM.Dialog { + id: base title: catalog.i18nc("@title:window", "Open Project") minimumWidth: 500 * screenScaleFactor @@ -30,6 +31,7 @@ UM.Dialog materialResolveComboBox.currentIndex = 0 } } + Item { anchors.fill: parent @@ -377,7 +379,7 @@ UM.Dialog anchors.right: ok_button.left anchors.rightMargin: 2 * screenScaleFactor } - Button + Button { id: ok_button text: catalog.i18nc("@action:button","Open"); @@ -386,4 +388,10 @@ UM.Dialog anchors.right: parent.right } } + + function reject() { + manager.onCancelButtonClicked(); + base.visible = false; + base.rejected(); + } } From f8a1187a8c8d36e166cd12d1af255784740bdc57 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 9 Oct 2017 16:14:02 +0200 Subject: [PATCH 2/2] Re-sending after cancelling print job now really works - CURA-4398 --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 12c68079b0..b88feb6095 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -836,6 +836,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): Logger.log("d", "User aborted sending print to remote.") self._progress_message.hide() self._compressing_print = False + self._write_finished = True # post_reply does not always exist, so make sure we unblock writing if self._post_reply: self._finalizePostReply() Application.getInstance().showPrintMonitor.emit(False)