From 95f234679c5dbd4f458a9d0e93b352dcfd628b13 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 26 Aug 2022 13:10:09 +0200 Subject: [PATCH 1/5] Placeholder; the selected printer to monitor is abstract, but cloud-capable. forms the base of CURA-9422 --- cura/Settings/MachineManager.py | 6 ++++++ plugins/MonitorStage/MonitorMain.qml | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 389c5ded75..a4988be49d 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -530,6 +530,10 @@ class MachineManager(QObject): def printerConnected(self) -> bool: return bool(self._printer_output_devices) + @pyqtProperty(bool, notify = printerConnectedStatusChanged) + def activeMachineIsAbstract(self) -> bool: + return (self.activeMachine is not None) and parseBool(self.activeMachine.getMetaDataEntry("is_abstract_machine", False)) + @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineIsGroup(self) -> bool: if self.activeMachine is None: @@ -554,6 +558,8 @@ class MachineManager(QObject): @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineHasCloudRegistration(self) -> bool: + if self.activeMachineIsAbstract: + return any(m.getMetaDataEntry("is_online", False) for m in self.getMachinesWithDefinition(self.activeMachine.definition.getId(), True)) return self.activeMachine is not None and ConnectionType.CloudConnection in self.activeMachine.configuredConnectionTypes @pyqtProperty(bool, notify = printerConnectedStatusChanged) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index 5d63ac5b83..848c4a7187 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -12,6 +12,7 @@ Rectangle id: viewportOverlay property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection + property bool isAbstractCloudPrinter: Cura.MachineManager.activeMachineIsAbstract // && Cura.MachineManager.activeMachineHasCloudRegistration property bool isNetworkConfigurable: { if(Cura.MachineManager.activeMachine === null) @@ -96,7 +97,7 @@ Rectangle { horizontalCenter: parent.horizontalCenter } - visible: isNetworkConfigured && !isConnected + visible: isNetworkConfigured && !isConnected && !isAbstractCloudPrinter text: catalog.i18nc("@info", "Please make sure your printer has a connection:\n- Check if the printer is turned on.\n- Check if the printer is connected to the network.\n- Check if you are signed in to discover cloud-connected printers.") font: UM.Theme.getFont("medium") width: contentWidth @@ -109,11 +110,25 @@ Rectangle { horizontalCenter: parent.horizontalCenter } - visible: !isNetworkConfigured && isNetworkConfigurable + visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter text: catalog.i18nc("@info", "Please connect your printer to the network.") font: UM.Theme.getFont("medium") width: contentWidth } + + UM.Label + { + id: sendToFactoryLabel + anchors + { + horizontalCenter: parent.horizontalCenter + } + visible: isAbstractCloudPrinter + text: catalog.i18nc("@info", "Please go to the Digital Factory. [PLACEHOLDER]") + font: UM.Theme.getFont("medium") + width: contentWidth + } + Item { anchors From 4f75251000e627c0b10bf368a92680f1f19699f0 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 26 Aug 2022 14:41:44 +0200 Subject: [PATCH 2/5] Prettify monitor page for abstract cloud printers. Fill placeholder. Image is the closest I could find in the current SVG's. Other than that, this should be it mostly for the 'monitoring' of abstract cloud printers. part of CURA-9422 --- plugins/MonitorStage/MonitorMain.qml | 42 ++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index 848c4a7187..eaf7fccf2a 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -116,17 +116,41 @@ Rectangle width: contentWidth } - UM.Label + Rectangle { - id: sendToFactoryLabel - anchors + id: sendToFactoryCard + color: UM.Theme.getColor("detail_background") + height: childrenRect.height + width: childrenRect.width + Column { - horizontalCenter: parent.horizontalCenter + spacing: UM.Theme.getSize("default_margin").height + padding: UM.Theme.getSize("default_margin").width + topPadding: 0 + + Image + { + anchors.horizontalCenter: parent.horizontalCenter + source: UM.Theme.getImage("first_run_ultimaker_cloud") + } + + UM.Label + { + anchors.horizontalCenter: parent.horizontalCenter + visible: isAbstractCloudPrinter + text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory") + font: UM.Theme.getFont("medium") + width: contentWidth + } + + Cura.PrimaryButton + { + id: sendToFactoryButton + anchors.horizontalCenter: parent.horizontalCenter + text: catalog.i18nc("@button", "View printers in Digital Factory") + onClicked: Qt.openUrlExternally("https://digitalfactory.ultimaker.com/app/print-jobs?utm_source=cura&utm_medium=software&utm_campaign=monitor-view-cloud-printer-type") + } } - visible: isAbstractCloudPrinter - text: catalog.i18nc("@info", "Please go to the Digital Factory. [PLACEHOLDER]") - font: UM.Theme.getFont("medium") - width: contentWidth } Item @@ -135,7 +159,7 @@ Rectangle { left: noNetworkLabel.left } - visible: !isNetworkConfigured && isNetworkConfigurable + visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter width: childrenRect.width height: childrenRect.height From 55c312e9bb28a8e1702d16fc7f7b41ed19a9e31a Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 26 Aug 2022 14:56:10 +0200 Subject: [PATCH 3/5] Some minor GUI tweaks. part of CURA-9422 --- plugins/MonitorStage/MonitorMain.qml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index eaf7fccf2a..549c6b2d10 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -120,16 +120,19 @@ Rectangle { id: sendToFactoryCard color: UM.Theme.getColor("detail_background") - height: childrenRect.height - width: childrenRect.width + height: childrenRect.height + UM.Theme.getSize("default_margin").height * 2 + width: childrenRect.width + UM.Theme.getSize("wide_margin").width * 2 Column { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter spacing: UM.Theme.getSize("default_margin").height padding: UM.Theme.getSize("default_margin").width topPadding: 0 Image { + id: sendToFactoryImage anchors.horizontalCenter: parent.horizontalCenter source: UM.Theme.getImage("first_run_ultimaker_cloud") } @@ -140,7 +143,10 @@ Rectangle visible: isAbstractCloudPrinter text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory") font: UM.Theme.getFont("medium") - width: contentWidth + width: sendToFactoryImage.width + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter } Cura.PrimaryButton From ad7c18d75e3c937459515bc60c42870fab2f1b94 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Aug 2022 09:26:08 +0200 Subject: [PATCH 4/5] Increase margins between image, text and action button in the monitor page CURA-9422 --- plugins/MonitorStage/MonitorMain.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index 549c6b2d10..9e745f9f1c 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -126,7 +126,7 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - spacing: UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("wide_margin").height padding: UM.Theme.getSize("default_margin").width topPadding: 0 From 6f4796f34f6179776724278e683f6eaaf6441c70 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 29 Aug 2022 09:26:26 +0200 Subject: [PATCH 5/5] Remove commented out code CURA-9422 --- plugins/MonitorStage/MonitorMain.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index 9e745f9f1c..8d19b116ce 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -12,7 +12,7 @@ Rectangle id: viewportOverlay property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection - property bool isAbstractCloudPrinter: Cura.MachineManager.activeMachineIsAbstract // && Cura.MachineManager.activeMachineHasCloudRegistration + property bool isAbstractCloudPrinter: Cura.MachineManager.activeMachineIsAbstract property bool isNetworkConfigurable: { if(Cura.MachineManager.activeMachine === null)