Replace quality(changes) in machine manager now uses new API as well

CURA-3497
This commit is contained in:
Jaime van Kessel 2017-05-03 10:38:31 +02:00
parent a028297cb2
commit ab6240bd31

View file

@ -906,18 +906,15 @@ class MachineManager(QObject):
def _replaceQualityOrQualityChangesInStack(self, stack, container, postpone_emit = False): def _replaceQualityOrQualityChangesInStack(self, stack, container, postpone_emit = False):
# Disconnect the signal handling from the old container. # Disconnect the signal handling from the old container.
old_container = stack.findContainer(type=container.getMetaDataEntry("type")) container_type = container.getMetaDataEntry("type")
if old_container: if container_type == "quality":
old_container.nameChanged.disconnect(self._onQualityNameChanged) stack.quality.nameChanged.disconnect(self._onQualityNameChanged)
else: stack.setQuality(container)
Logger.log("e", "Could not find container of type %s in stack %s while replacing quality (changes) with container %s", container.getMetaDataEntry("type"), stack.getId(), container.getId()) stack.qualityChanges.nameChanged.disconnect(self._onQualityNameChanged)
return elif container_type == "quality_changes":
stack.qualityChanges.nameChanged.disconnect(self._onQualityNameChanged)
# Swap in the new container into the stack. stack.setQualityChanges(container)
stack.replaceContainer(stack.getContainerIndex(old_container), container, postpone_emit = postpone_emit) stack.qualityChanges.nameChanged.disconnect(self._onQualityNameChanged)
# Attach the needed signal handling.
container.nameChanged.connect(self._onQualityNameChanged)
def _askUserToKeepOrClearCurrentSettings(self): def _askUserToKeepOrClearCurrentSettings(self):
Application.getInstance().discardOrKeepProfileChanges() Application.getInstance().discardOrKeepProfileChanges()