diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 980b9efa9e..ec7e7f4acf 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -155,9 +155,13 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): ## Get remote printers. @pyqtProperty("QVariantList", notify = _clusterPrintersChanged) - def printers(self): + def printers(self) -> List[PrinterOutputModel]: return self._printers + @pyqtProperty(int, notify = _clusterPrintersChanged) + def clusterSize(self) -> int: + return len(self._printers) + ## Get remote print jobs. @pyqtProperty("QVariantList", notify = printJobsChanged) def printJobs(self)-> List[UM3PrintJobOutputModel]: @@ -237,13 +241,15 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): self.printJobsChanged.emit() def _addPrintJob(self, job: CloudClusterPrintJob) -> None: + # TODO: somehow we don't see the queued print jobs on the monitor page yet, we have to figure out why. try: - printer = next(p for p in self._printers if job.printer_uuid == p.key) + printer = next(p for p in self._printers if job.printer_uuid == p.key or job.assigned_to == p.key) except StopIteration: return Logger.log("w", "Missing printer %s for job %s in %s", job.printer_uuid, job.uuid, [p.key for p in self._printers]) - self._print_jobs.append(job.createOutputModel(printer)) + print_job = job.createOutputModel(printer) + self._print_jobs.append(print_job) def _onPrintJobCreated(self, mesh: bytes, job_response: CloudJobResponse) -> None: self._api.uploadMesh(job_response, mesh, self._onPrintJobUploaded, self._updateUploadProgress, @@ -321,3 +327,11 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): @pyqtProperty(bool, notify = printJobsChanged) def receivedPrintJobs(self) -> bool: return True + + @pyqtSlot() + def openPrintJobControlPanel(self) -> None: + pass + + @pyqtSlot() + def openPrinterControlPanel(self) -> None: + pass diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJob.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJob.py index e2e3787435..36d878d46f 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJob.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJob.py @@ -1,6 +1,6 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import List +from typing import List, Optional from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from .CloudClusterPrinterConfiguration import CloudClusterPrinterConfiguration @@ -33,14 +33,15 @@ class CloudClusterPrintJob(BaseModel): super().__init__(**kwargs) self.printers = [CloudClusterPrinterConfiguration(**c) if isinstance(c, dict) else c for c in self.configuration] - self.printers = [CloudClusterPrintJobConstraint(**p) if isinstance(p, dict) else p - for p in self.constraints] + self.print_jobs = [CloudClusterPrintJobConstraint(**p) if isinstance(p, dict) else p + for p in self.constraints] ## Creates an UM3 print job output model based on this cloud cluster print job. # \param printer: The output model of the printer def createOutputModel(self, printer: PrinterOutputModel) -> UM3PrintJobOutputModel: model = UM3PrintJobOutputModel(printer.getController(), self.uuid, self.name) model.updateAssignedPrinter(printer) + printer.updateActivePrintJob(model) return model ## Updates an UM3 print job output model based on this cloud cluster print job. diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 70f4d2d0ee..965a698029 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -411,8 +411,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): ## Called when the connection to the cluster changes. def connect(self) -> None: - super().connect() - self.sendMaterialProfiles() + pass + # super().connect() + # self.sendMaterialProfiles() def _onGetPreviewImageFinished(self, reply: QNetworkReply) -> None: reply_url = reply.url().toString()