getActiveExtruderStack now returns stack based on machine_id instead of definiton ID

Contributes to CURA-1898
This commit is contained in:
Jaime van Kessel 2016-07-13 13:08:14 +02:00
parent b33c2f9c25
commit dfd56d049f
2 changed files with 5 additions and 8 deletions

View file

@ -74,11 +74,9 @@ class ExtruderManager(QObject):
def getActiveExtruderStack(self): def getActiveExtruderStack(self):
global_container_stack = UM.Application.getInstance().getGlobalContainerStack() global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
if global_container_stack: if global_container_stack:
global_definition_container = UM.Application.getInstance().getGlobalContainerStack().getBottom() if global_container_stack.getId() in self._extruder_trains:
if global_definition_container: if str(self._active_extruder_index) in self._extruder_trains[global_container_stack.getId()]:
if global_definition_container.getId() in self._extruder_trains: return self._extruder_trains[global_container_stack.getId()][str(self._active_extruder_index)]
if str(self._active_extruder_index) in self._extruder_trains[global_definition_container.getId()]:
return self._extruder_trains[global_definition_container.getId()][str(self._active_extruder_index)]
return None return None
## Adds all extruders of a specific machine definition to the extruder ## Adds all extruders of a specific machine definition to the extruder

View file

@ -239,7 +239,6 @@ class MachineManager(QObject):
if self._active_container_stack and self._active_container_stack != self._global_container_stack: if self._active_container_stack and self._active_container_stack != self._global_container_stack:
self._active_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged) self._active_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged)
self._active_container_stack.propertyChanged.disconnect(self._onGlobalPropertyChanged) self._active_container_stack.propertyChanged.disconnect(self._onGlobalPropertyChanged)
self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack() self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack()
if self._active_container_stack: if self._active_container_stack:
self._active_container_stack.containersChanged.connect(self._onInstanceContainersChanged) self._active_container_stack.containersChanged.connect(self._onInstanceContainersChanged)