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

@ -125,8 +125,12 @@ class ProfilesModel(InstanceContainersModel):
# active machine and material, and later yield the right ones.
tmp_all_quality_items = OrderedDict()
for item in super()._recomputeItems():
profile = container_registry.findContainers(id=item["id"])
quality_type = profile[0].getMetaDataEntry("quality_type") if profile else ""
profiles = container_registry.findContainersMetadata(id = item["id"])
if not profiles or "quality_type" not in profiles[0]:
quality_type = ""
else:
quality_type = profiles[0]["quality_type"]
if quality_type not in tmp_all_quality_items:
tmp_all_quality_items[quality_type] = {"suitable_container": None, "all_containers": []}
@ -155,7 +159,7 @@ class ProfilesModel(InstanceContainersModel):
# Now all the containers are set
for item in containers:
profile = container_registry.findContainers(id=item["id"])
profile = container_registry.findContainers(id = item["id"])
if not profile:
self._setItemLayerHeight(item, "", unit)
item["available"] = False