Add iteration over extruder manager

This iteration iterates over the extruders.

Contributes to issues CURA-1278 and CURA-351.
This commit is contained in:
Ghostkeeper 2016-06-02 13:11:02 +02:00
parent 8369316236
commit 8a8de95969
No known key found for this signature in database
GPG key ID: 701948C5954A7385

View file

@ -24,6 +24,7 @@ class ExtruderManager:
def __init__(self):
self._extruders = [] #Extruders for the current machine.
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.
@ -37,6 +38,12 @@ class ExtruderManager:
cls.__instance = ExtruderManager()
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
# signal for containers changing.
def _reconnectExtruderReload(self):