From f2c8d8756e5a309c67e38bb5f16094c9402cd207 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Mar 2018 09:41:14 +0200 Subject: [PATCH] Don't emit changed signals if the global stack ID doesn't exist Because nothing will change then. This is equivalent to putting the call to self.__emitChangedSignals() in the if-statement. But I switched the condition of the if-statement around because it looks more like error handling to me. This is the main case. Contributes to issue CURA-5045. --- cura/Settings/MachineManager.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1b493bf7de..1cda7711d3 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -326,14 +326,16 @@ class MachineManager(QObject): container_registry = ContainerRegistry.getInstance() containers = container_registry.findContainerStacks(id = stack_id) - if containers: - global_stack = containers[0] - ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder - self._global_container_stack = global_stack - Application.getInstance().setGlobalContainerStack(global_stack) - ExtruderManager.getInstance()._globalContainerStackChanged() - self._initMachineState(containers[0]) - self._onGlobalContainerChanged() + if not containers: + return + + global_stack = containers[0] + ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder + self._global_container_stack = global_stack + Application.getInstance().setGlobalContainerStack(global_stack) + ExtruderManager.getInstance()._globalContainerStackChanged() + self._initMachineState(containers[0]) + self._onGlobalContainerChanged() self.__emitChangedSignals()