From d0ec7d10ce7570b5d1fde84dc126ba8283df6e11 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 4 Jan 2018 15:35:30 +0100 Subject: [PATCH] Printer discovery shows if a cluster is actually set up as a host CL-541 --- plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py | 6 ++++++ plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py index d13706cc4c..4283042bf2 100644 --- a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py @@ -73,6 +73,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): self._finished_jobs = [] + self._cluster_size = int(properties.get(b"cluster_size", 0)) + def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs): # Notify the UI that a switch to the print monitor should happen Application.getInstance().getController().setActiveStage("MonitorStage") @@ -95,6 +97,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): if self._printer_selection_dialog is not None: self._printer_selection_dialog.show() + @pyqtProperty(int, constant=True) + def clusterSize(self): + return self._cluster_size + @pyqtSlot() @pyqtSlot(str) def sendPrintJob(self, target_printer = ""): diff --git a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py index be62e68f03..c639c25007 100644 --- a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py @@ -240,7 +240,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): # or "Legacy" UM3 device. cluster_size = int(properties.get(b"cluster_size", -1)) - if cluster_size > 0: + if cluster_size >= 0: device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties) else: device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties)