Notify user of proper way to remove cloud printer

CURA-7436
This commit is contained in:
Nino van Hooff 2020-05-18 14:44:35 +02:00
parent 9344bb8494
commit 3d19e75c82
2 changed files with 9 additions and 0 deletions

View file

@ -19,6 +19,7 @@ class GlobalStacksModel(ListModel):
ConnectionTypeRole = Qt.UserRole + 4
MetaDataRole = Qt.UserRole + 5
DiscoverySourceRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page
HasCloudConnectionRole = Qt.UserRole + 7
def __init__(self, parent = None) -> None:
super().__init__(parent)
@ -57,10 +58,12 @@ class GlobalStacksModel(ListModel):
container_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine")
for container_stack in container_stacks:
has_remote_connection = False
has_cloud_connection = False
for connection_type in container_stack.configuredConnectionTypes:
has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value,
ConnectionType.CloudConnection.value]
has_cloud_connection |= connection_type == ConnectionType.CloudConnection.value
if parseBool(container_stack.getMetaDataEntry("hidden", False)):
continue
@ -71,6 +74,7 @@ class GlobalStacksModel(ListModel):
items.append({"name": container_stack.getMetaDataEntry("group_name", container_stack.getName()),
"id": container_stack.getId(),
"hasRemoteConnection": has_remote_connection,
"hasCloudConnection": has_cloud_connection,
"metadata": container_stack.getMetaData().copy(),
"discoverySource": section_name})
items.sort(key = lambda i: (not i["hasRemoteConnection"], i["name"]))