From 27fc11b8404ed84a9b95b2fdddab239d2cd3c93b Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 2 Sep 2022 15:48:22 +0200 Subject: [PATCH] Prevent abstract machines from being deleted in the config menu CURA-9277 --- cura/Machines/Models/GlobalStacksModel.py | 3 ++- resources/qml/Preferences/MachinesPage.qml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/Machines/Models/GlobalStacksModel.py b/cura/Machines/Models/GlobalStacksModel.py index 69f2ec3822..62b470daee 100644 --- a/cura/Machines/Models/GlobalStacksModel.py +++ b/cura/Machines/Models/GlobalStacksModel.py @@ -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) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 258b45292e..16f144cf85 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -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