From ead91db06291dcfa08c2b9ece9275d0a65ba1b95 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 5 Jun 2016 13:54:55 +0200 Subject: [PATCH] Fix activating another container stack when the currently active stack is removed CURA-1632 --- cura/MachineManagerModel.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cura/MachineManagerModel.py b/cura/MachineManagerModel.py index 50098dfa1b..a0af119636 100644 --- a/cura/MachineManagerModel.py +++ b/cura/MachineManagerModel.py @@ -405,11 +405,13 @@ class MachineManagerModel(QObject): @pyqtSlot(str) def removeMachine(self, machine_id): # If the machine that is being removed is the currently active machine, set another machine as the active machine - if self._global_container_stack and self._global_container_stack.getId() == machine_id: - containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks() - if containers: - Application.getInstance().setGlobalContainerStack(containers[0]) + activate_new_machine = (self._global_container_stack and self._global_container_stack.getId() == machine_id) UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id) + if activate_new_machine: + stacks = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(type = "machine") + if stacks: + Application.getInstance().setGlobalContainerStack(stacks[0]) + @pyqtProperty(bool, notify = globalContainerChanged) def hasMaterials(self):