Browse Source

Fix: Retrieve printer type during creating outputDevice
CURA-5053

Aleksei S 7 years ago
parent
commit
e2cbfa8cec
1 changed files with 12 additions and 0 deletions
  1. 12 0
      cura/PrinterOutput/NetworkedPrinterOutputDevice.py

+ 12 - 0
cura/PrinterOutput/NetworkedPrinterOutputDevice.py

@@ -55,6 +55,14 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
 
         self._connection_state_before_timeout = None    # type: Optional[ConnectionState]
 
+        printer_type = self._properties.get(b"machine", b"").decode("utf-8")
+        if printer_type.startswith("9511"):
+            self._printer_type = "ultimaker3_extended"
+        elif printer_type.startswith("9066"):
+            self._printer_type = "ultimaker3"
+        else:
+            self._printer_type = "unknown"
+
     def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs) -> None:
         raise NotImplementedError("requestWrite needs to be implemented")
 
@@ -301,6 +309,10 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
     def firmwareVersion(self) -> str:
         return self._properties.get(b"firmware_version", b"").decode("utf-8")
 
+    @pyqtProperty(str, constant=True)
+    def printerType(self) -> str:
+        return self._printer_type
+
     ## IPadress of this printer
     @pyqtProperty(str, constant=True)
     def ipAddress(self) -> str: