Prevent abstract machines from being deleted in the config menu

CURA-9277
This commit is contained in:
c.lamboo 2022-09-02 15:48:22 +02:00
parent 8bb2671a28
commit 27fc11b840
2 changed files with 4 additions and 3 deletions

View File

@ -172,6 +172,7 @@ class GlobalStacksModel(ListModel):
"metadata": container_stack.getMetaData().copy(),
"discoverySource": section_name,
"removalWarning": removal_warning,
"isOnline": is_online})
"isOnline": is_online,
"isAbstractMachine": is_abstract_machine})
items.sort(key=lambda i: (not i["hasRemoteConnection"], i["name"]))
self.setItems(items)

View File

@ -17,7 +17,7 @@ UM.ManagementPage
title: catalog.i18nc("@title:tab", "Printers")
detailsPlaneCaption: base.currentItem && base.currentItem.name ? base.currentItem.name : ""
model: Cura.GlobalStacksModel { filterAbstractMachines: false }
model: Cura.GlobalStacksModel { }
sectionRole: "discoverySource"
@ -139,7 +139,7 @@ UM.ManagementPage
Cura.MenuItem
{
text: catalog.i18nc("@action:button", "Remove")
enabled: base.currentItem != null && model.count > 1
enabled: base.currentItem != null && model.count > 1 && !base.currentItem.isAbstractMachine
onTriggered: confirmDialog.open()
}
Cura.MenuItem