mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Move cloud connection check logic to Python
This commit is contained in:
parent
5e9fe3fe50
commit
1b356a3219
2 changed files with 10 additions and 1 deletions
|
@ -530,6 +530,15 @@ class MachineManager(QObject):
|
||||||
return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
|
return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
|
||||||
return False
|
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:
|
def activeMachineNetworkKey(self) -> str:
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
return self._global_container_stack.getMetaDataEntry("um_network_key", "")
|
return self._global_container_stack.getMetaDataEntry("um_network_key", "")
|
||||||
|
|
|
@ -13,7 +13,7 @@ Cura.ExpandablePopup
|
||||||
|
|
||||||
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection
|
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
|
property bool isPrinterConnected: Cura.MachineManager.printerConnected
|
||||||
|
|
||||||
contentPadding: UM.Theme.getSize("default_lining").width
|
contentPadding: UM.Theme.getSize("default_lining").width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue