mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
It's no longer possible to remove a material that is in use
CURA-2168
This commit is contained in:
parent
a177b61153
commit
17b34fb4e1
2 changed files with 10 additions and 1 deletions
|
@ -225,6 +225,15 @@ class ContainerManager(QObject):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@pyqtSlot(str, result = bool)
|
||||||
|
def isContainerUsed(self, container_id):
|
||||||
|
UM.Logger.log("d", "Checking if container %s is currently used in the active stacks", container_id)
|
||||||
|
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
|
||||||
|
if container_id in [child.getId() for child in stack.getContainers()]:
|
||||||
|
UM.Logger.log("d", "The container is in use by %s", stack.getId())
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
## Get a list of string that can be used as name filters for a Qt File Dialog
|
## Get a list of string that can be used as name filters for a Qt File Dialog
|
||||||
#
|
#
|
||||||
# This will go through the list of available container types and generate a list of strings
|
# This will go through the list of available container types and generate a list of strings
|
||||||
|
|
|
@ -104,7 +104,7 @@ UM.ManagementPage
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:button", "Remove");
|
text: catalog.i18nc("@action:button", "Remove");
|
||||||
iconName: "list-remove";
|
iconName: "list-remove";
|
||||||
enabled: base.currentItem != null && !base.currentItem.readOnly
|
enabled: base.currentItem != null && !base.currentItem.readOnly && !Cura.ContainerManager.isContainerUsed(base.currentItem.id)
|
||||||
onClicked: confirmDialog.open()
|
onClicked: confirmDialog.open()
|
||||||
},
|
},
|
||||||
Button
|
Button
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue