From dd778f0450219cbc2f7309eeb08bc20065bd51af Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 4 Sep 2018 13:27:17 +0200 Subject: [PATCH] Add enabled state to printer, so that it can be displayed. This ensures that if a printer is set to "Not available", that the interface can correctly show it CL-896 --- cura/PrinterOutput/PrinterOutputModel.py | 11 +++++++++++ plugins/UM3NetworkPrinting/ClusterControlItem.qml | 13 ++++++++++++- plugins/UM3NetworkPrinting/ClusterMonitorItem.qml | 1 + .../UM3NetworkPrinting/ClusterUM3OutputDevice.py | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index f009a33178..36ae04fe48 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -26,6 +26,7 @@ class PrinterOutputModel(QObject): buildplateChanged = pyqtSignal() cameraChanged = pyqtSignal() configurationChanged = pyqtSignal() + enabledChanged = pyqtSignal() def __init__(self, output_controller: "PrinterOutputController", number_of_extruders: int = 1, parent=None, firmware_version = "") -> None: super().__init__(parent) @@ -43,12 +44,22 @@ class PrinterOutputModel(QObject): self._is_preheating = False self._printer_type = "" self._buildplate_name = None + self._enabled = True self._printer_configuration.extruderConfigurations = [extruder.extruderConfiguration for extruder in self._extruders] self._camera = None + @pyqtProperty(bool, notify=enabledChanged) + def enabled(self) -> bool: + return self._enabled + + def updateEnabled(self, enabled: bool) -> None: + if self._enabled != enabled: + self._enabled = enabled + self.enabledChanged.emit() + @pyqtProperty(str, constant = True) def firmwareVersion(self): return self._firmware_version diff --git a/plugins/UM3NetworkPrinting/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/ClusterControlItem.qml index 3a0c37e830..e91d2844a8 100644 --- a/plugins/UM3NetworkPrinting/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterControlItem.qml @@ -192,7 +192,18 @@ Component Label { id: activeJobLabel - text: modelData.activePrintJob != null ? modelData.activePrintJob.name : "waiting" + text: + { + if(!modelData.enabled) + { + return catalog.i18nc("@label:status", "Not available") + } + if(modelData.activePrintjob != null) + { + return modelData.activePrintJob.name + } + return catalog.i18nc("@label:status", "Waiting") + } anchors.top: machineNameLabel.bottom width: parent.width elide: Text.ElideRight diff --git a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml index 73ddbaf61a..3132dca81c 100644 --- a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml @@ -23,6 +23,7 @@ Component name: "cura" } + Label { id: manageQueueLabel diff --git a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py index e0d996c80e..3b7d575938 100644 --- a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py @@ -595,6 +595,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): printer.updateName(data["friendly_name"]) printer.updateKey(data["uuid"]) printer.updateType(data["machine_variant"]) + printer.updateEnabled(data["enabled"]) # Do not store the build plate information that comes from connect if the current printer has not build plate information if "build_plate" in data and machine_definition.getMetaDataEntry("has_variant_buildplates", False):