From 5a3e427450af9407d99632ee3b07fd55de635a7e Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 14:20:41 +0200 Subject: [PATCH 01/10] CL-228 when adding a Cura Connect printer, do not ask authentication, it is always authenticated --- plugins/UM3NetworkPrinting/DiscoverUM3Action.qml | 2 +- .../NetworkClusterPrinterOutputDevice.py | 15 +++++++++++++++ plugins/UM3NetworkPrinting/UM3InfoComponents.qml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml index 5ea7d77d8a..b1964c6c06 100644 --- a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml @@ -389,4 +389,4 @@ Cura.MachineAction } ] } -} \ No newline at end of file +} diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index 94bd6bc9a3..b3cc42b110 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -44,6 +44,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte else: name = key + self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated self._plugin_path = plugin_path self.setName(name) @@ -110,6 +111,20 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte temporary_translation3 = i18n_catalog.i18n("{printer_name} has finished printing '{job_name}'. Please collect the print and confirm clearing the build plate.") #When finished. temporary_translation4 = i18n_catalog.i18n("{printer_name} is reserved to print '{job_name}'. Please change the printer's configuration to match the job, for it to start printing.") #When configuration changed. + ## No authentication, so requestAuthentication should do exactly nothing + @pyqtSlot() + def requestAuthentication(self, message_id = None, action_id = "Retry"): + Logger.log("d", "requestAuthentication for Cura Connect - nothing to be done") + + def setAuthenticationState(self, auth_state): + self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated + + def _verifyAuthentication(self): + pass + + def _checkAuthentication(self): + Logger.log("d", "_checkAuthentication Cura Connect - nothing to be done") + @pyqtProperty(QObject, notify=selectedPrinterChanged) def controlItem(self): # TODO: Probably not the nicest way to do this. This needs to be done better at some point in time. diff --git a/plugins/UM3NetworkPrinting/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/UM3InfoComponents.qml index a5ed944773..2c3902dcff 100644 --- a/plugins/UM3NetworkPrinting/UM3InfoComponents.qml +++ b/plugins/UM3NetworkPrinting/UM3InfoComponents.qml @@ -121,4 +121,4 @@ Item } UM.I18nCatalog{id: catalog; name:"cura"} -} \ No newline at end of file +} From 6d861c8a33e9a4bf2fe0782c7f0d0420db4022db Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 15:41:07 +0200 Subject: [PATCH 02/10] CL-228 CL-229 more detailed printer status labels --- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index e548c9e9d7..f262540450 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -266,7 +266,20 @@ Rectangle return ""; } } - return catalog.i18nc("@label:status", "Available"); + switch (printer.status) + { + case "pre_print": + return catalog.i18nc("@label", "Preparing to print") + case "printing": + return catalog.i18nc("@label:status", "Printing"); + case "idle": + return catalog.i18nc("@label:status", "Available"); + case "unreachable": // TODO: new string + case "maintenance": // TODO: new string + case "unknown": + default: + return catalog.i18nc("@label", "Unknown"); + } } elide: Text.ElideRight From 341b2b37185053e9f91ce6526b725188dfa8d497 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 16:02:59 +0200 Subject: [PATCH 03/10] CL-228 CL-229 better fallback to printer status labels --- .../UM3NetworkPrinting/PrinterInfoBlock.qml | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index f262540450..e2f7c2b5df 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -37,6 +37,23 @@ Rectangle return Math.min(100, Math.round(printJob.time_elapsed / printJob.time_total * 100)) + "%"; } + function printerStatusText(printer) + { + switch (printer.status) + { + case "pre_print": + return catalog.i18nc("@label", "Preparing to print") + case "printing": + return catalog.i18nc("@label:status", "Printing"); + case "idle": + return catalog.i18nc("@label:status", "Available"); + case "unreachable": // TODO: new string + case "maintenance": // TODO: new string + case "unknown": + default: + return catalog.i18nc("@label", "Unknown"); + } + } id: printerDelegate property var printer @@ -232,7 +249,7 @@ Rectangle return catalog.i18nc("@label:status", "Disabled"); } - if(printJob != null) + if ((printJob != null) && ((printer.status === "pre_print") || (printer.status === "printing"))) { switch (printJob.status) { @@ -263,23 +280,10 @@ Rectangle case "aborted": return catalog.i18nc("@label:status", "Print aborted"); default: - return ""; + return printerStatusText(printer); } } - switch (printer.status) - { - case "pre_print": - return catalog.i18nc("@label", "Preparing to print") - case "printing": - return catalog.i18nc("@label:status", "Printing"); - case "idle": - return catalog.i18nc("@label:status", "Available"); - case "unreachable": // TODO: new string - case "maintenance": // TODO: new string - case "unknown": - default: - return catalog.i18nc("@label", "Unknown"); - } + return printerStatusText(printer); } elide: Text.ElideRight From b5b3f47e4dd6130cbacb1aa7023ad9230bcc558a Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 2 Oct 2017 17:05:39 +0200 Subject: [PATCH 04/10] Apply the @override decorator CL-228 --- .../NetworkClusterPrinterOutputDevice.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index 999bc15223..dbc9f12974 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -13,6 +13,7 @@ from PyQt5.QtGui import QDesktopServices from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply from PyQt5.QtQml import QQmlComponent, QQmlContext from UM.Application import Application +from UM.Decorators import override from UM.Logger import Logger from UM.Message import Message from UM.OutputDevice import OutputDeviceError @@ -114,15 +115,19 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte ## No authentication, so requestAuthentication should do exactly nothing @pyqtSlot() + @override(NetworkPrinterOutputDevice) def requestAuthentication(self, message_id = None, action_id = "Retry"): - Logger.log("d", "requestAuthentication for Cura Connect - nothing to be done") + pass # Cura Connect doesn't do any authorization + @override(NetworkPrinterOutputDevice) def setAuthenticationState(self, auth_state): self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated + @override(NetworkPrinterOutputDevice) def _verifyAuthentication(self): pass + @override(NetworkPrinterOutputDevice) def _checkAuthentication(self): Logger.log("d", "_checkAuthentication Cura Connect - nothing to be done") From 6dade567584156cc3e1f5520d202d2fd62275393 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 2 Oct 2017 17:12:15 +0200 Subject: [PATCH 05/10] Unapply the @override decorator as it doesn't actually work CL-228 --- .../UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index dbc9f12974..c514a4b0df 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -115,19 +115,15 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte ## No authentication, so requestAuthentication should do exactly nothing @pyqtSlot() - @override(NetworkPrinterOutputDevice) def requestAuthentication(self, message_id = None, action_id = "Retry"): pass # Cura Connect doesn't do any authorization - @override(NetworkPrinterOutputDevice) def setAuthenticationState(self, auth_state): self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated - @override(NetworkPrinterOutputDevice) def _verifyAuthentication(self): pass - @override(NetworkPrinterOutputDevice) def _checkAuthentication(self): Logger.log("d", "_checkAuthentication Cura Connect - nothing to be done") From 1aa6d2876cc16b1c245b8f2751be52eb9d66dc74 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 2 Oct 2017 17:32:03 +0200 Subject: [PATCH 06/10] Revert "Use self._camera_active to detect whether we should show the camera" This reverts commit bd0b38f6885d0dabb24aa078ade2eed6425ff5ce. --- cura/PrinterOutputDevice.py | 2 +- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 827258ef3b..c6e98257ba 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -242,8 +242,8 @@ class PrinterOutputDevice(QObject, OutputDevice): @pyqtSlot() def stopCamera(self): - self._stopCamera() self._camera_active = False + self._stopCamera() def _stopCamera(self): Logger.log("w", "_stopCamera is not implemented by this output device") diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 9dbe193ed4..f23986f7f0 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -334,7 +334,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): else: #Camera wasn't even running. Don't try to stop it or you'll get a segfault. return - if self._camera_active: + if self._image_reply: try: self._image_reply.abort() self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) From 6fc62fd2b3ce3a81edc70ccf86a6a5a616453854 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 2 Oct 2017 17:34:49 +0200 Subject: [PATCH 07/10] Don't try to disconnect after aborting Because if the signal is not connected then we'd get a segfault in this case. Contributes to issue CURA-4376. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index f23986f7f0..9377fba6b9 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -331,13 +331,14 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if self._camera_timer.isActive(): self._camera_timer.stop() - else: #Camera wasn't even running. Don't try to stop it or you'll get a segfault. - return if self._image_reply: try: + try: + self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) + except TypeError: + pass #The signal was never connected. self._image_reply.abort() - self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) except RuntimeError: pass # It can happen that the wrapped c++ object is already deleted. self._image_reply = None From dd79b895f5cd9853f0e6d7a350cb924a45a757c7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 3 Oct 2017 10:00:48 +0200 Subject: [PATCH 08/10] Set support horizontal expansion back to 3 They discovered that the 2 was causing a lot of failed prints. --- resources/variants/ultimaker3_bb04.inst.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/variants/ultimaker3_bb04.inst.cfg b/resources/variants/ultimaker3_bb04.inst.cfg index 2194407d26..39d33b10f8 100644 --- a/resources/variants/ultimaker3_bb04.inst.cfg +++ b/resources/variants/ultimaker3_bb04.inst.cfg @@ -43,7 +43,7 @@ support_interface_height = 0.6 support_interface_skip_height = =layer_height support_join_distance = 3 support_line_width = =round(line_width * 0.4 / 0.35, 2) -support_offset = 2 +support_offset = 3 support_xy_distance = =round(wall_line_width_0 * 0.75, 2) support_xy_distance_overhang = =wall_line_width_0 / 2 switch_extruder_retraction_amount = 12 \ No newline at end of file From 9a30941ead6a88d71b69dd65ecd6a26308e6bfbd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 3 Oct 2017 10:59:00 +0200 Subject: [PATCH 09/10] Set support horizontal expansion back to 3 Also for Extended. --- resources/variants/ultimaker3_extended_bb04.inst.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/variants/ultimaker3_extended_bb04.inst.cfg b/resources/variants/ultimaker3_extended_bb04.inst.cfg index b678bdd1fc..a62480bd75 100644 --- a/resources/variants/ultimaker3_extended_bb04.inst.cfg +++ b/resources/variants/ultimaker3_extended_bb04.inst.cfg @@ -43,7 +43,7 @@ support_interface_height = 0.6 support_interface_skip_height = =layer_height support_join_distance = 3 support_line_width = =round(line_width * 0.4 / 0.35, 2) -support_offset = 2 +support_offset = 3 support_xy_distance = =round(wall_line_width_0 * 0.75, 2) support_xy_distance_overhang = =wall_line_width_0 / 2 switch_extruder_retraction_amount = 12 \ No newline at end of file From edc10e06307030bbf333ed325540ee6e662526b0 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 3 Oct 2017 11:21:47 +0200 Subject: [PATCH 10/10] fix topbar colors in monitor mode for UM3 networking --- resources/qml/Topbar.qml | 2 -- resources/themes/cura-dark/theme.json | 2 +- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 152a677467..b3a5137111 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -18,8 +18,6 @@ Rectangle height: UM.Theme.getSize("sidebar_header").height color: base.monitoringPrint ? UM.Theme.getColor("topbar_background_color_monitoring") : UM.Theme.getColor("topbar_background_color") - Behavior on color { ColorAnimation { duration: 100; } } - property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands property bool monitoringPrint: false diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index f39fe96c37..e61c48bffd 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -16,7 +16,7 @@ "secondary": [241, 242, 242, 255], "topbar_background_color": [0, 0, 0, 0], - "topbar_background_color_monitoring": [0, 0, 0, 0], + "topbar_background_color_monitoring": [31, 36, 39, 255], "topbar_button_text_active": [255, 255, 255, 255], "topbar_button_text_inactive": [128, 128, 128, 255], diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 5d50618eea..96ccd469b6 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -68,7 +68,7 @@ "secondary": [245, 245, 245, 255], "topbar_background_color": [255, 255, 255, 0], - "topbar_background_color_monitoring": [255, 255, 255, 0], + "topbar_background_color_monitoring": [255, 255, 255, 255], "topbar_button_text_active": [0, 0, 0, 255], "topbar_button_text_inactive": [128, 128, 128, 255],