ChrisTerBeke 6 лет назад
Родитель
Сommit
0588c54035

+ 6 - 1
cura/PrinterOutputDevice.py

@@ -56,6 +56,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
 
     # Put ConnectionType here with Q_ENUMS() so it can be registered as a QML type and accessible via QML, and there is
     # no need to remember what those Enum integer values mean.
+    ConnectionType = ConnectionType
     Q_ENUMS(ConnectionType)
 
     printersChanged = pyqtSignal()
@@ -133,7 +134,11 @@ class PrinterOutputDevice(QObject, OutputDevice):
     def getConnectionType(self) -> "ConnectionType":
         return self._connection_type
 
-    @pyqtProperty(str, notify = connectionStateChanged)
+    @pyqtProperty(int, constant = True)
+    def connectionType(self) -> "ConnectionType":
+        return self._connection_type
+
+    @pyqtProperty(int, notify = connectionStateChanged)
     def connectionState(self) -> "ConnectionState":
         return self._connection_state
 

+ 3 - 1
plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py

@@ -17,6 +17,7 @@ from UM.Scene.SceneNode import SceneNode
 from cura.CuraApplication import CuraApplication
 from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice
 from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
+from cura.PrinterOutputDevice import ConnectionType
 from plugins.UM3NetworkPrinting.src.Cloud.CloudOutputController import CloudOutputController
 from ..MeshFormatHandler import MeshFormatHandler
 from ..UM3PrintJobOutputModel import UM3PrintJobOutputModel
@@ -86,7 +87,8 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
     #  \param cluster: The device response received from the cloud API.
     #  \param parent: The optional parent of this output device.
     def __init__(self, api_client: CloudApiClient, cluster: CloudClusterResponse, parent: QObject = None) -> None:
-        super().__init__(device_id = cluster.cluster_id, address = "", properties = {}, parent = parent)
+        super().__init__(device_id = cluster.cluster_id, address = "",
+                         connection_type = ConnectionType.CloudConnection, properties = {}, parent = parent)
         self._api = api_client
         self._cluster = cluster
 

+ 3 - 2
resources/qml/PrinterSelector/MachineSelector.qml

@@ -11,9 +11,10 @@ Cura.ExpandablePopup
 {
     id: machineSelector
 
+    property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
     property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection
+    property bool isCloudPrinter: machineSelector.outputDevice.connectionType == Cura.PrinterOutputDevice.CloudConnection
     property bool isPrinterConnected: Cura.MachineManager.printerConnected
-    property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
 
     contentPadding: UM.Theme.getSize("default_lining").width
     contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
@@ -52,7 +53,7 @@ Cura.ExpandablePopup
                 leftMargin: UM.Theme.getSize("thick_margin").width
             }
 
-            source: UM.Theme.getIcon("printer_connected")
+            source: machineSelector.isCloudPrinter ? UM.Theme.getIcon("printer_connected") : UM.Theme.getIcon("printer_connected")
             width: UM.Theme.getSize("printer_status_icon").width
             height: UM.Theme.getSize("printer_status_icon").height
 

+ 10 - 0
resources/themes/cura-light/icons/printer_cloud_connected.svg

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg">
+    <!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch -->
+    <title>Artboard Copy 2</title>
+    <desc>Created with Sketch.</desc>
+    <g id="Artboard-Copy-2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <circle id="Oval-Copy" stroke="#FFFFFF" fill="#3282FF" cx="7" cy="7" r="6.5"></circle>
+        <path d="M9.8,6.08333333 C9.72,5.375 9.12,4.83333333 8.4,4.83333333 C8.2,4.83333333 8.04,4.875 7.88,4.95833333 C7.52,4.375 6.88,4 6.2,4 C5.08,4 4.2,4.91666667 4.2,6.08333333 C4.2,6.08333333 4.2,6.08333333 4.2,6.125 C3.52,6.20833333 3,6.83333333 3,7.54166667 C3,8.33333333 3.64,9 4.4,9 C5,9 8.88,9 9.6,9 C10.36,9 11,8.33333333 11,7.54166667 C11,6.79166667 10.48,6.20833333 9.8,6.08333333 Z" id="Path" fill="#FFFFFF"></path>
+    </g>
+</svg>