From 6af1e72ea330c009feb3a3834233481a442db2c7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 07:45:34 +0100 Subject: [PATCH 1/6] Show progress bar while autoslice is preparing Previously it would say 'preparing to slice'. Now it just says 'auto slicing' but with an indeterminate progress bar. Only the indeterminate progress bar just appears empty right now... Contributes to issue CURA-5997. --- resources/qml/ActionPanel/SliceProcessWidget.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 3329ac4b23..14e149dddb 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -44,7 +44,7 @@ Column { id: autoSlicingLabel width: parent.width - visible: prepareButtons.autoSlice && widget.backendState == UM.Backend.Processing + visible: prepareButtons.autoSlice && (widget.backendState == UM.Backend.Processing || widget.backendState == UM.Backend.NotStarted) text: catalog.i18nc("@label:PrintjobStatus", "Auto slicing...") color: UM.Theme.getColor("text") @@ -71,7 +71,8 @@ Column width: parent.width height: UM.Theme.getSize("progressbar").height value: progress - visible: widget.backendState == UM.Backend.Processing + indeterminate: widget.backendState == UM.Backend.NotStarted + visible: (widget.backendState == UM.Backend.Processing || (prepareButtons.autoSlice && widget.backendState == UM.Backend.NotStarted)) background: Rectangle { From e9f8757fac1b5740f7daab3dea3288940f092400 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 09:12:57 +0100 Subject: [PATCH 2/6] Change the info button in the action panel according to the designs Adjust the padding in the preview shortcut. --- .../qml/ActionPanel/OutputProcessWidget.qml | 2 + .../ActionPanel/PrintInformationWidget.qml | 3 -- resources/themes/cura-light/icons/info.svg | 48 ------------------- 3 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 resources/themes/cura-light/icons/info.svg diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 45cb1fdb41..6ab8dc6fbb 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -112,6 +112,8 @@ Column id: previewStageShortcut height: UM.Theme.getSize("action_panel_button").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Preview") onClicked: UM.Controller.setActiveStage("PreviewStage") diff --git a/resources/qml/ActionPanel/PrintInformationWidget.qml b/resources/qml/ActionPanel/PrintInformationWidget.qml index 82707576e0..25e380dea8 100644 --- a/resources/qml/ActionPanel/PrintInformationWidget.qml +++ b/resources/qml/ActionPanel/PrintInformationWidget.qml @@ -11,9 +11,6 @@ UM.RecolorImage { id: widget - //implicitHeight: UM.Theme.getSize("section_icon").height - //implicitWidth: UM.Theme.getSize("section_icon").width - source: UM.Theme.getIcon("info") width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height diff --git a/resources/themes/cura-light/icons/info.svg b/resources/themes/cura-light/icons/info.svg deleted file mode 100644 index 97e4fc4f35..0000000000 --- a/resources/themes/cura-light/icons/info.svg +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From c1f5c00a7e088fee409d7c7282607faf3976707f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 09:18:45 +0100 Subject: [PATCH 3/6] Forgot to add the icon --- resources/themes/cura-light/icons/info.svg | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 resources/themes/cura-light/icons/info.svg diff --git a/resources/themes/cura-light/icons/info.svg b/resources/themes/cura-light/icons/info.svg new file mode 100644 index 0000000000..9896b3dac8 --- /dev/null +++ b/resources/themes/cura-light/icons/info.svg @@ -0,0 +1,13 @@ + + + + Icon/ info + Created with Sketch. + + + + + + + + \ No newline at end of file From 57a852a15ae0ff9e292e3eff574c067399a29777 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 09:19:08 +0100 Subject: [PATCH 4/6] Don't show the background if there are less than 2 extruders to show in the Toolbar It caused a very tiny rectangle if the printer has only 1 extruder. Contributes to CURA-5984. --- resources/qml/Toolbar.qml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 07522dd535..5fbddea9ac 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -115,6 +115,7 @@ Item } radius: UM.Theme.getSize("default_radius").width color: UM.Theme.getColor("lining") + visible: extrudersModel.items.length > 1 } Column @@ -131,8 +132,7 @@ Item id: extruders width: childrenRect.width height: childrenRect.height - property var _model: Cura.ExtrudersModel { id: extrudersModel } - model: _model.items.length > 1 ? _model : 0 + model: extrudersModel.items.length > 1 ? extrudersModel : 0 delegate: ExtruderButton { @@ -144,13 +144,18 @@ Item } } + Cura.ExtrudersModel + { + id: extrudersModel + } + UM.PointingRectangle { - id: panelBorder; + id: panelBorder - anchors.left: parent.right; - anchors.leftMargin: UM.Theme.getSize("default_margin").width; - anchors.top: base.top; + anchors.left: parent.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: base.top anchors.topMargin: base.activeY z: buttons.z - 1 @@ -161,14 +166,14 @@ Item { if (panel.item && panel.width > 0) { - return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width); + return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width) } else { return 0; } } - height: panel.item ? panel.height + 2 * UM.Theme.getSize("default_margin").height : 0; + height: panel.item ? panel.height + 2 * UM.Theme.getSize("default_margin").height : 0 opacity: panel.item && panel.width > 0 ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } @@ -186,11 +191,11 @@ Item { id: panel - x: UM.Theme.getSize("default_margin").width; - y: UM.Theme.getSize("default_margin").height; + x: UM.Theme.getSize("default_margin").width + y: UM.Theme.getSize("default_margin").height source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : "" - enabled: UM.Controller.toolsEnabled; + enabled: UM.Controller.toolsEnabled } } From 12b3f0088d49c2fb064f775a6c6d26177a32f41d Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 4 Dec 2018 10:07:43 +0100 Subject: [PATCH 5/6] Add content type to file upload --- cura/PrinterOutput/NetworkedPrinterOutputDevice.py | 5 +++-- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py index 5677106782..72b6319020 100644 --- a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py +++ b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py @@ -180,10 +180,11 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice): self._createNetworkManager() assert (self._manager is not None) - def put(self, target: str, data: Union[str, bytes], on_finished: Optional[Callable[[QNetworkReply], None]], + def put(self, target: str, data: Union[str, bytes], content_type: str = None, + on_finished: Optional[Callable[[QNetworkReply], None]] = None, on_progress: Optional[Callable] = None) -> None: self._validateManager() - request = self._createEmptyRequest(target) + request = self._createEmptyRequest(target, content_type = content_type) self._last_request_time = time() if self._manager is not None: reply = self._manager.put(request, data if isinstance(data, bytes) else data.encode()) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index e2957cacae..63a109cf5c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -375,7 +375,7 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): # TODO: Multipart upload job_response = JobUploadResponse(**response.get("data")) Logger.log("i", "Print job created successfully: %s", job_response.__dict__) - self.put(job_response.upload_url, data = mesh, + self.put(job_response.upload_url, data = mesh, content_type = job_response.content_type, on_finished = lambda r: self._onPrintJobUploaded(job_response.job_id, r), on_progress = self._onUploadPrintJobProgress) From 97607419cfaddaa0403e8c48775fcb2530dcf114 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 4 Dec 2018 12:14:21 +0100 Subject: [PATCH 6/6] Start with some fakes for monitor page --- .../src/Cloud/CloudOutputDevice.py | 31 ++++++++++++++++++- .../src/Cloud/CloudOutputDeviceManager.py | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 63a109cf5c..747d911407 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -6,7 +6,7 @@ import os from json import JSONDecodeError 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 UM import i18nCatalog @@ -209,6 +209,16 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): return [print_job for print_job in self._print_jobs 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. def connect(self) -> None: super().connect() @@ -448,3 +458,22 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): message.show() self._sending_job = False # the upload has finished so we're not sending a job anymore 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 diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index 06beb8bce4..bc871ec7ac 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -114,6 +114,7 @@ class CloudOutputDeviceManager(NetworkClient): device = CloudOutputDevice(cluster.cluster_id) self._output_device_manager.addOutputDevice(device) self._remote_clusters[cluster.cluster_id] = device + device.connect() # TODO: remove this self._connectToActiveMachine() ## Remove a CloudOutputDevice