Remove deprecated MachineManager.activeMachineHasRemoteConnection

CURA-6858
This commit is contained in:
Lipu Fei 2019-10-22 14:09:43 +02:00
parent 38ee4bf208
commit 1f3a7c976f
3 changed files with 15 additions and 13 deletions

View file

@ -20,6 +20,7 @@ from UM.Platform import Platform
from UM.Util import parseBool from UM.Util import parseBool
import cura.CuraApplication import cura.CuraApplication
from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from . import Exceptions from . import Exceptions
from .CuraContainerStack import CuraContainerStack from .CuraContainerStack import CuraContainerStack
@ -108,6 +109,19 @@ class GlobalStack(CuraContainerStack):
pass pass
return result 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 ## \sa configuredConnectionTypes
def addConfiguredConnectionType(self, connection_type: int) -> None: def addConfiguredConnectionType(self, connection_type: int) -> None:
configured_connection_types = self.configuredConnectionTypes configured_connection_types = self.configuredConnectionTypes

View file

@ -463,18 +463,6 @@ class MachineManager(QObject):
def printerConnected(self) -> bool: def printerConnected(self) -> bool:
return bool(self._printer_output_devices) 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) @pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineIsGroup(self) -> bool: def activeMachineIsGroup(self) -> bool:
return bool(self._printer_output_devices) and len(self._printer_output_devices[0].printers) > 1 return bool(self._printer_output_devices) and len(self._printer_output_devices[0].printers) > 1

View file

@ -140,7 +140,7 @@ Cura.ExpandablePopup
onVisibleChanged: 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 // 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 // or the previous state is selected