mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 21:58:01 -06:00
Expose a list of all active materials in MachineManager
Contributes to CURA-2006
This commit is contained in:
parent
6de7d0170a
commit
578191bb8a
1 changed files with 26 additions and 0 deletions
|
@ -395,6 +395,32 @@ class MachineManager(QObject):
|
|||
|
||||
return ""
|
||||
|
||||
@pyqtProperty("QVariantMap", notify = activeMaterialChanged)
|
||||
def allActiveMaterialIds(self):
|
||||
if not self._global_container_stack:
|
||||
return {}
|
||||
|
||||
result = {}
|
||||
|
||||
stacks = [ s for s in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()) ]
|
||||
stacks.insert(0, self._global_container_stack)
|
||||
|
||||
for stack in stacks:
|
||||
material_container = stack.findContainer(type = "material")
|
||||
if not material_container:
|
||||
continue
|
||||
|
||||
key = ""
|
||||
if stack == self._global_container_stack:
|
||||
key = "global"
|
||||
else:
|
||||
key = stack.getId()
|
||||
|
||||
result[key] = material_container.getId()
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@pyqtProperty(str, notify=activeQualityChanged)
|
||||
def activeQualityName(self):
|
||||
if self._active_container_stack:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue