diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 17daaf205a..e020467a54 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -20,6 +20,7 @@ from UM.Platform import Platform from UM.Util import parseBool import cura.CuraApplication +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from . import Exceptions from .CuraContainerStack import CuraContainerStack @@ -108,6 +109,19 @@ class GlobalStack(CuraContainerStack): pass return result + # Returns a boolean indicating if this machine has a remote connection. A machine is considered as remotely + # connected if its connection types contain one of the following values: + # - ConnectionType.NetworkConnection + # - ConnectionType.CloudConnection + @pyqtProperty(bool, notify = configuredConnectionTypesChanged) + def hasRemoteConnection(self) -> bool: + has_remote_connection = False + + for connection_type in self.configuredConnectionTypes: + has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, + ConnectionType.CloudConnection.value] + return has_remote_connection + ## \sa configuredConnectionTypes def addConfiguredConnectionType(self, connection_type: int) -> None: configured_connection_types = self.configuredConnectionTypes diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 024ed3379d..396dd2f32f 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -463,18 +463,6 @@ class MachineManager(QObject): def printerConnected(self) -> bool: return bool(self._printer_output_devices) - @pyqtProperty(bool, notify = printerConnectedStatusChanged) - @deprecated("use Cura.MachineManager.activeMachine.configuredConnectionTypes instead", "4.2") - def activeMachineHasRemoteConnection(self) -> bool: - if self._global_container_stack: - has_remote_connection = False - - for connection_type in self._global_container_stack.configuredConnectionTypes: - has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, - ConnectionType.CloudConnection.value] - return has_remote_connection - return False - @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineIsGroup(self) -> bool: return bool(self._printer_output_devices) and len(self._printer_output_devices[0].printers) > 1 diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 9e4a0b81e4..f0ada92810 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -140,7 +140,7 @@ Cura.ExpandablePopup onVisibleChanged: { - is_connected = Cura.MachineManager.activeMachineHasRemoteConnection && Cura.MachineManager.printerConnected && Cura.MachineManager.printerOutputDevices[0].uniqueConfigurations.length > 0 //Re-evaluate. + is_connected = Cura.MachineManager.activeMachine.hasRemoteConnection && Cura.MachineManager.printerConnected && Cura.MachineManager.printerOutputDevices[0].uniqueConfigurations.length > 0 //Re-evaluate. // If the printer is not connected or does not have configurations, we switch always to the custom mode. If is connected instead, the auto mode // or the previous state is selected