mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 03:37:48 -06:00
Start with some fakes for monitor page
This commit is contained in:
parent
65d6791077
commit
97607419cf
2 changed files with 31 additions and 1 deletions
|
@ -6,7 +6,7 @@ import os
|
||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
from typing import List, Optional, Dict, cast, Union, Tuple
|
from typing import List, Optional, Dict, cast, Union, Tuple
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSignal, QUrl, pyqtProperty
|
from PyQt5.QtCore import QObject, pyqtSignal, QUrl, pyqtProperty, pyqtSlot
|
||||||
from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest
|
from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest
|
||||||
|
|
||||||
from UM import i18nCatalog
|
from UM import i18nCatalog
|
||||||
|
@ -209,6 +209,16 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
||||||
return [print_job for print_job in self._print_jobs
|
return [print_job for print_job in self._print_jobs
|
||||||
if print_job.state == "queued" or print_job.state == "error"]
|
if print_job.state == "queued" or print_job.state == "error"]
|
||||||
|
|
||||||
|
## Get remote print jobs that are assigned to a printer.
|
||||||
|
@pyqtProperty("QVariantList", notify = printJobsChanged)
|
||||||
|
def activePrintJobs(self) -> List[UM3PrintJobOutputModel]:
|
||||||
|
return [print_job for print_job in self._print_jobs if
|
||||||
|
print_job.assignedPrinter is not None and print_job.state != "queued"]
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify = printJobsChanged)
|
||||||
|
def receivedPrintJobs(self) -> bool:
|
||||||
|
return not self._sending_job
|
||||||
|
|
||||||
## 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()
|
super().connect()
|
||||||
|
@ -448,3 +458,22 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
||||||
message.show()
|
message.show()
|
||||||
self._sending_job = False # the upload has finished so we're not sending a job anymore
|
self._sending_job = False # the upload has finished so we're not sending a job anymore
|
||||||
self.writeFinished.emit()
|
self.writeFinished.emit()
|
||||||
|
|
||||||
|
## TODO: The following methods are required by the monitor page QML, but are not actually available using cloud.
|
||||||
|
# TODO: We fake the methods here to not break the monitor page.
|
||||||
|
|
||||||
|
@pyqtProperty(QObject, notify = printersChanged)
|
||||||
|
def activePrinter(self) -> Optional[PrinterOutputModel]:
|
||||||
|
return self._printers[0] or None
|
||||||
|
|
||||||
|
@pyqtSlot(QObject)
|
||||||
|
def setActivePrinter(self, printer: Optional[PrinterOutputModel]) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@pyqtProperty(QUrl, notify = printersChanged)
|
||||||
|
def activeCameraUrl(self) -> "QUrl":
|
||||||
|
return QUrl()
|
||||||
|
|
||||||
|
@pyqtSlot(QUrl)
|
||||||
|
def setActiveCameraUrl(self, camera_url: "QUrl") -> None:
|
||||||
|
pass
|
||||||
|
|
|
@ -114,6 +114,7 @@ class CloudOutputDeviceManager(NetworkClient):
|
||||||
device = CloudOutputDevice(cluster.cluster_id)
|
device = CloudOutputDevice(cluster.cluster_id)
|
||||||
self._output_device_manager.addOutputDevice(device)
|
self._output_device_manager.addOutputDevice(device)
|
||||||
self._remote_clusters[cluster.cluster_id] = device
|
self._remote_clusters[cluster.cluster_id] = device
|
||||||
|
device.connect() # TODO: remove this
|
||||||
self._connectToActiveMachine()
|
self._connectToActiveMachine()
|
||||||
|
|
||||||
## Remove a CloudOutputDevice
|
## Remove a CloudOutputDevice
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue