Improve GUID check by parsing xml and getting GUID specifically inside the metadata tag.

Remove exporting materials from disabled extruders

CURA-8610
This commit is contained in:
j.delarago 2022-05-31 10:00:25 +02:00
parent 3dec025cb8
commit cdc08b5d54
3 changed files with 19 additions and 3 deletions

View file

@ -480,6 +480,15 @@ class XmlMaterialProfile(InstanceContainer):
return version * 1000000 + setting_version
@classmethod
def getMetadataFromSerialized(cls, serialized: str, property_name: str) -> str:
data = ET.fromstring(serialized)
metadata = data.find("./um:metadata", cls.__namespaces)
property = metadata.find("./um:" + property_name, cls.__namespaces)
# This is a necessary property != None check, xml library overrides __bool__ to return False in cases when Element is not None.
return property.text if property != None else ""
def deserialize(self, serialized, file_name = None):
"""Overridden from InstanceContainer"""