mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
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.
This commit is contained in:
parent
27c30006da
commit
0c9b9a3033
2 changed files with 8 additions and 2 deletions
|
@ -170,6 +170,12 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
def address(self):
|
def address(self):
|
||||||
Logger.log("w", "address is not implemented by this output device.")
|
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)
|
@pyqtProperty(str, notify = errorTextChanged)
|
||||||
def errorText(self):
|
def errorText(self):
|
||||||
return self._error_text
|
return self._error_text
|
||||||
|
|
|
@ -227,12 +227,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
def address(self):
|
def address(self):
|
||||||
return self._properties.get(b"address", b"").decode("utf-8")
|
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)
|
@pyqtProperty(str, constant = True)
|
||||||
def name(self):
|
def name(self):
|
||||||
return self._properties.get(b"name", b"").decode("utf-8")
|
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)
|
@pyqtProperty(str, constant=True)
|
||||||
def firmwareVersion(self):
|
def firmwareVersion(self):
|
||||||
return self._properties.get(b"firmware_version", b"").decode("utf-8")
|
return self._properties.get(b"firmware_version", b"").decode("utf-8")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue