Fix review comments

CURA-6011
This commit is contained in:
Jaime van Kessel 2018-12-18 09:40:08 +01:00
parent aad7540366
commit 84a7f2e5a2
5 changed files with 10 additions and 10 deletions

View file

@ -54,7 +54,7 @@ class PrintersModel(ListModel):
for container_stack in container_stacks:
connection_type = container_stack.getMetaDataEntry("connection_type")
has_remote_connection = connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)]
has_remote_connection = connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
if container_stack.getMetaDataEntry("hidden", False) in ["True", True]:
continue

View file

@ -525,7 +525,7 @@ class MachineManager(QObject):
def activeMachineHasRemoteConnection(self) -> bool:
if self._global_container_stack:
connection_type = self._global_container_stack.getMetaDataEntry("connection_type")
return connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)]
return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
return False
def activeMachineNetworkKey(self) -> str:

View file

@ -136,13 +136,13 @@ class DiscoverUM3Action(MachineAction):
global_container_stack.removeMetaDataEntry("network_authentication_key")
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_network_key", value = previous_network_key, new_value = printer_device.key)
if "um_connection_type" in meta_data:
previous_connection_type = meta_data["um_connection_type"]
global_container_stack.setMetaDataEntry("um_connection_type", printer_device.getConnectionType().value)
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_connection_type", value = previous_connection_type, new_value = printer_device.getConnectionType().value)
if "connection_type" in meta_data:
previous_connection_type = meta_data["connection_type"]
global_container_stack.setMetaDataEntry("connection_type", printer_device.getConnectionType().value)
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "connection_type", value = previous_connection_type, new_value = printer_device.getConnectionType().value)
else:
global_container_stack.setMetaDataEntry("um_network_key", printer_device.key)
global_container_stack.setMetaDataEntry("um_connection_type", printer_device.getConnectionType().value)
global_container_stack.setMetaDataEntry("connection_type", printer_device.getConnectionType().value)
if self._network_plugin:
# Ensure that the connection states are refreshed.

View file

@ -283,7 +283,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
global_container_stack = Application.getInstance().getGlobalContainerStack()
if global_container_stack and device.getId() == global_container_stack.getMetaDataEntry("um_network_key"):
global_container_stack.setMetaDataEntry("connection_type", str(device.getConnectionType()))
global_container_stack.setMetaDataEntry("connection_type", device.getConnectionType().value)
device.connect()
device.connectionStateChanged.connect(self._onDeviceConnectionStateChanged)