diff options
Diffstat (limited to 'cura/Settings')
-rwxr-xr-x | cura/Settings/ExtruderManager.py | 10 | ||||
-rwxr-xr-x | cura/Settings/MachineManager.py | 10 |
2 files changed, 15 insertions, 5 deletions
diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index b16a88f1a9..7a6537e7d2 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -41,7 +41,7 @@ class ExtruderManager(QObject): def __init__(self, parent = None): super().__init__(parent) self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders. - self._active_extruder_index = 0 + self._active_extruder_index = -1 self._selected_object_extruders = [] Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged) self._global_container_stack_definition_id = None @@ -78,6 +78,7 @@ class ExtruderManager(QObject): def extruderIds(self): map = {} global_stack_id = Application.getInstance().getGlobalContainerStack().getId() + map["-1"] = global_stack_id if global_stack_id in self._extruder_trains: for position in self._extruder_trains[global_stack_id]: map[position] = self._extruder_trains[global_stack_id][position].getId() @@ -513,11 +514,16 @@ class ExtruderManager(QObject): global_stack = Application.getInstance().getGlobalContainerStack() result = [] + machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value") + + if machine_extruder_count is 1: + return result + if global_stack and global_stack.getId() in self._extruder_trains: for extruder in sorted(self._extruder_trains[global_stack.getId()]): result.append(self._extruder_trains[global_stack.getId()][extruder]) - return result[:global_stack.getProperty("machine_extruder_count", "value")] + return result[:machine_extruder_count] def __globalContainerStackChanged(self) -> None: global_container_stack = Application.getInstance().getGlobalContainerStack() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 69f672ab0f..9ce288e0c0 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -271,7 +271,6 @@ class MachineManager(QObject): extruder_stack.containersChanged.disconnect(self._onInstanceContainersChanged) self._global_container_stack = Application.getInstance().getGlobalContainerStack() - self._active_container_stack = self._global_container_stack self.globalContainerChanged.emit() @@ -303,6 +302,9 @@ class MachineManager(QObject): quality = self._global_container_stack.quality quality.nameChanged.connect(self._onQualityNameChanged) + + self._active_container_stack = self._global_container_stack + self._error_check_timer.start() ## Update self._stacks_valid according to _checkStacksForErrors and emit if change. @@ -547,12 +549,14 @@ class MachineManager(QObject): def allActiveMaterialIds(self) -> Dict[str, str]: result = {} active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks() - if active_stacks is not None: #If we have a global stack. + + result[self._global_container_stack.getId()] = self._global_container_stack.material.getId() + + if active_stacks is not None: # If we have extruder stacks for stack in active_stacks: material_container = stack.material if not material_container: continue - result[stack.getId()] = material_container.getId() return result |