printertype Parsing function made static

CURA-11138
This commit is contained in:
saumya.jain 2023-10-30 14:31:17 +01:00
parent c2e2511fdc
commit 39ec9c9279
2 changed files with 5 additions and 12 deletions

View file

@ -415,9 +415,10 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
@pyqtProperty(str, constant = True)
def printerType(self) -> str:
return self.getPrinterTypeIfMakerBot(self._properties.get(b"printer_type", b"Unknown").decode("utf-8"))
return NetworkedPrinterOutputDevice.getPrinterTypeIfMakerBot(self._properties.get(b"printer_type", b"Unknown").decode("utf-8"))
def getPrinterTypeIfMakerBot(self, printer_type):
@staticmethod
def getPrinterTypeIfMakerBot(printer_type):
method_printer_type = {
"fire_e": "ultimaker_method",
"lava_f": "ultimaker_methodx",

View file

@ -2,6 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, List
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice
from ..BaseModel import BaseModel
@ -34,7 +35,7 @@ class CloudClusterResponse(BaseModel):
self.host_version = host_version
self.host_internal_ip = host_internal_ip
self.friendly_name = friendly_name
self.printer_type = self.getPrinterTypeIfMakerBot(printer_type)
self.printer_type = NetworkedPrinterOutputDevice.getPrinterTypeIfMakerBot(printer_type)
self.printer_count = printer_count
self.capabilities = capabilities if capabilities is not None else []
super().__init__(**kwargs)
@ -52,12 +53,3 @@ class CloudClusterResponse(BaseModel):
"""
return str({k: v for k, v in self.__dict__.items() if k in {"cluster_id", "host_guid", "host_name", "status", "is_online", "host_version", "host_internal_ip", "friendly_name", "printer_type", "printer_count", "capabilities"}})
def getPrinterTypeIfMakerBot(self, printer_type):
method_printer_type = {
"fire_e": "ultimaker_method",
"lava_f": "ultimaker_methodx",
"magma_10": "ultimaker_methodxl"
}
if printer_type in method_printer_type:
return method_printer_type[printer_type]
return printer_type