diff options
author | j.delarago <joeydelarago@gmail.com> | 2022-05-31 11:00:25 +0300 |
---|---|---|
committer | j.delarago <joeydelarago@gmail.com> | 2022-05-31 11:00:25 +0300 |
commit | cdc08b5d54da9f9be7a8269fc549442db445b778 (patch) | |
tree | c121c9e15bfce825789d5d44520df6ecd390b544 /cura/CuraPackageManager.py | |
parent | 3dec025cb881e171dc89fa293c18afe13c32ed15 (diff) |
Improve GUID check by parsing xml and getting GUID specifically inside the metadata tag.
Remove exporting materials from disabled extruders
CURA-8610
Diffstat (limited to 'cura/CuraPackageManager.py')
-rw-r--r-- | cura/CuraPackageManager.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 813ce40763..0cb18ccc92 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -10,6 +10,8 @@ from cura.Settings.GlobalStack import GlobalStack from UM.PackageManager import PackageManager # The class we're extending. from UM.Resources import Resources # To find storage paths for some resource types. from UM.i18n import i18nCatalog +from plugins.XmlMaterialProfile.XmlMaterialProfile import XmlMaterialProfile + catalog = i18nCatalog("cura") if TYPE_CHECKING: @@ -59,13 +61,14 @@ class CuraPackageManager(PackageManager): for root, _, file_names in os.walk(material_package.path): if file_name not in file_names: - #File with the name we are looking for is not in this directory + # File with the name we are looking for is not in this directory continue with open(root + "/" + file_name, encoding="utf-8") as f: # Make sure the file we found has the same guid as our material # Parsing this xml would be better but the namespace is needed to search it. - if guid in f.read(): + parsed_guid = XmlMaterialProfile.getMetadataFromSerialized(f.read(), "GUID") + if guid == parsed_guid: return package_id continue |