From edf8460619d9228a00154632abb76a88c2793ab3 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 27 Nov 2018 10:35:19 +0100 Subject: [PATCH 01/22] Return empty material model for empty material CURA-5982 --- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 8314b0f089..f8726a5441 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -593,6 +593,15 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel": material_manager = CuraApplication.getInstance().getMaterialManager() material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"]) + # This can happen if the connected machine has no material in one or more extruders, so we should return an + # "empty" material model. + if material_group_list is None: + return MaterialOutputModel(guid = material_data["guid"], + type = material_data.get("type", ""), + color = material_data.get("color", ""), + brand = material_data.get("brand", ""), + name = material_data.get("name", "Empty") + ) # Sort the material groups by "is_read_only = True" first, and then the name alphabetically. read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list)) From 665e2d3060be1392695a89652e19015cd01c036a Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 3 Dec 2018 12:15:25 +0100 Subject: [PATCH 02/22] Move isActive and timeRemaining logic from QML to Python Contributes to CL-1153 --- cura/PrinterOutput/PrintJobOutputModel.py | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py index 25b168e6fd..c3e6b7d267 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/PrinterOutput/PrintJobOutputModel.py @@ -125,10 +125,34 @@ class PrintJobOutputModel(QObject): def timeElapsed(self): return self._time_elapsed + @pyqtProperty(int, notify = timeElapsedChanged) + def timeRemaining(self) -> int: + # Never get a negative time remaining + return max(self.timeTotal - self.timeElapsed, 0) + + @pyqtProperty(float, notify = timeElapsedChanged) + def progress(self) -> float: + result = self.timeElapsed / self.timeTotal + if result > 1.0: + result = 1.0 + return result + @pyqtProperty(str, notify=stateChanged) def state(self): return self._state + @pyqtProperty(bool, notify=stateChanged) + def isActive(self) -> bool: + inactiveStates = [ + "pausing", + "paused", + "resuming", + "wait_cleanup" + ] + if self.state in inactiveStates and self.timeRemaining > 0: + return False + return True + def updateTimeTotal(self, new_time_total): if self._time_total != new_time_total: self._time_total = new_time_total From 3d80e281743a34681fbb643239253dbab852d598 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 3 Dec 2018 12:15:38 +0100 Subject: [PATCH 03/22] Add some typings Contributes to CL-1153 --- cura/PrinterOutput/PrintJobOutputModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py index c3e6b7d267..604fd8e0b8 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/PrinterOutput/PrintJobOutputModel.py @@ -118,11 +118,11 @@ class PrintJobOutputModel(QObject): self.nameChanged.emit() @pyqtProperty(int, notify = timeTotalChanged) - def timeTotal(self): + def timeTotal(self) -> int: return self._time_total @pyqtProperty(int, notify = timeElapsedChanged) - def timeElapsed(self): + def timeElapsed(self) -> int: return self._time_elapsed @pyqtProperty(int, notify = timeElapsedChanged) @@ -138,7 +138,7 @@ class PrintJobOutputModel(QObject): return result @pyqtProperty(str, notify=stateChanged) - def state(self): + def state(self) -> str: return self._state @pyqtProperty(bool, notify=stateChanged) From a28cae0a43ff5e6e3c8e4a5912f0935e7978b2de Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 3 Dec 2018 12:18:33 +0100 Subject: [PATCH 04/22] Improve date rendering - Use "Mon Dec 3 at 12:39" if 7 days or more away. - Use "Mon at 12:39" if within 7 days but more than one away. - Use "tomorrow at 12:39" if one day away. - Use "today at 12:39" if today. Contributes to CL-1153 --- .../src/ClusterUM3OutputDevice.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 3b124faf66..292011929d 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -386,8 +386,24 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): @pyqtSlot(int, result = str) def getDateCompleted(self, time_remaining: int) -> str: current_time = time() - datetime_completed = datetime.fromtimestamp(current_time + time_remaining) - return (datetime_completed.strftime("%a %b ") + "{day}".format(day=datetime_completed.day)).upper() + completed = datetime.fromtimestamp(current_time + time_remaining) + today = datetime.fromtimestamp(current_time) + + # If finishing date is more than 7 days out, using "Mon Dec 3 at HH:MM" format + if completed.toordinal() > today.toordinal() + 7: + return completed.strftime("%a %b ") + "{day}".format(day=completed.day) + + # If finishing date is within the next week, use "Monday at HH:MM" format + elif completed.toordinal() > today.toordinal() + 1: + return completed.strftime("%a") + + # If finishing tomorrow, use "tomorrow at HH:MM" format + elif completed.toordinal() > today.toordinal(): + return "tomorrow" + + # If finishing today, use "today at HH:MM" format + else: + return "today" @pyqtSlot(str) def sendJobToTop(self, print_job_uuid: str) -> None: From c9ed044205ed92236dc344a6c2683b2e262f1826 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 3 Dec 2018 14:41:22 +0100 Subject: [PATCH 05/22] Improve printer status and progress bar Contributes to CL-1153 --- .../resources/qml/MonitorPrintJobPreview.qml | 38 ++++- .../qml/MonitorPrintJobProgressBar.qml | 136 ++++++++---------- .../resources/qml/MonitorPrinterCard.qml | 11 +- 3 files changed, 99 insertions(+), 86 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 1a69d2dc12..7ac2a1d8de 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -21,7 +21,18 @@ Item { id: previewImage anchors.fill: parent - opacity: printJob && printJob.state == "error" ? 0.5 : 1.0 + opacity: + { + if (!printJob) + { + return 0 + } + if (printJob.state == "error" || !printJob.isActive) + { + return 0.5 + } + return 1.0 + } source: printJob ? printJob.previewImageUrl : "" visible: printJob } @@ -47,11 +58,32 @@ Item UM.RecolorImage { - id: statusImage + id: overlayIcon anchors.centerIn: printJobPreview color: UM.Theme.getColor("monitor_image_overlay") height: 0.5 * printJobPreview.height - source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : "" + source: + { + switch(printJob.state) + { + case "error": + return "../svg/aborted-icon.svg" + case "wait_cleanup": + if (printJob.state == "wait_cleanup" && printJob.timeTotal > printJob.timeElapsed) + { + return "../svg/aborted-icon.svg" + } + break; + case "pausing": + return "../svg/paused-icon.svg" + case "paused": + return "../svg/paused-icon.svg" + case "resuming": + return "../svg/paused-icon.svg" + default: + return "" + } + } sourceSize { height: height diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index f70e1175a1..a7055f4c52 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -15,63 +15,10 @@ import UM 1.3 as UM Item { id: base + + // The print job which all other information is dervied from property var printJob: null - property var progress: - { - if (!printJob) - { - return 0 - } - var result = printJob.timeElapsed / printJob.timeTotal - if (result > 1.0) - { - result = 1.0 - } - return result - } - property var remainingTime: - { - if (!printJob) { - return 0 - } - /* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining - time from ever being less than 0. Negative durations cause strange behavior such - as displaying "-1h -1m". */ - return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0) - } - property var progressText: - { - if (!printJob) - { - return ""; - } - switch (printJob.state) - { - case "wait_cleanup": - if (printJob.timeTotal > printJob.timeElapsed) - { - return catalog.i18nc("@label:status", "Aborted") - } - return catalog.i18nc("@label:status", "Finished") - case "pre_print": - case "sent_to_printer": - return catalog.i18nc("@label:status", "Preparing") - case "aborted": - return catalog.i18nc("@label:status", "Aborted") - case "wait_user_action": - return catalog.i18nc("@label:status", "Aborted") - case "pausing": - return catalog.i18nc("@label:status", "Pausing") - case "paused": - return OutputDevice.formatDuration( remainingTime ) - case "resuming": - return catalog.i18nc("@label:status", "Resuming") - case "queued": - return catalog.i18nc("@label:status", "Action required") - default: - return OutputDevice.formatDuration( remainingTime ) - } - } + width: childrenRect.width height: 18 * screenScaleFactor // TODO: Theme! @@ -82,12 +29,12 @@ Item { verticalCenter: parent.verticalCenter } - value: progress; + value: printJob ? printJob.progress : 0 style: ProgressBarStyle { background: Rectangle { - color: "#e4e4f2" // TODO: Theme! + color: printJob && printJob.isActive ? "#e4e4f2" : "#f3f3f9" // TODO: Theme! implicitHeight: visible ? 8 * screenScaleFactor : 0 // TODO: Theme! implicitWidth: 180 * screenScaleFactor // TODO: Theme! radius: 4 * screenScaleFactor // TODO: Theme! @@ -95,41 +42,72 @@ Item progress: Rectangle { id: progressItem; - color: - { - if (printJob) - { - var state = printJob.state - var inactiveStates = [ - "pausing", - "paused", - "resuming", - "wait_cleanup" - ] - if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) - { - return UM.Theme.getColor("monitor_progress_fill_inactive") - } - } - return "#0a0850" // TODO: Theme! - } + color: printJob && printJob.isActive ? "#0a0850" : "#9392b2" // TODO: Theme! radius: 4 * screenScaleFactor // TODO: Theme! } } } Label { - id: progressLabel + id: percentLabel anchors { left: progressBar.right leftMargin: 18 * screenScaleFactor // TODO: Theme! } - text: progressText - color: "#374355" // TODO: Theme! + text: Math.round(printJob.progress * 100) + "%" + color: printJob && printJob.isActive ? "#374355" : "#babac1" // TODO: Theme! width: contentWidth font: UM.Theme.getFont("medium") // 14pt, regular + // FIXED-LINE-HEIGHT: + height: 18 * screenScaleFactor // TODO: Theme! + verticalAlignment: Text.AlignVCenter + } + Label + { + id: statusLabel + anchors + { + left: percentLabel.right + leftMargin: 18 * screenScaleFactor // TODO: Theme! + } + color: "#374355" // TODO: Theme! + font: UM.Theme.getFont("medium") // 14pt, regular + text: + { + if (!printJob) + { + return ""; + } + switch (printJob.state) + { + case "wait_cleanup": + if (printJob.timeTotal > printJob.timeElapsed) + { + return catalog.i18nc("@label:status", "Aborted") + } + return catalog.i18nc("@label:status", "Finished") + case "sent_to_printer": + return catalog.i18nc("@label:status", "Preparing...") + case "aborting": + return catalog.i18nc("@label:status", "Aborting...") + case "aborted": + return catalog.i18nc("@label:status", "Aborted") + case "pausing": + return catalog.i18nc("@label:status", "Pausing...") + case "paused": + return catalog.i18nc("@label:status", "Paused") + case "resuming": + return catalog.i18nc("@label:status", "Resuming...") + case "queued": + return catalog.i18nc("@label:status", "Action required") + default: + return catalog.i18nc("@label:status", "Finishes ") + OutputDevice.getDateCompleted( printJob.timeRemaining ) + " at " + OutputDevice.getTimeCompleted( printJob.timeRemaining ) + } + } + width: contentWidth + // FIXED-LINE-HEIGHT: height: 18 * screenScaleFactor // TODO: Theme! verticalAlignment: Text.AlignVCenter diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 975fe12244..ee7212760b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -183,6 +183,7 @@ Item printJob: base.printer.activePrintJob size: parent.height } + visible: printer.activePrintJob } Item @@ -193,14 +194,15 @@ Item } width: 216 * screenScaleFactor // TODO: Theme! height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme! + visible: printer.activePrintJob Label { id: printerJobNameLabel - text: base.printer.activePrintJob ? base.printer.activePrintJob.name : "Untitled" // TODO: I18N - color: "#414054" // TODO: Theme! + color: printer.activePrintJob && printer.activePrintJob.isActive ? "#414054" : "#babac1" // TODO: Theme! elide: Text.ElideRight font: UM.Theme.getFont("large") // 16pt, bold + text: base.printer.activePrintJob ? base.printer.activePrintJob.name : "Untitled" // TODO: I18N width: parent.width // FIXED-LINE-HEIGHT: @@ -217,10 +219,10 @@ Item topMargin: 6 * screenScaleFactor // TODO: Theme! left: printerJobNameLabel.left } - text: printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N - color: "#53657d" // TODO: Theme! + color: printer.activePrintJob && printer.activePrintJob.isActive ? "#53657d" : "#babac1" // TODO: Theme! elide: Text.ElideRight font: UM.Theme.getFont("very_small") // 12pt, regular + text: printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N width: parent.width // FIXED-LINE-HEIGHT: @@ -236,6 +238,7 @@ Item verticalCenter: parent.verticalCenter } printJob: printer.activePrintJob + visible: printer.activePrintJob } } } From cced42a55bce1fbecdde3f8ce383daeec6185d92 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 3 Dec 2018 14:41:45 +0100 Subject: [PATCH 06/22] Handle idle, unavailable, and unreachable states Contributes to CL-1153 --- .../resources/qml/MonitorPrinterCard.qml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index ee7212760b..8659037cb8 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -169,6 +169,30 @@ Item height: childrenRect.height spacing: 18 * screenScaleFactor // TODO: Theme! + Label + { + id: printerStatus + anchors + { + verticalCenter: parent.verticalCenter + } + color: "#414054" // TODO: Theme! + font: UM.Theme.getFont("large") // 16pt, bold + text: { + if (printer && printer.state == "disabled"){ + return catalog.i18nc("@label:status", "Unavailable") + } + if (printer && printer.state == "unreachable"){ + return catalog.i18nc("@label:status", "Unavailable") + } + if (printer && !printer.activePrintJob) + { + return catalog.i18nc("@label:status", "Idle") + } + return "" + } + } + Item { anchors From 95400282b907abf0a6d7ec707e209da50d0c1b36 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 3 Dec 2018 14:44:15 +0100 Subject: [PATCH 07/22] Simplify logic slightly Contributes to CL-1153 --- .../resources/qml/MonitorPrintJobPreview.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 7ac2a1d8de..b6b666cbf3 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -23,11 +23,7 @@ Item anchors.fill: parent opacity: { - if (!printJob) - { - return 0 - } - if (printJob.state == "error" || !printJob.isActive) + if (printJob && (printJob.state == "error" || !printJob.isActive)) { return 0.5 } From f320000ce5e5019d8f96af20b29aa266b54856f6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 17:23:44 +0100 Subject: [PATCH 08/22] Change default profile of Aurora and Alfawise printers Instead of the default layer height, we should change the default quality profile. This is necessary because the 'normal' quality profile doesn't define a layer height, so that should inherit from the 0.1mm default layer height. But if the printer turned the default into a 0.15mm layer height then that is wrong. Maybe we should let the normal quality profile overwrite it to 0.1mm, always? Contributes to issue CURA-5902. --- resources/definitions/alfawise_u20.def.json | 5 +---- resources/definitions/jgaurora_a1.def.json | 5 +---- resources/definitions/jgaurora_a5.def.json | 5 +---- resources/definitions/jgaurora_z_603s.def.json | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/resources/definitions/alfawise_u20.def.json b/resources/definitions/alfawise_u20.def.json index 87726fec3d..de8525fa4d 100644 --- a/resources/definitions/alfawise_u20.def.json +++ b/resources/definitions/alfawise_u20.def.json @@ -7,7 +7,7 @@ "author": "Samuel Pinches", "manufacturer": "Alfawise", "file_formats": "text/x-gcode", - "preferred_quality_type": "fine", + "preferred_quality_type": "fast", "machine_extruder_trains": { "0": "alfawise_u20_extruder_0" @@ -53,9 +53,6 @@ "material_bed_temperature": { "default_value": 50 }, - "layer_height": { - "default_value": 0.15 - }, "layer_height_0": { "default_value": 0.2 }, diff --git a/resources/definitions/jgaurora_a1.def.json b/resources/definitions/jgaurora_a1.def.json index 4fd2eb4994..b9a921c311 100644 --- a/resources/definitions/jgaurora_a1.def.json +++ b/resources/definitions/jgaurora_a1.def.json @@ -7,7 +7,7 @@ "author": "Samuel Pinches", "manufacturer": "JGAurora", "file_formats": "text/x-gcode", - "preferred_quality_type": "fine", + "preferred_quality_type": "fast", "machine_extruder_trains": { "0": "jgaurora_a1_extruder_0" @@ -53,9 +53,6 @@ "material_bed_temperature": { "default_value": 67 }, - "layer_height": { - "default_value": 0.15 - }, "layer_height_0": { "default_value": 0.12 }, diff --git a/resources/definitions/jgaurora_a5.def.json b/resources/definitions/jgaurora_a5.def.json index 02d9a9db4f..d84a8440e6 100644 --- a/resources/definitions/jgaurora_a5.def.json +++ b/resources/definitions/jgaurora_a5.def.json @@ -9,7 +9,7 @@ "file_formats": "text/x-gcode", "platform": "jgaurora_a5.stl", "platform_offset": [-242, -101, 273], - "preferred_quality_type": "fine", + "preferred_quality_type": "fast", "machine_extruder_trains": { "0": "jgaurora_a5_extruder_0" @@ -55,9 +55,6 @@ "material_bed_temperature": { "default_value": 67 }, - "layer_height": { - "default_value": 0.15 - }, "layer_height_0": { "default_value": 0.12 }, diff --git a/resources/definitions/jgaurora_z_603s.def.json b/resources/definitions/jgaurora_z_603s.def.json index 59e0ff129c..3a78585240 100644 --- a/resources/definitions/jgaurora_z_603s.def.json +++ b/resources/definitions/jgaurora_z_603s.def.json @@ -7,7 +7,7 @@ "author": "Samuel Pinches", "manufacturer": "JGAurora", "file_formats": "text/x-gcode", - "preferred_quality_type": "fine", + "preferred_quality_type": "fast", "machine_extruder_trains": { "0": "jgaurora_z_603s_extruder_0" @@ -53,9 +53,6 @@ "material_bed_temperature": { "default_value": 55 }, - "layer_height": { - "default_value": 0.15 - }, "layer_height_0": { "default_value": 0.2 }, From 0363c1257cf947aff14b2543a76edc7d4cd08b20 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 10:18:09 +0100 Subject: [PATCH 09/22] Improve exposed progress prop Contributes to CL-1153 --- cura/PrinterOutput/PrintJobOutputModel.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py index 604fd8e0b8..256c9dffe9 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/PrinterOutput/PrintJobOutputModel.py @@ -133,9 +133,8 @@ class PrintJobOutputModel(QObject): @pyqtProperty(float, notify = timeElapsedChanged) def progress(self) -> float: result = self.timeElapsed / self.timeTotal - if result > 1.0: - result = 1.0 - return result + # Never get a progress past 1.0 + return min(result, 1.0) @pyqtProperty(str, notify=stateChanged) def state(self) -> str: From ab245bbff6fe76d0647f9a8655bf0abbb3ee5595 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 10:23:26 +0100 Subject: [PATCH 10/22] Make "finishes at" single translatable string Contributes to CL-1153 --- .../resources/qml/MonitorPrintJobProgressBar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index a7055f4c52..4ca3c24d87 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -103,7 +103,7 @@ Item case "queued": return catalog.i18nc("@label:status", "Action required") default: - return catalog.i18nc("@label:status", "Finishes ") + OutputDevice.getDateCompleted( printJob.timeRemaining ) + " at " + OutputDevice.getTimeCompleted( printJob.timeRemaining ) + return catalog.i18nc("@label:status", "Finishes %1 at %2".arg(OutputDevice.getDateCompleted( printJob.timeRemaining ), OutputDevice.getTimeCompleted( printJob.timeRemaining ))) } } width: contentWidth From 9ec7428620e4ea31b1b172aeda86a29db28fd7c8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 4 Dec 2018 10:54:30 +0100 Subject: [PATCH 11/22] Fix setting visiblity current index CURA-5981 --- resources/qml/Preferences/SettingVisibilityPage.qml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index e319069502..1b964cad0c 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -115,15 +115,16 @@ UM.PreferencesPage currentIndex: { + var idx = -1; for(var i = 0; i < settingVisibilityPresetsModel.items.length; ++i) { if(settingVisibilityPresetsModel.items[i].presetId == settingVisibilityPresetsModel.activePreset) { - currentIndex = i; - return; + idx = i; + break; } } - return -1 + return idx; } onActivated: From 249a90199bd2da38aac6974a03a1a07f624b0acf Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 11:08:01 +0100 Subject: [PATCH 12/22] Improve printer status handling Contributes to CL-1153 --- .../resources/qml/MonitorPrintJobProgressBar.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index 4ca3c24d87..0d159af21c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -90,9 +90,11 @@ Item return catalog.i18nc("@label:status", "Finished") case "sent_to_printer": return catalog.i18nc("@label:status", "Preparing...") - case "aborting": + case "pre_print": + return catalog.i18nc("@label:status", "Preparing...") + case "aborting": // NOTE: Doesn't exist but maybe should someday return catalog.i18nc("@label:status", "Aborting...") - case "aborted": + case "aborted": // NOTE: Unused, see above return catalog.i18nc("@label:status", "Aborted") case "pausing": return catalog.i18nc("@label:status", "Pausing...") From 96b9c7f3ea045aaecf81fb3d79c72929f0ad8ce5 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 11:40:56 +0100 Subject: [PATCH 13/22] Fix multi-argument i18n string Contributes to CL-1153 --- .../resources/qml/MonitorPrintJobProgressBar.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index 0d159af21c..88418516ed 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -78,7 +78,7 @@ Item { if (!printJob) { - return ""; + return "" } switch (printJob.state) { @@ -105,7 +105,7 @@ Item case "queued": return catalog.i18nc("@label:status", "Action required") default: - return catalog.i18nc("@label:status", "Finishes %1 at %2".arg(OutputDevice.getDateCompleted( printJob.timeRemaining ), OutputDevice.getTimeCompleted( printJob.timeRemaining ))) + return catalog.i18nc("@label:status", "Finishes %1 at %2".arg(OutputDevice.getDateCompleted( printJob.timeRemaining )).arg(OutputDevice.getTimeCompleted( printJob.timeRemaining ))) } } width: contentWidth From 5b4fad3c08fe089bf216f91ac2ce889c4cc16e83 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 4 Dec 2018 14:54:15 +0100 Subject: [PATCH 14/22] When toggling auto-slice, force a re-slice CURA-5997 --- resources/qml/ActionPanel/SliceProcessWidget.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 14e149dddb..03d91db530 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -137,6 +137,10 @@ Column { var autoSlice = UM.Preferences.getValue("general/auto_slice") prepareButtons.autoSlice = autoSlice + if(autoSlice) + { + CuraApplication.backend.forceSlice() + } } } From 02e7f904734c3d0cae1a33f0a978d3c3aa088912 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 4 Dec 2018 15:02:24 +0100 Subject: [PATCH 15/22] Fix module importing in USBPrinting CURA-5943 --- plugins/USBPrinting/AutoDetectBaudJob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/USBPrinting/AutoDetectBaudJob.py b/plugins/USBPrinting/AutoDetectBaudJob.py index 6f1af6727a..78de864e57 100644 --- a/plugins/USBPrinting/AutoDetectBaudJob.py +++ b/plugins/USBPrinting/AutoDetectBaudJob.py @@ -3,8 +3,8 @@ from UM.Job import Job from UM.Logger import Logger -from plugins.USBPrinting.avr_isp import ispBase +from .avr_isp import ispBase from .avr_isp.stk500v2 import Stk500v2 from time import time, sleep From 43096c1bafc0790bf265709d46eb1b88eb7445dc Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 4 Dec 2018 15:03:43 +0100 Subject: [PATCH 16/22] Update USBPrinting version to 1.0.1 CURA-5943 --- plugins/USBPrinting/plugin.json | 2 +- resources/bundled_packages/cura.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/plugin.json b/plugins/USBPrinting/plugin.json index 3484c8a48a..5d3cba8415 100644 --- a/plugins/USBPrinting/plugin.json +++ b/plugins/USBPrinting/plugin.json @@ -1,7 +1,7 @@ { "name": "USB printing", "author": "Ultimaker B.V.", - "version": "1.0.0", + "version": "1.0.1", "api": 5, "description": "Accepts G-Code and sends them to a printer. Plugin can also update firmware.", "i18n-catalog": "cura" diff --git a/resources/bundled_packages/cura.json b/resources/bundled_packages/cura.json index ee82b17a75..d8a7df2478 100644 --- a/resources/bundled_packages/cura.json +++ b/resources/bundled_packages/cura.json @@ -515,7 +515,7 @@ "package_type": "plugin", "display_name": "USB Printing", "description": "Accepts G-Code and sends them to a printer. Plugin can also update firmware.", - "package_version": "1.0.0", + "package_version": "1.0.1", "sdk_version": 5, "website": "https://ultimaker.com", "author": { From ebb31409b80fe94db4d5638ef9244bdb6599fe1f Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 15:10:31 +0100 Subject: [PATCH 17/22] Always return a string for preview icon Contributes to CL-1153 --- .../UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index b6b666cbf3..2043837ff6 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -69,7 +69,7 @@ Item { return "../svg/aborted-icon.svg" } - break; + return ""; case "pausing": return "../svg/paused-icon.svg" case "paused": From 1494daf6712cc9d028799d3fa115ec9e8f4f4b8c Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 15:11:31 +0100 Subject: [PATCH 18/22] Simplify preview icon logic Contributes to CL-1153 --- .../resources/qml/MonitorPrintJobPreview.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 2043837ff6..84d325aa32 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -65,11 +65,7 @@ Item case "error": return "../svg/aborted-icon.svg" case "wait_cleanup": - if (printJob.state == "wait_cleanup" && printJob.timeTotal > printJob.timeElapsed) - { - return "../svg/aborted-icon.svg" - } - return ""; + return printJob.timeTotal > printJob.timeElapsed ? "../svg/aborted-icon.svg" : ""; case "pausing": return "../svg/paused-icon.svg" case "paused": From 014a138fda4fbd4776c0751b21ce2549cf5da1c8 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 4 Dec 2018 15:12:00 +0100 Subject: [PATCH 19/22] Remove semi-colon Contributes to CL-1153 --- .../UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 84d325aa32..ec26bbe568 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -65,7 +65,7 @@ Item case "error": return "../svg/aborted-icon.svg" case "wait_cleanup": - return printJob.timeTotal > printJob.timeElapsed ? "../svg/aborted-icon.svg" : ""; + return printJob.timeTotal > printJob.timeElapsed ? "../svg/aborted-icon.svg" : "" case "pausing": return "../svg/paused-icon.svg" case "paused": From b2238420fb2ee25d979bba5ef7015462298d340b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 4 Dec 2018 15:46:13 +0100 Subject: [PATCH 20/22] Ensure that reset always correctly gets set to basic The old code that simply resetted the preferences was still active, but this could cause a race condition in some situations. In those cases it would first set it to basic and then clear the preferences (thus resulting in no settings being visible) CURA-5981 --- resources/qml/Preferences/SettingVisibilityPage.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 1b964cad0c..2edbeee960 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -25,11 +25,7 @@ UM.PreferencesPage function reset() { - UM.Preferences.resetPreference("general/visible_settings") - - // After calling this function update Setting visibility preset combobox. - // Reset should set default setting preset ("Basic") - visibilityPreset.currentIndex = 1 + settingVisibilityPresetsModel.setActivePreset("basic") } resetEnabled: true; From 4ff5e43a28f3fd7479cd60defa7935f74c2f5729 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 4 Dec 2018 17:24:48 +0100 Subject: [PATCH 21/22] Handle Empty and Unknown material cases CURA-5982 --- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 1e0f538d8d..e31229680c 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -608,14 +608,15 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel": material_manager = CuraApplication.getInstance().getMaterialManager() material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"]) - # This can happen if the connected machine has no material in one or more extruders, so we should return an - # "empty" material model. + # This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the + # material is unknown to Cura, so we should return an "empty" or "unknown" material model. if material_group_list is None: + material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown" return MaterialOutputModel(guid = material_data["guid"], type = material_data.get("type", ""), color = material_data.get("color", ""), brand = material_data.get("brand", ""), - name = material_data.get("name", "Empty") + name = material_data.get("name", material_name) ) # Sort the material groups by "is_read_only = True" first, and then the name alphabetically. From e8a933331c0be8ce2086a26a982ee220282001d7 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 5 Dec 2018 12:14:18 +0100 Subject: [PATCH 22/22] Clean-up printer status label Contributes to CL-1153 --- .../resources/qml/MonitorPrinterCard.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 8659037cb8..567fff8489 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -179,13 +179,15 @@ Item color: "#414054" // TODO: Theme! font: UM.Theme.getFont("large") // 16pt, bold text: { - if (printer && printer.state == "disabled"){ + if (printer && printer.state == "disabled") + { return catalog.i18nc("@label:status", "Unavailable") } - if (printer && printer.state == "unreachable"){ - return catalog.i18nc("@label:status", "Unavailable") + if (printer && printer.state == "unreachable") + { + return catalog.i18nc("@label:status", "Unreachable") } - if (printer && !printer.activePrintJob) + if (printer && printer.state == "idle") { return catalog.i18nc("@label:status", "Idle") }