Move cloud connection check logic to Python

This commit is contained in:
ChrisTerBeke 2018-12-19 11:41:22 +01:00
parent 5e9fe3fe50
commit 1b356a3219
2 changed files with 10 additions and 1 deletions

View file

@ -530,6 +530,15 @@ class MachineManager(QObject):
return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
return False
@pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineHasCloudConnection(self) -> bool:
if not self.activeMachineHasRemoteConnection:
return False
output_device = next(iter(self.printerOutputDevices), None) # type: PrinterOutputDevice
if not output_device:
return False
return output_device.connectionType == ConnectionType.CloudConnection
def activeMachineNetworkKey(self) -> str:
if self._global_container_stack:
return self._global_container_stack.getMetaDataEntry("um_network_key", "")

View file

@ -13,7 +13,7 @@ Cura.ExpandablePopup
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 isCloudPrinter: Cura.MachineManager.activeMachineHasCloudConnection
property bool isPrinterConnected: Cura.MachineManager.printerConnected
contentPadding: UM.Theme.getSize("default_lining").width