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.
This commit is contained in:
Ghostkeeper 2018-03-27 09:41:14 +02:00
parent 75e993eb60
commit f2c8d8756e
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -326,14 +326,16 @@ class MachineManager(QObject):
container_registry = ContainerRegistry.getInstance() container_registry = ContainerRegistry.getInstance()
containers = container_registry.findContainerStacks(id = stack_id) containers = container_registry.findContainerStacks(id = stack_id)
if containers: if not containers:
global_stack = containers[0] return
ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder
self._global_container_stack = global_stack global_stack = containers[0]
Application.getInstance().setGlobalContainerStack(global_stack) ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder
ExtruderManager.getInstance()._globalContainerStackChanged() self._global_container_stack = global_stack
self._initMachineState(containers[0]) Application.getInstance().setGlobalContainerStack(global_stack)
self._onGlobalContainerChanged() ExtruderManager.getInstance()._globalContainerStackChanged()
self._initMachineState(containers[0])
self._onGlobalContainerChanged()
self.__emitChangedSignals() self.__emitChangedSignals()