mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 22:58:58 +08:00
Expose a list of all active materials in MachineManager
Contributes to CURA-2006
This commit is contained in:
parent
6de7d0170a
commit
578191bb8a
@ -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…
x
Reference in New Issue
Block a user