diff --git a/cura/Machines/Models/GlobalStacksModel.py b/cura/Machines/Models/GlobalStacksModel.py index 9db4ffe6db..38b92c00c9 100644 --- a/cura/Machines/Models/GlobalStacksModel.py +++ b/cura/Machines/Models/GlobalStacksModel.py @@ -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"])) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index a3a8ec0e29..afd9ba264e 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -136,6 +136,11 @@ UM.ManagementPage { id: confirmDialog object: base.currentItem && base.currentItem.name ? base.currentItem.name : "" + text: base.currentItem && base.currentItem.hasCloudConnection? + catalog.i18nc("@label (%1 is object name)", "%1 will be removed but will be added again in the next sync. To remove the printer permanently, visit Ultimaker Digital Factory").arg(base.currentItem.name) + : + catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItem.name) + ; onYes: { Cura.MachineManager.removeMachine(base.currentItem.id)