mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-20 09:39:09 +08:00
Optimise getting intent categories
It's in the container tree, so there's no need for separate queries to the container registry. Contributes to issue CURA-6600.
This commit is contained in:
parent
3712f9c1f8
commit
fc679758ef
@ -37,12 +37,16 @@ class IntentManager(QObject):
|
|||||||
#
|
#
|
||||||
# \param definition_id ID of the printer.
|
# \param definition_id ID of the printer.
|
||||||
# \param nozzle_name Name of the nozzle.
|
# \param nozzle_name Name of the nozzle.
|
||||||
# \param material_id ID of the material.
|
# \param material_base_file The base_file of the material.
|
||||||
# \return A list of metadata dictionaries matching the search criteria, or
|
# \return A list of metadata dictionaries matching the search criteria, or
|
||||||
# an empty list if nothing was found.
|
# an empty list if nothing was found.
|
||||||
def intentMetadatas(self, definition_id: str, nozzle_name: str, material_base_file: str) -> List[Dict[str, Any]]:
|
def intentMetadatas(self, definition_id: str, nozzle_name: str, material_base_file: str) -> List[Dict[str, Any]]:
|
||||||
registry = cura.CuraApplication.CuraApplication.getInstance().getContainerRegistry()
|
material_node = ContainerTree.getInstance().machines[definition_id].variants[nozzle_name].materials[material_base_file]
|
||||||
return registry.findContainersMetadata(type = "intent", definition = definition_id, variant = nozzle_name, material = material_base_file)
|
intent_metadatas = []
|
||||||
|
for quality_node in material_node.qualities.values():
|
||||||
|
for intent_node in quality_node.intents.values():
|
||||||
|
intent_metadatas.append(intent_node.getMetadata())
|
||||||
|
return intent_metadatas
|
||||||
|
|
||||||
## Collects and returns all intent categories available for the given
|
## Collects and returns all intent categories available for the given
|
||||||
# parameters. Note that the 'default' category is always available.
|
# parameters. Note that the 'default' category is always available.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user