mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 21:28:58 +08:00
Add iteration over extruder manager
This iteration iterates over the extruders. Contributes to issues CURA-1278 and CURA-351.
This commit is contained in:
parent
8369316236
commit
8a8de95969
@ -24,6 +24,7 @@ class ExtruderManager:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._extruders = [] #Extruders for the current machine.
|
self._extruders = [] #Extruders for the current machine.
|
||||||
self._global_container_stack = None
|
self._global_container_stack = None
|
||||||
|
self._next_item = 0 #For when you use this class as iterator.
|
||||||
|
|
||||||
UM.Application.getInstance().globalContainerStackChanged.connect(self._reconnectExtruderReload) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
UM.Application.getInstance().globalContainerStackChanged.connect(self._reconnectExtruderReload) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
||||||
|
|
||||||
@ -37,6 +38,12 @@ class ExtruderManager:
|
|||||||
cls.__instance = ExtruderManager()
|
cls.__instance = ExtruderManager()
|
||||||
return cls.__instance
|
return cls.__instance
|
||||||
|
|
||||||
|
## Creates an iterator over the extruders in this manager.
|
||||||
|
#
|
||||||
|
# \return An iterator over the extruders in this manager.
|
||||||
|
def __iter__(self):
|
||||||
|
return iter(self._extruders)
|
||||||
|
|
||||||
## When the global container stack changes, this reconnects to the new
|
## When the global container stack changes, this reconnects to the new
|
||||||
# signal for containers changing.
|
# signal for containers changing.
|
||||||
def _reconnectExtruderReload(self):
|
def _reconnectExtruderReload(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user