mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 20:05:15 +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.
|
## Get remote printers.
|
||||||
@pyqtProperty("QVariantList", notify = _clusterPrintersChanged)
|
@pyqtProperty("QVariantList", notify = _clusterPrintersChanged)
|
||||||
def printers(self):
|
def printers(self) -> List[PrinterOutputModel]:
|
||||||
return self._printers
|
return self._printers
|
||||||
|
|
||||||
|
@pyqtProperty(int, notify = _clusterPrintersChanged)
|
||||||
|
def clusterSize(self) -> int:
|
||||||
|
return len(self._printers)
|
||||||
|
|
||||||
## Get remote print jobs.
|
## Get remote print jobs.
|
||||||
@pyqtProperty("QVariantList", notify = printJobsChanged)
|
@pyqtProperty("QVariantList", notify = printJobsChanged)
|
||||||
def printJobs(self)-> List[UM3PrintJobOutputModel]:
|
def printJobs(self)-> List[UM3PrintJobOutputModel]:
|
||||||
@ -237,13 +241,15 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
|||||||
self.printJobsChanged.emit()
|
self.printJobsChanged.emit()
|
||||||
|
|
||||||
def _addPrintJob(self, job: CloudClusterPrintJob) -> None:
|
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:
|
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:
|
except StopIteration:
|
||||||
return Logger.log("w", "Missing printer %s for job %s in %s", job.printer_uuid, job.uuid,
|
return Logger.log("w", "Missing printer %s for job %s in %s", job.printer_uuid, job.uuid,
|
||||||
[p.key for p in self._printers])
|
[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:
|
def _onPrintJobCreated(self, mesh: bytes, job_response: CloudJobResponse) -> None:
|
||||||
self._api.uploadMesh(job_response, mesh, self._onPrintJobUploaded, self._updateUploadProgress,
|
self._api.uploadMesh(job_response, mesh, self._onPrintJobUploaded, self._updateUploadProgress,
|
||||||
@ -321,3 +327,11 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
|||||||
@pyqtProperty(bool, notify = printJobsChanged)
|
@pyqtProperty(bool, notify = printJobsChanged)
|
||||||
def receivedPrintJobs(self) -> bool:
|
def receivedPrintJobs(self) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def openPrintJobControlPanel(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def openPrinterControlPanel(self) -> None:
|
||||||
|
pass
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# 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 cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
||||||
from .CloudClusterPrinterConfiguration import CloudClusterPrinterConfiguration
|
from .CloudClusterPrinterConfiguration import CloudClusterPrinterConfiguration
|
||||||
@ -33,7 +33,7 @@ class CloudClusterPrintJob(BaseModel):
|
|||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.printers = [CloudClusterPrinterConfiguration(**c) if isinstance(c, dict) else c
|
self.printers = [CloudClusterPrinterConfiguration(**c) if isinstance(c, dict) else c
|
||||||
for c in self.configuration]
|
for c in self.configuration]
|
||||||
self.printers = [CloudClusterPrintJobConstraint(**p) if isinstance(p, dict) else p
|
self.print_jobs = [CloudClusterPrintJobConstraint(**p) if isinstance(p, dict) else p
|
||||||
for p in self.constraints]
|
for p in self.constraints]
|
||||||
|
|
||||||
## Creates an UM3 print job output model based on this cloud cluster print job.
|
## Creates an UM3 print job output model based on this cloud cluster print job.
|
||||||
@ -41,6 +41,7 @@ class CloudClusterPrintJob(BaseModel):
|
|||||||
def createOutputModel(self, printer: PrinterOutputModel) -> UM3PrintJobOutputModel:
|
def createOutputModel(self, printer: PrinterOutputModel) -> UM3PrintJobOutputModel:
|
||||||
model = UM3PrintJobOutputModel(printer.getController(), self.uuid, self.name)
|
model = UM3PrintJobOutputModel(printer.getController(), self.uuid, self.name)
|
||||||
model.updateAssignedPrinter(printer)
|
model.updateAssignedPrinter(printer)
|
||||||
|
printer.updateActivePrintJob(model)
|
||||||
return model
|
return model
|
||||||
|
|
||||||
## Updates an UM3 print job output model based on this cloud cluster print job.
|
## 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.
|
## Called when the connection to the cluster changes.
|
||||||
def connect(self) -> None:
|
def connect(self) -> None:
|
||||||
super().connect()
|
pass
|
||||||
self.sendMaterialProfiles()
|
# super().connect()
|
||||||
|
# self.sendMaterialProfiles()
|
||||||
|
|
||||||
def _onGetPreviewImageFinished(self, reply: QNetworkReply) -> None:
|
def _onGetPreviewImageFinished(self, reply: QNetworkReply) -> None:
|
||||||
reply_url = reply.url().toString()
|
reply_url = reply.url().toString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user