mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
Fix getContainerMetaDataEntry()
CURA-5408
This commit is contained in:
parent
4dcb6c685e
commit
e5a11c1f7b
2 changed files with 7 additions and 7 deletions
|
@ -47,18 +47,18 @@ class ContainerManager(QObject):
|
||||||
self._container_name_filters = {} # type: Dict[str, Dict[str, Any]]
|
self._container_name_filters = {} # type: Dict[str, Dict[str, Any]]
|
||||||
|
|
||||||
@pyqtSlot(str, str, str, result=str)
|
@pyqtSlot(str, str, str, result=str)
|
||||||
def getContainerMetaDataEntry(self, container_id, entry_name, sub_entry: Optional = None):
|
def getContainerMetaDataEntry(self, container_id, entry_name, sub_entry: Optional[str] = None):
|
||||||
metadatas = self._container_registry.findContainersMetadata(id = container_id)
|
metadatas = self._container_registry.findContainersMetadata(id = container_id)
|
||||||
if not metadatas:
|
if not metadatas:
|
||||||
Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id)
|
Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
if sub_entry != "":
|
sub_data = metadatas[0].get(entry_name, "")
|
||||||
sub_data = metadatas[0].get(entry_name, "")
|
result = str(sub_data)
|
||||||
if sub_data:
|
if sub_entry:
|
||||||
return str(sub_data.get(sub_entry, ""))
|
result = str(sub_data.get(sub_entry, ""))
|
||||||
|
|
||||||
return str(metadatas[0].get(entry_name, ""))
|
return result
|
||||||
|
|
||||||
## Set a metadata entry of the specified container.
|
## Set a metadata entry of the specified container.
|
||||||
#
|
#
|
||||||
|
|
|
@ -408,7 +408,7 @@ Column
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible") == "True"
|
return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") == "True"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue