Only disconnect old stack if we found a new one

CURA-2361
This commit is contained in:
Jaime van Kessel 2016-09-21 11:25:57 +02:00
parent c6cae8a6eb
commit eb1d5e13d0

View file

@ -49,15 +49,14 @@ class SettingInheritanceManager(QObject):
self._update() self._update()
def _onActiveExtruderChanged(self): def _onActiveExtruderChanged(self):
if self._active_container_stack:
self._active_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
new_active_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack() new_active_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack()
if not new_active_stack: if not new_active_stack:
new_active_stack = self._global_container_stack new_active_stack = self._global_container_stack
if new_active_stack != self._active_container_stack: if new_active_stack != self._active_container_stack: # Check if changed
# Check if changed if self._active_container_stack: # Disconnect signal from old container (if any)
self._active_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
self._active_container_stack = new_active_stack self._active_container_stack = new_active_stack
self._active_container_stack.propertyChanged.connect(self._onPropertyChanged) self._active_container_stack.propertyChanged.connect(self._onPropertyChanged)
self._update() # Ensure that the settings_with_inheritance_warning list is populated. self._update() # Ensure that the settings_with_inheritance_warning list is populated.