diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py index 373f816373..535836eb5e 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/PrinterOutput/PrintJobOutputModel.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot -from typing import Optional, TYPE_CHECKING +from typing import Optional, TYPE_CHECKING, List from PyQt5.QtCore import QUrl from PyQt5.QtGui import QImage @@ -23,6 +23,7 @@ class PrintJobOutputModel(QObject): ownerChanged = pyqtSignal() configurationChanged = pyqtSignal() previewImageChanged = pyqtSignal() + compatibleMachineFamiliesChanged = pyqtSignal() def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None: super().__init__(parent) @@ -36,11 +37,21 @@ class PrintJobOutputModel(QObject): self._owner = "" # Who started/owns the print job? self._configuration = None # type: Optional[ConfigurationModel] - + self._compatible_machine_families = [] # type: List[str] self._preview_image_id = 0 self._preview_image = None + @pyqtProperty("QStringList", notify=compatibleMachineFamiliesChanged) + def compatibleMachineFamilies(self): + # Hack; Some versions of cluster will return a family more than once... + return set(self._compatible_machine_families) + + def setCompatibleMachineFamilies(self, compatible_machine_families: List[str]) -> None: + if self._compatible_machine_families != compatible_machine_families: + self._compatible_machine_families = compatible_machine_families + self.compatibleMachineFamiliesChanged.emit() + @pyqtProperty(QUrl, notify=previewImageChanged) def preview_image_url(self): self._preview_image_id += 1 diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index ba567b7bac..f009a33178 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -35,7 +35,7 @@ class PrinterOutputModel(QObject): self._key = "" # Unique identifier self._controller = output_controller self._extruders = [ExtruderOutputModel(printer = self, position = i) for i in range(number_of_extruders)] - self._printer_configuration = ConfigurationModel() # Indicates the current configuration setup in this printer + self._printer_configuration = ConfigurationModel() # Indicates the current configuration setup in this printer self._head_position = Vector(0, 0, 0) self._active_print_job = None # type: Optional[PrintJobOutputModel] self._firmware_version = firmware_version diff --git a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py index 7506a870a9..e0d996c80e 100644 --- a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py @@ -131,7 +131,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): raise OutputDeviceError.WriteRequestFailedError(i18n_catalog.i18nc("@info:status", "There are no file formats available to write with!")) preferred_format = file_formats[0] - #J ust take the first file format available. + # Just take the first file format available. if file_handler is not None: writer = file_handler.getWriterByMimeType(cast(str, preferred_format["mime_type"])) else: @@ -552,7 +552,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): configuration.setExtruderConfigurations(extruders) print_job.updateConfiguration(configuration) - + print_job.setCompatibleMachineFamilies(data["compatible_machine_families"]) print_job.stateChanged.connect(self._printJobStateChanged) return print_job diff --git a/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml index e54e70043e..1d5e5e6ce5 100644 --- a/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml @@ -290,7 +290,30 @@ Item onOpened: visible = true } + Row + { + id: printerFamilyPills + spacing: 0.5 * UM.Theme.getSize("default_margin").width + anchors + { + left: parent.left + right: parent.right + bottom: extrudersInfo.top + bottomMargin: UM.Theme.getSize("default_margin").height + } + height: childrenRect.height + Repeater + { + model: printJob.compatibleMachineFamilies + delegate: PrinterFamilyPill + { + text: modelData + color: UM.Theme.getColor("viewport_background") + padding: 3 + } + } + } // PrintCore && Material config Row {