mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
MetaData of material profile is now set in one batch instead of multiple calls
CURA-3311
This commit is contained in:
parent
fce9df756c
commit
bda818b104
1 changed files with 15 additions and 21 deletions
|
@ -376,12 +376,10 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
|
|
||||||
# Reset previous metadata
|
# Reset previous metadata
|
||||||
self.clearData() # Ensure any previous data is gone.
|
self.clearData() # Ensure any previous data is gone.
|
||||||
|
meta_data = {}
|
||||||
self.addMetaDataEntry("type", "material")
|
meta_data["type"] = "material"
|
||||||
self.addMetaDataEntry("base_file", self.id)
|
meta_data["base_file"] = self.id
|
||||||
|
meta_data["status"] = "unknown" # TODO: Add material verfication
|
||||||
# TODO: Add material verfication
|
|
||||||
self.addMetaDataEntry("status", "unknown")
|
|
||||||
|
|
||||||
inherits = data.find("./um:inherits", self.__namespaces)
|
inherits = data.find("./um:inherits", self.__namespaces)
|
||||||
if inherits is not None:
|
if inherits is not None:
|
||||||
|
@ -402,20 +400,17 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
self.setName(label.text)
|
self.setName(label.text)
|
||||||
else:
|
else:
|
||||||
self.setName(self._profile_name(material.text, color.text))
|
self.setName(self._profile_name(material.text, color.text))
|
||||||
|
meta_data["brand"] = brand.text
|
||||||
self.addMetaDataEntry("brand", brand.text)
|
meta_data["material"] = material.text
|
||||||
self.addMetaDataEntry("material", material.text)
|
meta_data["color_name"] = color.text
|
||||||
self.addMetaDataEntry("color_name", color.text)
|
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
meta_data[tag_name] = entry.text
|
||||||
|
|
||||||
self.addMetaDataEntry(tag_name, entry.text)
|
if not "description" in meta_data:
|
||||||
|
meta_data["description"] = ""
|
||||||
|
|
||||||
if not "description" in self.getMetaData():
|
if not "adhesion_info" in meta_data:
|
||||||
self.addMetaDataEntry("description", "")
|
meta_data["adhesion_info"] = ""
|
||||||
|
|
||||||
if not "adhesion_info" in self.getMetaData():
|
|
||||||
self.addMetaDataEntry("adhesion_info", "")
|
|
||||||
|
|
||||||
property_values = {}
|
property_values = {}
|
||||||
properties = data.iterfind("./um:properties/*", self.__namespaces)
|
properties = data.iterfind("./um:properties/*", self.__namespaces)
|
||||||
|
@ -425,8 +420,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
|
|
||||||
diameter = float(property_values.get("diameter", 2.85)) # In mm
|
diameter = float(property_values.get("diameter", 2.85)) # In mm
|
||||||
density = float(property_values.get("density", 1.3)) # In g/cm3
|
density = float(property_values.get("density", 1.3)) # In g/cm3
|
||||||
|
meta_data["properties"] = property_values
|
||||||
self.addMetaDataEntry("properties", property_values)
|
|
||||||
|
|
||||||
self.setDefinition(UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0])
|
self.setDefinition(UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0])
|
||||||
|
|
||||||
|
@ -444,8 +438,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
else:
|
else:
|
||||||
Logger.log("d", "Unsupported material setting %s", key)
|
Logger.log("d", "Unsupported material setting %s", key)
|
||||||
|
|
||||||
self.addMetaDataEntry("compatible", global_compatibility)
|
meta_data["compatible"] = global_compatibility
|
||||||
|
self.setMetaData(meta_data)
|
||||||
self._dirty = False
|
self._dirty = False
|
||||||
|
|
||||||
machines = data.iterfind("./um:settings/um:machine", self.__namespaces)
|
machines = data.iterfind("./um:settings/um:machine", self.__namespaces)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue