From e04a63d337b66d0c9c1b8bac3fa5bdc8fee86590 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sat, 30 Sep 2017 10:48:16 +0200 Subject: [PATCH 01/34] CL-468 The sidebar in the monitor tab should have a grey background Subtask of CL-457 Cura plugin: primary visual improvements --- plugins/UM3NetworkPrinting/ClusterControlItem.qml | 4 +++- plugins/UM3NetworkPrinting/ClusterMonitorItem.qml | 4 ++-- resources/themes/cura-dark/theme.json | 2 +- resources/themes/cura-light/theme.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/ClusterControlItem.qml index f2e2b601f2..e4e3d890a0 100644 --- a/plugins/UM3NetworkPrinting/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterControlItem.qml @@ -6,11 +6,13 @@ import Cura 1.0 as Cura Component { - Item + Rectangle { id: base property var manager: Cura.MachineManager.printerOutputDevices[0] anchors.fill: parent + color: UM.Theme.getColor("viewport_background") + property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. diff --git a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml index 48fb0a33fc..497b762ea9 100644 --- a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml @@ -10,8 +10,8 @@ Component Rectangle { width: maximumWidth - height: maximumHeight - color: "#FFFFFF" // TODO; Should not be hardcoded. + height: maximumHeight + color: UM.Theme.getColor("viewport_background") property var emphasisColor: "#44c0ff" //TODO: should be linked to theme. property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 187896aa28..f39fe96c37 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": [39, 44, 48, 255], + "topbar_background_color_monitoring": [0, 0, 0, 0], "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 62e22e4f0d..74b6bfb7ab 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, 255], + "topbar_background_color_monitoring": [255, 255, 255, 0], "topbar_button_text_active": [0, 0, 0, 255], "topbar_button_text_inactive": [128, 128, 128, 255], From 7aa2f5f0b8d037d35ffa32d40e235f24c4c1789d Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sat, 30 Sep 2017 10:52:34 +0200 Subject: [PATCH 02/34] Disable the fade on the monitor blue overlay to prevent the annoying "flash of blue" problem CL-457 CL-468 --- resources/qml/Cura.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2399fb4395..c157396c7d 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -386,7 +386,10 @@ UM.MainWindow visible: opacity > 0 opacity: base.showPrintMonitor ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 100; } } + // Behavior on opacity { NumberAnimation { duration: 100; } } + + // ^ This has been turned off to prevent the flash of blue when switch from + // Monitor tab to Prepare in combination with a Cura Connect printer. MouseArea { anchors.fill: parent From 43a6231131f77ebfe27adedfc294076229ce8c80 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sat, 30 Sep 2017 11:05:04 +0200 Subject: [PATCH 03/34] CL-469 Remove the "Printer Group" text from the sidebar. Subtask of CL-457 Cura plugin: primary visual improvements --- plugins/UM3NetworkPrinting/ClusterControlItem.qml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/UM3NetworkPrinting/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/ClusterControlItem.qml index e4e3d890a0..4df0232dcc 100644 --- a/plugins/UM3NetworkPrinting/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterControlItem.qml @@ -31,22 +31,13 @@ Component anchors.horizontalCenter: parent.horizontalCenter text: Cura.MachineManager.printerOutputDevices[0].name } - Label - { - id: printerGroupLabel - anchors.top: activePrintersLabel.bottom - text: catalog.i18nc("@label", "PRINTER GROUP") - anchors.horizontalCenter: parent.horizontalCenter - font: UM.Theme.getFont("very_small") - opacity: 0.65 - } - + Rectangle { id: printJobArea border.width: UM.Theme.getSize("default_lining").width border.color: lineColor - anchors.top: printerGroupLabel.bottom + anchors.top: activePrintersLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width From cee8a687da6ea16d78e72378eb8a11790d8f563b Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sat, 30 Sep 2017 11:06:31 +0200 Subject: [PATCH 04/34] Show the printer status as 'printing' in the case that a running print job isn't under control of Cura Connect --- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index e548c9e9d7..d20e4bd22f 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -266,6 +266,10 @@ Rectangle return ""; } } + if (printer.status == "printing") + { + return catalog.i18nc("@label:status", "Printing") + } return catalog.i18nc("@label:status", "Available"); } From eb85c28c10670619bede1020770cfeb49cdd810c Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sat, 30 Sep 2017 11:46:55 +0200 Subject: [PATCH 05/34] CL-476 "View print jobs" and "View printers" buttons should be blue Subtask of CL-457 Cura plugin: primary visual improvements --- .../UM3NetworkPrinting/OpenPanelButton.qml | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/OpenPanelButton.qml b/plugins/UM3NetworkPrinting/OpenPanelButton.qml index 3915c1f9eb..a06a97f8f9 100644 --- a/plugins/UM3NetworkPrinting/OpenPanelButton.qml +++ b/plugins/UM3NetworkPrinting/OpenPanelButton.qml @@ -14,5 +14,58 @@ Button { tooltip: catalog.i18nc("@info:tooltip", "Opens the print jobs page with your default web browser.") text: catalog.i18nc("@action:button", "View print jobs") - style: UM.Theme.styles.sidebar_action_button + // FIXME: This button style is copied and duplicated from SaveButton.qml + style: ButtonStyle { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: + { + if(!control.enabled) + return UM.Theme.getColor("action_button_disabled_border"); + else if(control.pressed) + return UM.Theme.getColor("print_button_ready_pressed_border"); + else if(control.hovered) + return UM.Theme.getColor("print_button_ready_hovered_border"); + else + return UM.Theme.getColor("print_button_ready_border"); + } + color: + { + if(!control.enabled) + return UM.Theme.getColor("action_button_disabled"); + else if(control.pressed) + return UM.Theme.getColor("print_button_ready_pressed"); + else if(control.hovered) + return UM.Theme.getColor("print_button_ready_hovered"); + else + return UM.Theme.getColor("print_button_ready"); + } + + Behavior on color { ColorAnimation { duration: 50; } } + + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) + + Label { + id: actualLabel + anchors.centerIn: parent + color: + { + if(!control.enabled) + return UM.Theme.getColor("action_button_disabled_text"); + else if(control.pressed) + return UM.Theme.getColor("print_button_ready_text"); + else if(control.hovered) + return UM.Theme.getColor("print_button_ready_text"); + else + return UM.Theme.getColor("print_button_ready_text"); + } + font: UM.Theme.getFont("action_button") + text: control.text; + } + } + label: Item { } + } + + } From 553a309d2367966c8eb99fa4b069bd0462034f3c Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sat, 30 Sep 2017 12:59:46 +0200 Subject: [PATCH 06/34] CL-473 Print job duration time has the wrong format. Use the Cura format from the Prepare tab. Subtask of CL-457 Cura plugin: primary visual improvements --- .../NetworkClusterPrinterOutputDevice.py | 5 +++++ plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index 2a14b1d6dc..e28e63c8ea 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -17,6 +17,7 @@ from UM.Logger import Logger from UM.Message import Message from UM.OutputDevice import OutputDeviceError from UM.i18n import i18nCatalog +from UM.Qt.Duration import Duration, DurationFormat from . import NetworkPrinterOutputDevice @@ -652,3 +653,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte self._reply.abort() self._reply = None Application.getInstance().showPrintMonitor.emit(False) + + @pyqtSlot(int, result=str) + def formatDuration(self, seconds): + return Duration(seconds).getDisplayString(DurationFormat.Format.Short) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index d20e4bd22f..c2cb4b7383 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -14,14 +14,7 @@ Rectangle function getPrettyTime(time) { - var hours = Math.floor(time / 3600) - time -= hours * 3600 - var minutes = Math.floor(time / 60); - time -= minutes * 60 - var seconds = Math.floor(time); - - var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); - return finalTime; + return OutputDevice.formatDuration(time) } function formatPrintJobPercent(printJob) From 5865d5200039c9918cdc189e4a0f2c6cc48cd9be Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sun, 1 Oct 2017 12:01:08 +0200 Subject: [PATCH 07/34] CL-474 Fix the image used for the camera icon Subtask of CL-457 Cura plugin: primary visual improvements --- .../UM3NetworkPrinting/PrinterInfoBlock.qml | 25 ++++++++++++++----- plugins/UM3NetworkPrinting/camera-icon.svg | 9 ++++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index c2cb4b7383..c1ca7eba0b 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -136,15 +136,28 @@ Rectangle anchors.right: printProgressArea.left anchors.rightMargin: UM.Theme.getSize("default_margin").width color: emphasisColor - UM.RecolorImage + + Image { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter + width: 40 * screenScaleFactor + height: width + anchors.right: printProgressArea.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width source: "camera-icon.svg" - width: sourceSize.width - height: sourceSize.height * width / sourceSize.width - color: "white" } + + // FIXME: Currently using Image instead of UM.RecolorImage because RecolorImage has + // the bad side effect of scaling/shrinking the image on my HiDPI laptop screen(!) + + // UM.RecolorImage + // { + // anchors.verticalCenter: parent.verticalCenter + // anchors.horizontalCenter: parent.horizontalCenter + // source: "camera-icon.svg" + // width: sourceSize.width + // height: sourceSize.height * width / sourceSize.width + // color: "white" + // } } Row // PrintCode config diff --git a/plugins/UM3NetworkPrinting/camera-icon.svg b/plugins/UM3NetworkPrinting/camera-icon.svg index 2aafc4b6f4..29adfa5875 100644 --- a/plugins/UM3NetworkPrinting/camera-icon.svg +++ b/plugins/UM3NetworkPrinting/camera-icon.svg @@ -1,3 +1,6 @@ - - - + + + + + + \ No newline at end of file From 3abf25937ba39f58d5563a3fb2851fb000495894 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sun, 1 Oct 2017 13:30:44 +0200 Subject: [PATCH 08/34] CL-470 Add icons to the printer state box on the monitor tab. Subtask of CL-457 Cura plugin: primary visual improvements --- .../UM3NetworkPrinting/PrinterInfoBlock.qml | 38 ++++++++++++++++++- .../action-required-icon.svg | 8 ++++ plugins/UM3NetworkPrinting/blocked-icon.svg | 6 +++ plugins/UM3NetworkPrinting/checkmark-icon.svg | 3 ++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 plugins/UM3NetworkPrinting/action-required-icon.svg create mode 100644 plugins/UM3NetworkPrinting/blocked-icon.svg create mode 100644 plugins/UM3NetworkPrinting/checkmark-icon.svg diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index c1ca7eba0b..23e0c712f7 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -223,6 +223,9 @@ Rectangle //border.color: lineColor height: 40 * screenScaleFactor anchors.left: parent.left + property var showPercent: { + return printJob != null && (["printing", "post_print", "pre_print", "sent_to_printer"].indexOf(printJob.status) !== -1); + } Label { @@ -283,6 +286,7 @@ Rectangle font: UM.Theme.getFont("small") } + Label { id: progressText @@ -292,10 +296,42 @@ Rectangle anchors.top: statusText.top text: formatPrintJobPercent(printJob) - visible: printJob != null && (["printing", "post_print", "pre_print", "sent_to_printer"].indexOf(printJob.status) !== -1) + visible: printProgressTitleBar.showPercent opacity: 0.65 font: UM.Theme.getFont("very_small") } + + Image + { + width: 16 * screenScaleFactor + height: width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.top: statusText.top + + visible: ! printProgressTitleBar.showPercent + + source: { + if ( ! printer.enabled) + { + return "blocked-icon.svg"; + } + if (printJob != null) + { + if(printJob.status === "queued") + { + if (printJob.configuration_changes_required != null && printJob.configuration_changes_required.length !== 0) + { + return "action-required-icon.svg"; + } + } else if (printJob.status === "wait_cleanup") + { + return "checkmark-icon.svg"; + } + } + } + } + Rectangle { //TODO: This will become a progress bar in the future diff --git a/plugins/UM3NetworkPrinting/action-required-icon.svg b/plugins/UM3NetworkPrinting/action-required-icon.svg new file mode 100644 index 0000000000..78d3b2e398 --- /dev/null +++ b/plugins/UM3NetworkPrinting/action-required-icon.svg @@ -0,0 +1,8 @@ + + + + + ! + + + diff --git a/plugins/UM3NetworkPrinting/blocked-icon.svg b/plugins/UM3NetworkPrinting/blocked-icon.svg new file mode 100644 index 0000000000..991343018b --- /dev/null +++ b/plugins/UM3NetworkPrinting/blocked-icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/plugins/UM3NetworkPrinting/checkmark-icon.svg b/plugins/UM3NetworkPrinting/checkmark-icon.svg new file mode 100644 index 0000000000..446e65c87b --- /dev/null +++ b/plugins/UM3NetworkPrinting/checkmark-icon.svg @@ -0,0 +1,3 @@ + + + From 2264c6c30342d5973dbc07b4c575351f4d0a99c9 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 11:37:08 +0200 Subject: [PATCH 09/34] CL-457 corrected qml errors --- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index 23e0c712f7..ac869cf80c 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -141,8 +141,8 @@ Rectangle { width: 40 * screenScaleFactor height: width - anchors.right: printProgressArea.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.right: parent.right + anchors.rightMargin: parent.rightMargin source: "camera-icon.svg" } @@ -301,7 +301,7 @@ Rectangle font: UM.Theme.getFont("very_small") } - Image + Image { width: 16 * screenScaleFactor height: width @@ -310,7 +310,7 @@ Rectangle anchors.top: statusText.top visible: ! printProgressTitleBar.showPercent - + source: { if ( ! printer.enabled) { @@ -329,6 +329,7 @@ Rectangle return "checkmark-icon.svg"; } } + return ""; // We're not going to show it, so it will not be resolved as a url. } } @@ -354,7 +355,7 @@ Rectangle width: parent.width - 2 * UM.Theme.getSize("default_margin").width - visible: showExtended + visible: printProgressArea.showExtended Label // Status detail { From 48ad909431241be27b8df592244ff630bcaa45c8 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 11:45:09 +0200 Subject: [PATCH 10/34] CL-457 removed commented out code --- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 13 ------------- resources/qml/Cura.qml | 5 ----- 2 files changed, 18 deletions(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index ac869cf80c..f8c957880a 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -145,19 +145,6 @@ Rectangle anchors.rightMargin: parent.rightMargin source: "camera-icon.svg" } - - // FIXME: Currently using Image instead of UM.RecolorImage because RecolorImage has - // the bad side effect of scaling/shrinking the image on my HiDPI laptop screen(!) - - // UM.RecolorImage - // { - // anchors.verticalCenter: parent.verticalCenter - // anchors.horizontalCenter: parent.horizontalCenter - // source: "camera-icon.svg" - // width: sourceSize.width - // height: sourceSize.height * width / sourceSize.width - // color: "white" - // } } Row // PrintCode config diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c157396c7d..455b8afdfc 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -386,11 +386,6 @@ UM.MainWindow visible: opacity > 0 opacity: base.showPrintMonitor ? 1 : 0 - // Behavior on opacity { NumberAnimation { duration: 100; } } - - // ^ This has been turned off to prevent the flash of blue when switch from - // Monitor tab to Prepare in combination with a Cura Connect printer. - MouseArea { anchors.fill: parent acceptedButtons: Qt.AllButtons From f15f6e2e377e8784e888f55530cf3fea73481319 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 11:55:54 +0200 Subject: [PATCH 11/34] CL-457 added margin to top in monitor screen --- plugins/UM3NetworkPrinting/ClusterControlItem.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/ClusterControlItem.qml index 4df0232dcc..194337cca0 100644 --- a/plugins/UM3NetworkPrinting/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterControlItem.qml @@ -29,9 +29,11 @@ Component id: activePrintersLabel font: UM.Theme.getFont("large") anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.top: parent.top text: Cura.MachineManager.printerOutputDevices[0].name } - + Rectangle { id: printJobArea @@ -233,4 +235,4 @@ Component } } } -} \ No newline at end of file +} From 7a85dc28d7440c89b5cfb299ff9f65d094378876 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 2 Oct 2017 13:35:19 +0200 Subject: [PATCH 12/34] Changing to a printer with user settings doesn't trigger keep/discard popup anymore Fixes #2499 CURA-4384 --- resources/qml/Cura.qml | 2 +- resources/qml/SidebarSimple.qml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2399fb4395..b1644ff303 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -818,7 +818,7 @@ UM.MainWindow Connections { - target: Printer + target: CuraApplication onShowDiscardOrKeepProfileChanges: { discardOrKeepProfileChangesDialog.show() diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 9987268d57..22ad9d460e 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -292,7 +292,8 @@ Item } onValueChanged: { - if(Cura.MachineManager.activeMachine != null) + // Only change if an active machine is set and the slider is visible at all. + if(Cura.MachineManager.activeMachine != null && visible) { //Prevent updating during view initializing. Trigger only if the value changed by user if(qualitySlider.value != qualityModel.activeQualityId) From e1001c1aa4a3d0d97e3438453b771d7af2420c13 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 2 Oct 2017 13:52:33 +0200 Subject: [PATCH 13/34] CL-470 Update the icon SVGs Subtask of CL-457 Cura plugin: primary visual improvements --- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 5 +++-- .../UM3NetworkPrinting/action-required-icon.svg | 14 ++++++++------ plugins/UM3NetworkPrinting/blocked-icon.svg | 5 +---- plugins/UM3NetworkPrinting/checkmark-icon.svg | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index f8c957880a..0500221990 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -290,7 +290,7 @@ Rectangle Image { - width: 16 * screenScaleFactor + width: statusText.height * screenScaleFactor height: width anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width @@ -311,7 +311,8 @@ Rectangle { return "action-required-icon.svg"; } - } else if (printJob.status === "wait_cleanup") + } + else if (printJob.status === "wait_cleanup") { return "checkmark-icon.svg"; } diff --git a/plugins/UM3NetworkPrinting/action-required-icon.svg b/plugins/UM3NetworkPrinting/action-required-icon.svg index 78d3b2e398..e7768849c6 100644 --- a/plugins/UM3NetworkPrinting/action-required-icon.svg +++ b/plugins/UM3NetworkPrinting/action-required-icon.svg @@ -1,8 +1,10 @@ - - - - - ! - + + + + + + + + diff --git a/plugins/UM3NetworkPrinting/blocked-icon.svg b/plugins/UM3NetworkPrinting/blocked-icon.svg index 991343018b..03bbe24e16 100644 --- a/plugins/UM3NetworkPrinting/blocked-icon.svg +++ b/plugins/UM3NetworkPrinting/blocked-icon.svg @@ -1,6 +1,3 @@ - - - - + diff --git a/plugins/UM3NetworkPrinting/checkmark-icon.svg b/plugins/UM3NetworkPrinting/checkmark-icon.svg index 446e65c87b..9d4507e551 100644 --- a/plugins/UM3NetworkPrinting/checkmark-icon.svg +++ b/plugins/UM3NetworkPrinting/checkmark-icon.svg @@ -1,3 +1,3 @@ - - + + From 8e4bc433d6deb70a963754172ead0ee3a0b2e086 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 2 Oct 2017 14:15:13 +0200 Subject: [PATCH 14/34] Added missing has_machine_quality tag for UM2 CURA-4382 --- resources/definitions/ultimaker2.def.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/definitions/ultimaker2.def.json b/resources/definitions/ultimaker2.def.json index 0a9a7bf7ce..6974e61938 100644 --- a/resources/definitions/ultimaker2.def.json +++ b/resources/definitions/ultimaker2.def.json @@ -14,6 +14,7 @@ "platform_texture": "Ultimaker2backplate.png", "platform_offset": [9, 0, 0], "has_materials": false, + "has_machine_quality": true, "first_start_actions": ["UM2UpgradeSelection"], "supported_actions":["UM2UpgradeSelection", "UpgradeFirmware"] }, From 1f8a5a1957cd882774789b517843f40e34a017bf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 2 Oct 2017 14:19:44 +0200 Subject: [PATCH 15/34] Minor codestyle refactor --- resources/qml/SidebarSimple.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 22ad9d460e..f8c3173c11 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -76,7 +76,7 @@ Item property var totalTicks: 0 property var availableTotalTicks: 0 - property var activeQualityId: 0 + property var activeQualityIndex: 0 property var qualitySliderStepWidth: 0 property var qualitySliderAvailableMin : 0 @@ -97,7 +97,7 @@ Item // Set selected value if (Cura.MachineManager.activeQualityId == qualityItem.id) { - qualityModel.activeQualityId = i + qualityModel.activeQualityIndex = i } // Set min available @@ -144,9 +144,13 @@ Item // check, the ticks count cannot be less than zero if(Cura.ProfilesModel.rowCount() != 0) + { qualityModel.totalTicks = Cura.ProfilesModel.rowCount() - 1 // minus one, because slider starts from 0 + } else + { qualityModel.totalTicks = 0 + } } } @@ -264,7 +268,7 @@ Item maximumValue: qualityModel.qualitySliderAvailableMax >= 0 ? qualityModel.qualitySliderAvailableMax : 0 stepSize: 1 - value: qualityModel.activeQualityId + value: qualityModel.activeQualityIndex width: qualityModel.qualitySliderStepWidth * qualityModel.availableTotalTicks @@ -296,7 +300,7 @@ Item if(Cura.MachineManager.activeMachine != null && visible) { //Prevent updating during view initializing. Trigger only if the value changed by user - if(qualitySlider.value != qualityModel.activeQualityId) + if(qualitySlider.value != qualityModel.activeQualityIndex) { //start updating with short delay qualitySliderChangeTimer.start(); From 5a3e427450af9407d99632ee3b07fd55de635a7e Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 14:20:41 +0200 Subject: [PATCH 16/34] 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 9cbd71059319a2a7d3df12966b916e7d45c1d8fe Mon Sep 17 00:00:00 2001 From: Jerooney Date: Mon, 2 Oct 2017 13:00:53 +0200 Subject: [PATCH 17/34] Update camera color This will apply to all UMO+, UM2, UM2+ and UM3 with old firmware users, which look at the camera view. The background changed from blue > grey. --- resources/themes/cura-light/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 74b6bfb7ab..5d50618eea 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -59,7 +59,7 @@ "colors": { "sidebar": [255, 255, 255, 255], "lining": [192, 193, 194, 255], - "viewport_overlay": [24, 41, 77, 192], + "viewport_overlay": [0, 0, 0, 192], "primary": [12, 169, 227, 255], "primary_hover": [48, 182, 231, 255], From 321e531b1cf9485787e2fa1d4b968c99523120a3 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 15:03:07 +0200 Subject: [PATCH 18/34] CL-457 remove screenScaleFactor because statusText.height already has devicePixelRatio included --- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index 0500221990..f18e3cfe08 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -290,7 +290,7 @@ Rectangle Image { - width: statusText.height * screenScaleFactor + width: statusText.height height: width anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width From e6fe33dcb9f0e7685647f95eea1a7d748b66d40e Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 15:04:45 +0200 Subject: [PATCH 19/34] CL-457 removed trailing spaces --- plugins/UM3NetworkPrinting/ClusterMonitorItem.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml index 497b762ea9..c1d852072f 100644 --- a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml @@ -10,7 +10,7 @@ Component Rectangle { width: maximumWidth - height: maximumHeight + height: maximumHeight color: UM.Theme.getColor("viewport_background") property var emphasisColor: "#44c0ff" //TODO: should be linked to theme. @@ -49,7 +49,7 @@ Component anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter - + width: Math.min(800 * screenScaleFactor, maximumWidth) height: children.height visible: OutputDevice.connectedPrinters.length != 0 From 889753f9581eb3c8a65d1bcfcc2dd69b03b2e5b4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 2 Oct 2017 15:12:56 +0200 Subject: [PATCH 20/34] Fix unit test CURA-4360 --- tests/TestMachineAction.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/TestMachineAction.py b/tests/TestMachineAction.py index 8a38668aaf..0118874a0b 100755 --- a/tests/TestMachineAction.py +++ b/tests/TestMachineAction.py @@ -1,6 +1,8 @@ #Todo: Write tests import pytest +# QtApplication needs to be imported first to prevent import errors. +from UM.Qt.QtApplication import QtApplication from cura.MachineAction import MachineAction from cura.MachineActionManager import MachineActionManager, NotUniqueMachineActionError, UnknownMachineActionError From d48ab89031ca1f5bc921aefbbdc7e306d652b3ef Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 2 Oct 2017 15:30:24 +0200 Subject: [PATCH 21/34] Overriding custom FDM printer with 1 extruder doesn't cause issue anymore. It would try to override extruders that weren't thare. This was caused by the previous change that would always load the extruders, but that should only happen for new machines, not for overrides. --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 22a9291acb..c8d1c85273 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -370,7 +370,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): ## Overrides an ExtruderStack in the given GlobalStack and returns the new ExtruderStack. def _overrideExtruderStack(self, global_stack, extruder_file_content): - # get extruder position first + # Get extruder position first extruder_config = configparser.ConfigParser() extruder_config.read_string(extruder_file_content) if not extruder_config.has_option("metadata", "position"): @@ -378,10 +378,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader): Logger.log("e", "Could not find 'metadata/position' in extruder stack file") raise RuntimeError(msg) extruder_position = extruder_config.get("metadata", "position") - extruder_stack = global_stack.extruders[extruder_position] - # override the given extruder stack + # Override the given extruder stack extruder_stack.deserialize(extruder_file_content) # return the new ExtruderStack @@ -699,8 +698,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader): extruder_file_content = archive.open(extruder_stack_file, "r").read().decode("utf-8") if self._resolve_strategies["machine"] == "override": - # deserialize new extruder stack over the current ones - stack = self._overrideExtruderStack(global_stack, extruder_file_content) + if global_stack.getProperty("machine_extruder_count", "value") > 1: + # deserialize new extruder stack over the current ones (if any) + stack = self._overrideExtruderStack(global_stack, extruder_file_content) elif self._resolve_strategies["machine"] == "new": new_id = extruder_stack_id_map[container_id] @@ -732,8 +732,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # Create a new definition_changes container if it was empty if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer(): stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack._id + "_settings")) - - extruder_stacks.append(stack) + if global_stack.getProperty("machine_extruder_count", "value") > 1: + extruder_stacks.append(stack) except: Logger.logException("w", "We failed to serialize the stack. Trying to clean up.") # Something went really wrong. Try to remove any data that we added. From 6d861c8a33e9a4bf2fe0782c7f0d0420db4022db Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 2 Oct 2017 15:41:07 +0200 Subject: [PATCH 22/34] 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 23/34] 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 4439ce1e433fe72fb15321086b0e2481e4177679 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 2 Oct 2017 16:31:32 +0200 Subject: [PATCH 24/34] Stop building and sending the POST request if the user has already aborted it all CL-511 --- .../NetworkClusterPrinterOutputDevice.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index 94bd6bc9a3..c719652427 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -275,7 +275,10 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte self._file_name = "%s.gcode.gz" % file_name self._showProgressMessage() - self._request = self._buildSendPrintJobHttpRequest(require_printer_name) + new_request = self._buildSendPrintJobHttpRequest(require_printer_name) + if new_request is None or self._stage != OutputStage.uploading: + return + self._request = new_request self._reply = self._manager.post(self._request, self._multipart) self._reply.uploadProgress.connect(self._onUploadProgress) # See _finishedPostPrintJobRequest() @@ -294,7 +297,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte gcode = getattr(Application.getInstance().getController().getScene(), "gcode_list") compressed_gcode = self._compressGcode(gcode) if compressed_gcode is None: - return # User aborted print, so stop trying. + return None # User aborted print, so stop trying. part.setBody(compressed_gcode) self._multipart.append(part) @@ -331,7 +334,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte for line in gcode: if not self._compressing_print: self._progress_message.hide() - return # Stop trying to zip, abort was called. + return None # Stop trying to zip, abort was called. batched_line += line # if the gcode was read from a gcode file, self._gcode will be a list of all lines in that file. # Compressing line by line in this case is extremely slow, so we need to batch them. From ece9f73a1055db401ea9d37bc41d4b70c90bea45 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 2 Oct 2017 16:32:38 +0200 Subject: [PATCH 25/34] Don't actively none/null out the Qt network objects. Let them live longer to avoid "premature object destroy" crashes. CL-511 --- .../UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index c719652427..2b69dd6a11 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -628,9 +628,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte request.setRawHeader(b"User-agent", b"CuraPrintClusterOutputDevice Plugin") def _cleanupRequest(self): - self._reply = None self._request = None - self._multipart = None self._stage = OutputStage.ready self._file_name = None @@ -683,8 +681,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte Logger.log("d", "User aborted sending print to remote.") self._progress_message.hide() self._compressing_print = False - self._stage = OutputStage.ready if self._reply: self._reply.abort() - self._reply = None + self._stage = OutputStage.ready Application.getInstance().showPrintMonitor.emit(False) From 189fc3fe948a4fd3ab8b6b7fc9699c91c0ce9785 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 2 Oct 2017 16:37:00 +0200 Subject: [PATCH 26/34] Added missing activeStack changed signal This fixes some issues with the recommended view when the first machine is added. CURA-4403 --- cura/Settings/MachineManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 520f95e293..e0e81fba1b 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -304,6 +304,7 @@ class MachineManager(QObject): quality.nameChanged.connect(self._onQualityNameChanged) self._active_container_stack = self._global_container_stack + self.activeStackChanged.emit() self._error_check_timer.start() From a9c732e6242bff4d91afdbbdbaa0bd843faf96a8 Mon Sep 17 00:00:00 2001 From: Robin den Hertog Date: Mon, 2 Oct 2017 16:20:02 +0200 Subject: [PATCH 27/34] Made sure printers are present before printjobs to avoid referring to unknown printers CL-523 Signed-off-by: Robin den Hertog --- .../NetworkClusterPrinterOutputDevice.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index 29ef75820e..34e91bccf3 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -174,18 +174,19 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte def _requestClusterStatus(self): # TODO: Handle timeout. We probably want to know if the cluster is still reachable or not. - url = QUrl(self._api_base_uri + "print_jobs/") - print_jobs_request = QNetworkRequest(url) - self._addUserAgentHeader(print_jobs_request) - self._manager.get(print_jobs_request) - # See _finishedPrintJobsRequest() - url = QUrl(self._api_base_uri + "printers/") printers_request = QNetworkRequest(url) self._addUserAgentHeader(printers_request) self._manager.get(printers_request) # See _finishedPrintersRequest() + if self._printers: # if printers is not empty + url = QUrl(self._api_base_uri + "print_jobs/") + print_jobs_request = QNetworkRequest(url) + self._addUserAgentHeader(print_jobs_request) + self._manager.get(print_jobs_request) + # See _finishedPrintJobsRequest() + def _finishedPrintJobsRequest(self, reply): try: json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) @@ -490,7 +491,8 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte printer_name = self.__getPrinterNameFromUuid(print_job["assigned_to"]) if printer_name is None: - printer_name = i18n_catalog.i18nc("@info:status", "Unknown printer") + # don't report on yet unknown printers + continue message_text = (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.") .format(printer_name=printer_name, job_name=print_job["name"])) From b7090feadbfe42f2517f0cf4b630503b708c36c3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 2 Oct 2017 16:11:59 +0200 Subject: [PATCH 28/34] Don't stop camera if it wasn't running Otherwise you get a segfault in the .abort() function down below. Contributes to issue CURA-4376. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index d489402d8e..592b0e9081 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -331,6 +331,8 @@ 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: From 894c3fc0daba04d9e1abf9ea0b0a4e8ed152c6cf Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 2 Oct 2017 16:42:53 +0200 Subject: [PATCH 29/34] Emit authenticationStateChanged when setting auth to NotAuthenticated So that the interface may display this as well. Contributes to issue CURA-4376. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 592b0e9081..f23986f7f0 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -428,7 +428,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): Logger.log("d", "Requestion authentication for %s due to action %s" % (self._key, action_id)) self._authentication_failed_message.hide() self._not_authenticated_message.hide() - self._authentication_state = AuthState.NotAuthenticated + self.setAuthenticationState(AuthState.NotAuthenticated) self._authentication_counter = 0 self._authentication_requested_message.setProgress(0) self._authentication_id = None @@ -615,7 +615,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # Reset authentication state self._authentication_requested_message.hide() - self._authentication_state = AuthState.NotAuthenticated + self.setAuthenticationState(AuthState.NotAuthenticated) self._authentication_counter = 0 self._authentication_timer.stop() From bd0b38f6885d0dabb24aa078ade2eed6425ff5ce Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 2 Oct 2017 16:55:04 +0200 Subject: [PATCH 30/34] Use self._camera_active to detect whether we should show the camera Because the camera timer is whether we should request the camera. Contributes to issue CURA-4376. --- 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 c6e98257ba..827258ef3b 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -242,8 +242,8 @@ class PrinterOutputDevice(QObject, OutputDevice): @pyqtSlot() def stopCamera(self): - self._camera_active = False self._stopCamera() + self._camera_active = False 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 f23986f7f0..9dbe193ed4 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._image_reply: + if self._camera_active: try: self._image_reply.abort() self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) From b5b3f47e4dd6130cbacb1aa7023ad9230bcc558a Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 2 Oct 2017 17:05:39 +0200 Subject: [PATCH 31/34] 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 32/34] 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 33/34] 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 34/34] 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