mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 03:37:48 -06:00
Notify user of proper way to remove cloud printer
CURA-7436
This commit is contained in:
parent
9344bb8494
commit
3d19e75c82
2 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,7 @@ class GlobalStacksModel(ListModel):
|
||||||
ConnectionTypeRole = Qt.UserRole + 4
|
ConnectionTypeRole = Qt.UserRole + 4
|
||||||
MetaDataRole = Qt.UserRole + 5
|
MetaDataRole = Qt.UserRole + 5
|
||||||
DiscoverySourceRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page
|
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:
|
def __init__(self, parent = None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -57,10 +58,12 @@ class GlobalStacksModel(ListModel):
|
||||||
container_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine")
|
container_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine")
|
||||||
for container_stack in container_stacks:
|
for container_stack in container_stacks:
|
||||||
has_remote_connection = False
|
has_remote_connection = False
|
||||||
|
has_cloud_connection = False
|
||||||
|
|
||||||
for connection_type in container_stack.configuredConnectionTypes:
|
for connection_type in container_stack.configuredConnectionTypes:
|
||||||
has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value,
|
has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value,
|
||||||
ConnectionType.CloudConnection.value]
|
ConnectionType.CloudConnection.value]
|
||||||
|
has_cloud_connection |= connection_type == ConnectionType.CloudConnection.value
|
||||||
|
|
||||||
if parseBool(container_stack.getMetaDataEntry("hidden", False)):
|
if parseBool(container_stack.getMetaDataEntry("hidden", False)):
|
||||||
continue
|
continue
|
||||||
|
@ -71,6 +74,7 @@ class GlobalStacksModel(ListModel):
|
||||||
items.append({"name": container_stack.getMetaDataEntry("group_name", container_stack.getName()),
|
items.append({"name": container_stack.getMetaDataEntry("group_name", container_stack.getName()),
|
||||||
"id": container_stack.getId(),
|
"id": container_stack.getId(),
|
||||||
"hasRemoteConnection": has_remote_connection,
|
"hasRemoteConnection": has_remote_connection,
|
||||||
|
"hasCloudConnection": has_cloud_connection,
|
||||||
"metadata": container_stack.getMetaData().copy(),
|
"metadata": container_stack.getMetaData().copy(),
|
||||||
"discoverySource": section_name})
|
"discoverySource": section_name})
|
||||||
items.sort(key = lambda i: (not i["hasRemoteConnection"], i["name"]))
|
items.sort(key = lambda i: (not i["hasRemoteConnection"], i["name"]))
|
||||||
|
|
|
@ -136,6 +136,11 @@ UM.ManagementPage
|
||||||
{
|
{
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
object: base.currentItem && base.currentItem.name ? base.currentItem.name : ""
|
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 <a href='https://mycloud.ultimaker.com/'>Ultimaker Digital Factory</a>").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:
|
onYes:
|
||||||
{
|
{
|
||||||
Cura.MachineManager.removeMachine(base.currentItem.id)
|
Cura.MachineManager.removeMachine(base.currentItem.id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue