mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Remove container stack and user profile for extruders when removing a printer
CURA-1896
This commit is contained in:
parent
a7cfe1b5af
commit
ae4beeb0ed
@ -221,7 +221,18 @@ class ExtruderManager(QObject):
|
|||||||
|
|
||||||
container_registry.addContainer(container_stack)
|
container_registry.addContainer(container_stack)
|
||||||
|
|
||||||
## Generates extruders for a specific machine.
|
## Removes the container stack and user profile for the extruders for a specific machine.
|
||||||
|
#
|
||||||
|
# \param machine_id The machine to remove the extruders for.
|
||||||
|
def removeMachineExtruders(self, machine_id):
|
||||||
|
for extruder in self.getMachineExtruders(machine_id):
|
||||||
|
current_settings_id = extruder.getId() + "_current_settings"
|
||||||
|
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = current_settings_id)
|
||||||
|
for container in containers:
|
||||||
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId())
|
||||||
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(extruder.getId())
|
||||||
|
|
||||||
|
## Returns extruders for a specific machine.
|
||||||
#
|
#
|
||||||
# \param machine_id The machine to get the extruders of.
|
# \param machine_id The machine to get the extruders of.
|
||||||
def getMachineExtruders(self, machine_id):
|
def getMachineExtruders(self, machine_id):
|
||||||
|
@ -635,6 +635,11 @@ class MachineManager(QObject):
|
|||||||
# If the machine that is being removed is the currently active machine, set another machine as the active machine.
|
# If the machine that is being removed is the currently active machine, set another machine as the active machine.
|
||||||
activate_new_machine = (self._global_container_stack and self._global_container_stack.getId() == machine_id)
|
activate_new_machine = (self._global_container_stack and self._global_container_stack.getId() == machine_id)
|
||||||
|
|
||||||
|
stacks = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||||
|
if not stacks:
|
||||||
|
return
|
||||||
|
ExtruderManager.getInstance().removeMachineExtruders(stacks[0].getBottom().getId())
|
||||||
|
|
||||||
current_settings_id = machine_id + "_current_settings"
|
current_settings_id = machine_id + "_current_settings"
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = current_settings_id)
|
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = current_settings_id)
|
||||||
for container in containers:
|
for container in containers:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user