From edf8460619d9228a00154632abb76a88c2793ab3 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 27 Nov 2018 10:35:19 +0100 Subject: [PATCH 1/3] 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 4ff5e43a28f3fd7479cd60defa7935f74c2f5729 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 4 Dec 2018 17:24:48 +0100 Subject: [PATCH 2/3] 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 3/3] 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") }