Use findContainersMetadata whenever possible

This ensures that we only load those containers that we actually need the data of.

Contributes to issue CURA-4243.
This commit is contained in:
Ghostkeeper 2017-10-20 15:09:45 +02:00
parent f7e048aee5
commit 6c4c7fff4d
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
14 changed files with 126 additions and 138 deletions

View file

@ -463,9 +463,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
result.append(i18n_catalog.i18nc("@item:material", "No material loaded"))
continue
containers = self._container_registry.findInstanceContainers(type = "material", GUID = material_id)
containers = self._container_registry.findInstanceContainersMetadata(type = "material", GUID = material_id)
if containers:
result.append(containers[0].getName())
result.append(containers[0]["name"])
else:
result.append(i18n_catalog.i18nc("@item:material", "Unknown material"))
return result
@ -485,9 +485,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
result.append("#00000000") #No material.
continue
containers = self._container_registry.findInstanceContainers(type = "material", GUID = material_id)
containers = self._container_registry.findInstanceContainersMetadata(type = "material", GUID = material_id)
if containers:
result.append(containers[0].getMetaDataEntry("color_code"))
result.append(containers[0]["color_code"])
else:
result.append("#00000000") #Unknown material.
return result