Expose an extruderValues() function to value functions

It returns a list of values for all extruders so that things like max()
work.

Contributes to CURA-2009
This commit is contained in:
Arjen Hiemstra 2016-08-02 19:33:59 +02:00
parent f568014e67
commit b102a6cedd
2 changed files with 24 additions and 1 deletions

View file

@ -273,3 +273,25 @@ class ExtruderManager(QObject):
global_stack = UM.Application.getInstance().getGlobalContainerStack()
if global_stack and global_stack.getBottom():
self.addMachineExtruders(global_stack.getBottom(), global_stack.getId())
@staticmethod
def getExtruderValues(name):
global_stack = UM.Application.getInstance().getGlobalContainerStack()
result = []
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
value = extruder.getRawProperty(name, "value", use_next = False)
if not value:
continue
if isinstance(value, UM.Settings.SettingFunction):
value = value(extruder)
result.append(value)
if not result:
result.append(global_stack.getProperty(name, "value"))
return result