mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 04:05:25 +08:00
more mocks for monitor page, fix showing current print job in monitor page, add todo
This commit is contained in:
parent
117cf10a2c
commit
5e15858cae
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user