mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 05:35:58 +08:00
Introduce a getActiveGlobalAndExtruderStacks method to ExtruderManager
It can be used to iterate over the active global and extruder stacks Contributes to CURA-2006
This commit is contained in:
parent
c557cd1a7a
commit
6049d6f3a5
@ -277,6 +277,20 @@ class ExtruderManager(QObject):
|
|||||||
for name in self._extruder_trains[machine_id]:
|
for name in self._extruder_trains[machine_id]:
|
||||||
yield self._extruder_trains[machine_id][name]
|
yield self._extruder_trains[machine_id][name]
|
||||||
|
|
||||||
|
## Returns a generator that will iterate over the global stack and per-extruder stacks.
|
||||||
|
#
|
||||||
|
# The first generated element is the global container stack. After that any extruder stacks are generated.
|
||||||
|
def getActiveGlobalAndExtruderStacks(self):
|
||||||
|
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||||
|
if not global_stack:
|
||||||
|
return
|
||||||
|
|
||||||
|
yield global_stack
|
||||||
|
|
||||||
|
global_id = global_stack.getId()
|
||||||
|
for name in self._extruder_trains[global_id]:
|
||||||
|
yield self._extruder_trains[global_id][name]
|
||||||
|
|
||||||
def __globalContainerStackChanged(self):
|
def __globalContainerStackChanged(self):
|
||||||
self._addCurrentMachineExtruders()
|
self._addCurrentMachineExtruders()
|
||||||
self.activeExtruderChanged.emit()
|
self.activeExtruderChanged.emit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user