From 4ea437ba283e39165b9b72abb1e429641868d0e9 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 31 Aug 2022 14:13:47 +0200 Subject: [PATCH 1/3] Make send to DF in monitor for abstract printer work (again-ish). Already moslty implemented, but a new approach of the base feature (abstract cloud printers) made a more? elegant and functioning implementation possible. (re)implements CURA-9422 --- cura/Settings/MachineManager.py | 10 +- plugins/MonitorStage/MonitorMain.qml | 52 +------- .../resources/qml/MonitorStage.qml | 63 +++++++++- .../images/cura_connected_printers.svg | 111 ++++++++++++++++++ .../images/cura_connected_printers.svg | 9 ++ .../images/illustration_connect_printers.svg | 1 - 6 files changed, 186 insertions(+), 60 deletions(-) create mode 100644 resources/themes/cura-dark/images/cura_connected_printers.svg create mode 100644 resources/themes/cura-light/images/cura_connected_printers.svg delete mode 100644 resources/themes/cura-light/images/illustration_connect_printers.svg diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index fc11beb2c8..d091ab9f6f 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Ultimaker B.V. +# Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import time @@ -531,9 +531,9 @@ 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 = globalContainerChanged) + def activeMachineIsAbstractCloudPrinter(self) -> bool: + return len(self._printer_output_devices) == 1 and self._printer_output_devices[0].__class__.__name__ == "AbstractCloudOutputDevice" @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineIsGroup(self) -> bool: @@ -559,8 +559,6 @@ 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 768366c664..a89938530c 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 @@ -12,7 +12,6 @@ Rectangle id: viewportOverlay property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection - property bool isAbstractCloudPrinter: Cura.MachineManager.activeMachineIsAbstract property bool isNetworkConfigurable: { if(Cura.MachineManager.activeMachine === null) @@ -97,7 +96,7 @@ Rectangle { horizontalCenter: parent.horizontalCenter } - visible: isNetworkConfigured && !isConnected && !isAbstractCloudPrinter + visible: isNetworkConfigured && !isConnected 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 @@ -110,62 +109,19 @@ Rectangle { horizontalCenter: parent.horizontalCenter } - visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter + visible: !isNetworkConfigured && isNetworkConfigurable text: catalog.i18nc("@info", "Please connect your printer to the network.") font: UM.Theme.getFont("medium") width: contentWidth } - Rectangle - { - id: sendToFactoryCard - visible: isAbstractCloudPrinter - color: UM.Theme.getColor("detail_background") - 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("wide_margin").height - padding: UM.Theme.getSize("default_margin").width - topPadding: 0 - - Image - { - id: sendToFactoryImage - anchors.horizontalCenter: parent.horizontalCenter - source: UM.Theme.getImage("illustration_connect_printers") - } - - UM.Label - { - anchors.horizontalCenter: parent.horizontalCenter - text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory") - font: UM.Theme.getFont("medium") - width: sendToFactoryImage.width - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - - 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") - } - } - } - Item { anchors { left: noNetworkLabel.left } - visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter + visible: !isNetworkConfigured && isNetworkConfigurable width: childrenRect.width height: childrenRect.height diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index 6e8f6b4ebd..c55c00f378 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -1,8 +1,8 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 -import UM 1.3 as UM +import QtQuick 2.15 +import UM 1.5 as UM import Cura 1.0 as Cura // This is the root component for the monitor stage. @@ -37,6 +37,7 @@ Component Item { id: printers + visible: !Cura.MachineManager.activeMachineIsAbstractCloudPrinter anchors { top: parent.top @@ -69,14 +70,66 @@ Component top: printers.bottom topMargin: 48 * screenScaleFactor // TODO: Theme! } - visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs + visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter } PrinterVideoStream { anchors.fill: parent cameraUrl: OutputDevice.activeCameraUrl - visible: OutputDevice.activeCameraUrl != "" + visible: OutputDevice.activeCameraUrl != "" && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter + } + + Rectangle + { + id: sendToFactoryCard + + visible: Cura.MachineManager.activeMachineIsAbstractCloudPrinter + + color: UM.Theme.getColor("detail_background") + height: childrenRect.height + UM.Theme.getSize("default_margin").height * 2 + width: childrenRect.width + UM.Theme.getSize("wide_margin").width * 2 + anchors + { + horizontalCenter: parent.horizontalCenter + top: parent.top + topMargin: UM.Theme.getSize("wide_margin").height * screenScaleFactor * 2 + } + + Column + { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + spacing: UM.Theme.getSize("wide_margin").height + padding: UM.Theme.getSize("default_margin").width + topPadding: 0 + + Image + { + id: sendToFactoryImage + anchors.horizontalCenter: parent.horizontalCenter + source: UM.Theme.getImage("cura_connected_printers") + } + + UM.Label + { + anchors.horizontalCenter: parent.horizontalCenter + text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory") + font: UM.Theme.getFont("medium") + width: sendToFactoryImage.width + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + 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") + } + } } } } diff --git a/resources/themes/cura-dark/images/cura_connected_printers.svg b/resources/themes/cura-dark/images/cura_connected_printers.svg new file mode 100644 index 0000000000..d7d0dc9d23 --- /dev/null +++ b/resources/themes/cura-dark/images/cura_connected_printers.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/images/cura_connected_printers.svg b/resources/themes/cura-light/images/cura_connected_printers.svg new file mode 100644 index 0000000000..9e67f62451 --- /dev/null +++ b/resources/themes/cura-light/images/cura_connected_printers.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/resources/themes/cura-light/images/illustration_connect_printers.svg b/resources/themes/cura-light/images/illustration_connect_printers.svg deleted file mode 100644 index d18302bdf1..0000000000 --- a/resources/themes/cura-light/images/illustration_connect_printers.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From afeec473f6753c94b10e3d9fabd725d29efc036d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 31 Aug 2022 14:15:05 +0200 Subject: [PATCH 2/3] Small fixes (mostly QML warnings and the like). done as part of CURA-9422 --- cura/Settings/GlobalStack.py | 1 - .../UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml | 4 ++-- resources/qml/PrinterSelector/MachineListButton.qml | 4 ++-- resources/qml/PrinterSelector/MachineSelector.qml | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 43232da725..b94ca45763 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -90,7 +90,6 @@ class GlobalStack(CuraContainerStack): @pyqtProperty("QVariantList", notify=configuredConnectionTypesChanged) def configuredConnectionTypes(self) -> List[int]: """The configured connection types can be used to find out if the global - stack is configured to be connected with a printer, without having to know all the details as to how this is exactly done (and without actually setting the stack to be active). diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 64aa4e7a9c..c0662cfc82 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -153,7 +153,7 @@ Item MonitorPrinterPill { - text: printJob.configuration.printerType + text: printJob ? printJob.configuration.printerType : "" } } } @@ -173,7 +173,7 @@ Item id: printerConfiguration anchors.verticalCenter: parent.verticalCenter buildplate: catalog.i18nc("@label", "Glass") - configurations: base.printJob.configuration.extruderConfigurations + configurations: base.printJob ? base.printJob.configuration.extruderConfigurations : null height: Math.round(72 * screenScaleFactor) // TODO: Theme! } diff --git a/resources/qml/PrinterSelector/MachineListButton.qml b/resources/qml/PrinterSelector/MachineListButton.qml index 55ae5497d9..1ed9f98c46 100644 --- a/resources/qml/PrinterSelector/MachineListButton.qml +++ b/resources/qml/PrinterSelector/MachineListButton.qml @@ -68,11 +68,11 @@ Button top: buttonText.top bottom: buttonText.bottom } - visible: model.isAbstractMachine + visible: model.isAbstractMachine ? model.isAbstractMachine : false UM.Label { - text: model.machineCount + text: model.machineCount ? model.machineCount : "" anchors.centerIn: parent font: UM.Theme.getFont("default_bold") } diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 869d536a00..0008529408 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -223,7 +223,6 @@ Cura.ExpandablePopup id: buttonRow anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter anchors.left: parent.left anchors.right: parent.right From 60a670f2ed300d4e4919fece74f9342436d2cbe6 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 31 Aug 2022 15:56:02 +0200 Subject: [PATCH 3/3] Update light-mode cura_connected_printers svg Old one was not displaying on my machine CURA-9422 --- .../cura-light/images/cura_connected_printers.svg | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/resources/themes/cura-light/images/cura_connected_printers.svg b/resources/themes/cura-light/images/cura_connected_printers.svg index 9e67f62451..d18302bdf1 100644 --- a/resources/themes/cura-light/images/cura_connected_printers.svg +++ b/resources/themes/cura-light/images/cura_connected_printers.svg @@ -1,9 +1 @@ - - - - - - - - - + \ No newline at end of file