From 0c9b9a3033cfe7e110103db15ce9acd7ec5a5b8a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 9 Feb 2017 17:34:51 +0100 Subject: [PATCH] Add fallback name property in PrinterOutputDevice It'll call this property, which gives an empty string, if the device doesn't implement giving a name. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 6 ++++++ plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 8f03bdff79..8a95748cf1 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -170,6 +170,12 @@ class PrinterOutputDevice(QObject, OutputDevice): def address(self): Logger.log("w", "address is not implemented by this output device.") + ## A human-readable name for the device. + @pyqtProperty(str, constant = True) + def name(self): + Logger.log("w", "name is not implemented by this output device.") + return "" + @pyqtProperty(str, notify = errorTextChanged) def errorText(self): return self._error_text diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 5790cdab77..7df3c7bf23 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -227,12 +227,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def address(self): return self._properties.get(b"address", b"").decode("utf-8") - ## Name of the printer (as returned from the zeroConf properties) + ## Name of the printer (as returned from the ZeroConf properties) @pyqtProperty(str, constant = True) def name(self): return self._properties.get(b"name", b"").decode("utf-8") - ## Firmware version (as returned from the zeroConf properties) + ## Firmware version (as returned from the ZeroConf properties) @pyqtProperty(str, constant=True) def firmwareVersion(self): return self._properties.get(b"firmware_version", b"").decode("utf-8")