Only load metadata of machines for derived profiles

We only need the metadata of these machines (now that the ID is in the metadata). We won't need all of those machines because some of them are not added.

Contributes to issue CURA-4243.
This commit is contained in:
Ghostkeeper 2017-11-27 10:55:51 +01:00
parent 9571181178
commit a2b0c4535c
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -545,14 +545,14 @@ class XmlMaterialProfile(InstanceContainer):
# Lets try again with some naive heuristics. # Lets try again with some naive heuristics.
machine_id = identifier.get("product").replace(" ", "").lower() machine_id = identifier.get("product").replace(" ", "").lower()
definitions = ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id) definitions = ContainerRegistry.getInstance().findDefinitionContainersMetadata(id = machine_id)
if not definitions: if not definitions:
Logger.log("w", "No definition found for machine ID %s", machine_id) Logger.log("w", "No definition found for machine ID %s", machine_id)
continue continue
definition = definitions[0] definition = definitions[0]
machine_manufacturer = identifier.get("manufacturer", definition.getMetaDataEntry("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition. machine_manufacturer = identifier.get("manufacturer", definition.get("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition.
if machine_compatibility: if machine_compatibility:
new_material_id = self.getId() + "_" + machine_id new_material_id = self.getId() + "_" + machine_id
@ -593,7 +593,7 @@ class XmlMaterialProfile(InstanceContainer):
variant_containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(id = hotend_id) variant_containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(id = hotend_id)
if not variant_containers: if not variant_containers:
# It is not really properly defined what "ID" is so also search for variants by name. # It is not really properly defined what "ID" is so also search for variants by name.
variant_containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(definition = definition.getId(), name = hotend_id) variant_containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(definition = definition["id"], name = hotend_id)
if not variant_containers: if not variant_containers:
continue continue