Remove skeleton loading after print jobs received

Contributes to CL-1051
This commit is contained in:
Ian Paschal 2018-10-17 14:28:17 +02:00
parent b99bc06d1c
commit 2dcfc049ba
2 changed files with 11 additions and 1 deletions

View File

@ -70,7 +70,7 @@ Component {
top: queuedLabel.bottom; top: queuedLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height; topMargin: UM.Theme.getSize("default_margin").height;
} }
visible: printJobList.count === 0; visible: !queuedPrintJobs.visible;
width: Math.min(800 * screenScaleFactor, maximumWidth); width: Math.min(800 * screenScaleFactor, maximumWidth);
PrintJobInfoBlock { PrintJobInfoBlock {
@ -104,6 +104,7 @@ Component {
bottom: parent.bottom; bottom: parent.bottom;
} }
style: UM.Theme.styles.scrollview; style: UM.Theme.styles.scrollview;
visible: OutputDevice.receivedPrintJobs;
width: Math.min(800 * screenScaleFactor, maximumWidth); width: Math.min(800 * screenScaleFactor, maximumWidth);
ListView { ListView {

View File

@ -48,6 +48,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
printJobsChanged = pyqtSignal() printJobsChanged = pyqtSignal()
activePrinterChanged = pyqtSignal() activePrinterChanged = pyqtSignal()
activeCameraChanged = 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. # 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. # 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._dummy_lambdas = ("", {}, io.BytesIO()) #type: Tuple[str, Dict, Union[io.StringIO, io.BytesIO]]
self._print_jobs = [] # type: List[UM3PrintJobOutputModel] 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._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") 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]: def printJobs(self)-> List[UM3PrintJobOutputModel]:
return self._print_jobs return self._print_jobs
@pyqtProperty(bool, notify = receivedPrintJobsChanged)
def receivedPrintJobs(self) -> bool:
return self._received_print_jobs
@pyqtProperty("QVariantList", notify = printJobsChanged) @pyqtProperty("QVariantList", notify = printJobsChanged)
def queuedPrintJobs(self) -> List[UM3PrintJobOutputModel]: 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"] 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) self.get("print_jobs/{uuid}/preview_image".format(uuid=print_job.key), on_finished=self._onGetPreviewImageFinished)
def _onGetPrintJobsFinished(self, reply: QNetworkReply) -> None: def _onGetPrintJobsFinished(self, reply: QNetworkReply) -> None:
self._received_print_jobs = True
self.receivedPrintJobsChanged.emit()
if not checkValidGetReply(reply): if not checkValidGetReply(reply):
return return