CURA-5053 Changed printer type checking

"Still hard coded but at least doesn't use `elif` because `elif`/`else if` should not exist in any programming language." - Grumpy Pedants & Ian >:[
This commit is contained in:
Ian Paschal 2018-03-14 10:50:54 +01:00
parent 17525b9cb6
commit 4a16d04dd7

View file

@ -56,12 +56,15 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
self._connection_state_before_timeout = None # type: Optional[ConnectionState] self._connection_state_before_timeout = None # type: Optional[ConnectionState]
printer_type = self._properties.get(b"machine", b"").decode("utf-8") printer_type = self._properties.get(b"machine", b"").decode("utf-8")
if printer_type.startswith("9511"): printer_type_identifiers = {
self._printer_type = "ultimaker3_extended" "9066": "ultimaker3",
elif printer_type.startswith("9066"): "9511": "ultimaker3_extended"
self._printer_type = "ultimaker3" }
else: self._printer_type = "Unknown"
self._printer_type = "unknown" for key, value in printer_type_identifiers.items():
if printer_type.startswith(key):
self._printer_type = value
break
def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs) -> None: def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs) -> None:
raise NotImplementedError("requestWrite needs to be implemented") raise NotImplementedError("requestWrite needs to be implemented")