mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-05 14:54:33 +08:00
Remove skeleton loading after print jobs received
Contributes to CL-1051
This commit is contained in:
parent
b99bc06d1c
commit
2dcfc049ba
@ -70,7 +70,7 @@ Component {
|
||||
top: queuedLabel.bottom;
|
||||
topMargin: UM.Theme.getSize("default_margin").height;
|
||||
}
|
||||
visible: printJobList.count === 0;
|
||||
visible: !queuedPrintJobs.visible;
|
||||
width: Math.min(800 * screenScaleFactor, maximumWidth);
|
||||
|
||||
PrintJobInfoBlock {
|
||||
@ -104,6 +104,7 @@ Component {
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
style: UM.Theme.styles.scrollview;
|
||||
visible: OutputDevice.receivedPrintJobs;
|
||||
width: Math.min(800 * screenScaleFactor, maximumWidth);
|
||||
|
||||
ListView {
|
||||
|
@ -48,6 +48,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||
printJobsChanged = pyqtSignal()
|
||||
activePrinterChanged = pyqtSignal()
|
||||
activeCameraChanged = pyqtSignal()
|
||||
receivedPrintJobsChanged = pyqtSignal()
|
||||
|
||||
# This is a bit of a hack, as the notify can only use signals that are defined by the class that they are in.
|
||||
# Inheritance doesn't seem to work. Tying them together does work, but i'm open for better suggestions.
|
||||
@ -62,6 +63,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||
self._dummy_lambdas = ("", {}, io.BytesIO()) #type: Tuple[str, Dict, Union[io.StringIO, io.BytesIO]]
|
||||
|
||||
self._print_jobs = [] # type: List[UM3PrintJobOutputModel]
|
||||
self._received_print_jobs = False # type: bool
|
||||
|
||||
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterMonitorItem.qml")
|
||||
self._control_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterControlItem.qml")
|
||||
@ -353,6 +355,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||
def printJobs(self)-> List[UM3PrintJobOutputModel]:
|
||||
return self._print_jobs
|
||||
|
||||
@pyqtProperty(bool, notify = receivedPrintJobsChanged)
|
||||
def receivedPrintJobs(self) -> bool:
|
||||
return self._received_print_jobs
|
||||
|
||||
@pyqtProperty("QVariantList", notify = printJobsChanged)
|
||||
def queuedPrintJobs(self) -> List[UM3PrintJobOutputModel]:
|
||||
return [print_job for print_job in self._print_jobs if print_job.state == "queued" or print_job.state == "error"]
|
||||
@ -461,6 +467,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||
self.get("print_jobs/{uuid}/preview_image".format(uuid=print_job.key), on_finished=self._onGetPreviewImageFinished)
|
||||
|
||||
def _onGetPrintJobsFinished(self, reply: QNetworkReply) -> None:
|
||||
self._received_print_jobs = True
|
||||
self.receivedPrintJobsChanged.emit()
|
||||
|
||||
if not checkValidGetReply(reply):
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user