Activate another machine when we remove the currently active MachineManagerModel

CURA-1278
This commit is contained in:
fieldOfView 2016-05-27 11:53:53 +02:00
parent 64a613f407
commit 6355631842

View file

@ -266,6 +266,11 @@ class MachineManagerModel(QObject):
@pyqtSlot(str) @pyqtSlot(str)
def removeMachine(self, machine_id): 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])
UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id) UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id)
@pyqtProperty(bool, notify = globalContainerChanged) @pyqtProperty(bool, notify = globalContainerChanged)