Browse Source

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
Remco Burema 2 years ago
parent
commit
4ea437ba28

+ 4 - 6
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)

+ 4 - 48
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
 

+ 58 - 5
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")
+                }
+            }
         }
     }
 }

+ 111 - 0
resources/themes/cura-dark/images/cura_connected_printers.svg

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 298 271">
+  <defs>
+    <style>
+      .cls-1, .cls-2, .cls-3, .cls-4, .cls-5, .cls-6, .cls-7, .cls-8, .cls-9, .cls-10 {
+        stroke: #f3f3f3;
+      }
+
+      .cls-1, .cls-2, .cls-3, .cls-4, .cls-5, .cls-6, .cls-8, .cls-11, .cls-9, .cls-10 {
+        stroke-miterlimit: 10;
+      }
+
+      .cls-1, .cls-12, .cls-4, .cls-10 {
+        fill: #555557;
+      }
+
+      .cls-1, .cls-9 {
+        stroke-width: 1.8px;
+      }
+
+      .cls-2 {
+        stroke-dasharray: 0 0 4 4;
+      }
+
+      .cls-2, .cls-3, .cls-4, .cls-5, .cls-6, .cls-7, .cls-8, .cls-11, .cls-10 {
+        stroke-width: 2px;
+      }
+
+      .cls-2, .cls-3, .cls-5, .cls-6, .cls-7, .cls-8, .cls-11, .cls-9 {
+        fill: none;
+      }
+
+      .cls-13 {
+        fill: #f3f3f3;
+      }
+
+      .cls-14 {
+        fill: #1f1f20;
+      }
+
+      .cls-3 {
+        stroke-dasharray: 0 0 4 4;
+      }
+
+      .cls-5 {
+        stroke-dasharray: 0 0 3.9 3.9;
+      }
+
+      .cls-6 {
+        stroke-dasharray: 0 0 3.81 3.81;
+      }
+
+      .cls-7 {
+        stroke-linecap: round;
+        stroke-linejoin: round;
+      }
+
+      .cls-11 {
+        stroke: #061884;
+      }
+
+      .cls-10 {
+        stroke-dasharray: 0 4;
+      }
+    </style>
+  </defs>
+  <g id="a">
+    <line class="cls-11" x1="150" y1="98" x2="150" y2="100"/>
+    <g>
+      <line class="cls-8" x1="150" y1="46" x2="150" y2="48"/>
+      <line class="cls-6" x1="150" y1="51.81" x2="150" y2="88.04"/>
+      <line class="cls-8" x1="150" y1="89.95" x2="150" y2="91.95"/>
+    </g>
+    <g>
+      <line class="cls-8" x1="227" y1="46" x2="227" y2="48"/>
+      <line class="cls-3" x1="227" y1="52" x2="227" y2="66"/>
+      <line class="cls-8" x1="227" y1="68" x2="227" y2="70"/>
+    </g>
+    <g>
+      <line class="cls-8" x1="73" y1="46" x2="73" y2="48"/>
+      <line class="cls-2" x1="73" y1="52" x2="73" y2="66.01"/>
+      <line class="cls-8" x1="73" y1="68.02" x2="73" y2="70.02"/>
+    </g>
+    <line class="cls-10" x1="74" y1="69" x2="72" y2="69"/>
+    <g>
+      <line class="cls-8" x1="228.01" y1="69" x2="226.01" y2="69"/>
+      <line class="cls-5" x1="222.11" y1="69" x2="75.95" y2="69"/>
+      <line class="cls-8" x1="74" y1="69" x2="72" y2="69"/>
+    </g>
+    <path class="cls-13" d="M91,0V36h-6.33l-4-3h-15.33l-4,3h-6.33V0h36Zm-2,2H57V34h3.67l4-3h16.67l4,3h3.67V2Zm-4,23c0,1.66-1.34,3-3,3h-18c-1.66,0-3-1.34-3-3V5h24V25Zm-15-18v3h6v-3h-6Zm13,0h-5v5h-10V7h-5V26h20V7Z"/>
+    <path class="cls-13" d="M168,0V36h-6.33l-4-3h-15.33l-4,3h-6.33V0h36Zm-2,2h-32V34h3.67l4-3h16.67l4,3h3.67V2Zm-4,23c0,1.66-1.34,3-3,3h-18c-1.66,0-3-1.34-3-3V5h24V25Zm-15-18v3h6v-3h-6Zm13,0h-5v5h-10V7h-5V26h20V7Z"/>
+    <path class="cls-13" d="M245,0V36h-6.33l-4-3h-15.33l-4,3h-6.33V0h36Zm-2,2h-32V34h3.67l4-3h16.67l4,3h3.67V2Zm-4,23c0,1.66-1.34,3-3,3h-18c-1.66,0-3-1.34-3-3V5h24V25Zm-15-18v3h6v-3h-6Zm13,0h-5v5h-10V7h-5V26h20V7Z"/>
+    <path class="cls-4" d="M28,97.1V254h242V97.1h0c0-3.37-2.73-6.1-6.1-6.1H34.1c-3.37,0-6.1,2.73-6.1,6.1Z"/>
+    <path class="cls-14" d="M261,255c.55,0,1-.45,1-1V102c0-1.66-1.34-3-3-3H38c-1.1,0-2,.9-2,2V254c0,.55,.45,1,1,1h224Z"/>
+    <path class="cls-13" d="M259,100H38c-.55,0-1,.45-1,1V254h224V102c0-1.1-.9-2-2-2m4,2V254c0,1.1-.9,2-2,2H37c-1.1,0-2-.9-2-2V101c0-1.66,1.34-3,3-3h221c2.21,0,4,1.79,4,4Z"/>
+    <path class="cls-12" d="M259,102H39V252h220V102m2,0V254H37V101c0-.55,.45-1,1-1h221c1.1,0,2,.9,2,2Z"/>
+    <line class="cls-7" x1="297" y1="270" x2="1" y2="270"/>
+    <path class="cls-12" d="M276.89,270c8.28,0,14.99-6.72,15-15,0-.55-.45-1-1-1H7.11c-.55,0-1,.45-1,1,0,8.28,6.72,14.99,15,15h255.77Z"/>
+    <path class="cls-13" d="M290.89,255H7.11c0,7.73,6.27,14,14,14h255.77c7.73,0,14-6.27,14-14m2,0c-.01,8.83-7.17,15.99-16,16H21.11c-8.83-.01-15.99-7.17-16-16,0-1.1,.9-2,2-2H290.89c1.1,0,2,.9,2,2Zm-2,2h0Z"/>
+    <path class="cls-13" d="M172,254.61c0,2.43-1.97,4.39-4.39,4.39h-36.21c-2.43,0-4.39-1.97-4.39-4.39v-.61h45v.61Z"/>
+    <polygon class="cls-8" points="191.31 191.39 191.31 131.89 131.81 131.89 106.31 157.39 106.31 216.89 165.81 216.89 191.31 191.39"/>
+    <path class="cls-8" d="M161.56,195.64h-12.75c-11.74,0-21.25-9.51-21.25-21.25s9.51-21.25,21.25-21.25h12.75"/>
+    <path class="cls-14" d="M209.37,134.96c0-9.8-7.91-17.77-17.71-17.84-9.85-.07-17.9,7.85-17.97,17.71-.07,9.85,7.85,17.9,17.71,17.97,9.89,.03,17.93-7.96,17.97-17.84Z"/>
+    <path class="cls-14" d="M191.39,118.62c-9.06-.04-16.44,7.28-16.47,16.34,0,8.97,7.24,16.27,16.21,16.34,9.02,.07,16.4-7.18,16.47-16.21,.07-9.02-7.18-16.4-16.21-16.47m19.47,16.34c0,10.63-8.58,19.27-19.21,19.34-10.68,.07-19.4-8.53-19.47-19.21-.07-10.68,8.53-19.4,19.21-19.47,10.71-.02,19.42,8.63,19.47,19.34Z"/>
+    <ellipse class="cls-9" cx="191.39" cy="134.96" rx="16.47" ry="16.34"/>
+    <path class="cls-9" d="M191.39,118.62c-2.84,2.76-4.62,6.68-5.55,11.18-.69,3.41-.69,6.91,0,10.32,.93,4.5,2.71,8.42,5.55,11.18"/>
+    <path class="cls-9" d="M191.39,151.3c2.84-3.16,4.76-7.02,5.58-11.18,.65-3.41,.65-6.91,0-10.32-.82-4.16-2.75-8.02-5.58-11.18"/>
+    <line class="cls-1" x1="207" y1="140.12" x2="175.79" y2="140.12"/>
+    <line class="cls-1" x1="207" y1="129.8" x2="175.79" y2="129.8"/>
+  </g>
+</svg>

File diff suppressed because it is too large
+ 6 - 0
resources/themes/cura-light/images/cura_connected_printers.svg


File diff suppressed because it is too large
+ 0 - 0
resources/themes/cura-light/images/illustration_connect_printers.svg


Some files were not shown because too many files changed in this diff