diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index d16242d9c2..44c564d03a 100644 --- a/cura/PrinterOutputDevice.py +++ b/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 diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index fed8cb040a..7e9608dc8b 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/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 diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 28e01c7ae9..3804c04025 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -11,9 +11,10 @@ Cura.ExpandablePopup { id: machineSelector - property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection - property bool isPrinterConnected: Cura.MachineManager.printerConnected 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 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 diff --git a/resources/themes/cura-light/icons/printer_cloud_connected.svg b/resources/themes/cura-light/icons/printer_cloud_connected.svg new file mode 100644 index 0000000000..6b2c814786 --- /dev/null +++ b/resources/themes/cura-light/icons/printer_cloud_connected.svg @@ -0,0 +1,10 @@ + + + + Artboard Copy 2 + Created with Sketch. + + + + + \ No newline at end of file