From ce132e4c3f5292358a15c78ccd29aaace3e31f06 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 31 Oct 2023 11:48:44 +0100 Subject: [PATCH] Function name changed to make it a bit generic CURA-11138 --- .../PrinterOutput/Models/ExtruderConfigurationModel.py | 4 ++-- cura/PrinterOutput/NetworkedPrinterOutputDevice.py | 10 +++++----- .../src/Models/Http/CloudClusterResponse.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cura/PrinterOutput/Models/ExtruderConfigurationModel.py b/cura/PrinterOutput/Models/ExtruderConfigurationModel.py index 8ba285fc81..1c68ecce92 100644 --- a/cura/PrinterOutput/Models/ExtruderConfigurationModel.py +++ b/cura/PrinterOutput/Models/ExtruderConfigurationModel.py @@ -40,11 +40,11 @@ class ExtruderConfigurationModel(QObject): def setHotendID(self, hotend_id: Optional[str]) -> None: if self._hotend_id != hotend_id: - self._hotend_id = ExtruderConfigurationModel.getHotendIdIfMakerbot(hotend_id) + self._hotend_id = ExtruderConfigurationModel.applyNameMappingHotend(hotend_id) self.extruderConfigurationChanged.emit() @staticmethod - def getHotendIdIfMakerbot(hotendId) -> str: + def applyNameMappingHotend(hotendId) -> str: _EXTRUDER_NAME_MAP = { "mk14_hot":"1XA", "mk14_hot_s":"2XA", diff --git a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py index 5268786a4f..5c4b26632a 100644 --- a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py +++ b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py @@ -415,17 +415,17 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice): @pyqtProperty(str, constant = True) def printerType(self) -> str: - return NetworkedPrinterOutputDevice.getPrinterTypeIfMakerBot(self._properties.get(b"printer_type", b"Unknown").decode("utf-8")) + return NetworkedPrinterOutputDevice.applyPrinterTypeMapping(self._properties.get(b"printer_type", b"Unknown").decode("utf-8")) @staticmethod - def getPrinterTypeIfMakerBot(printer_type): - method_printer_type = { + def applyPrinterTypeMapping(printer_type): + _PRINTER_TYPE_NAME = { "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] + if printer_type in _PRINTER_TYPE_NAME: + return _PRINTER_TYPE_NAME[printer_type] return printer_type @pyqtProperty(str, constant = True) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py index 36b2bf016b..713582b8ad 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py @@ -35,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 = NetworkedPrinterOutputDevice.getPrinterTypeIfMakerBot(printer_type) + self.printer_type = NetworkedPrinterOutputDevice.applyPrinterTypeMapping(printer_type) self.printer_count = printer_count self.capabilities = capabilities if capabilities is not None else [] super().__init__(**kwargs)