diff options
author | j.delarago <joeydelarago@gmail.com> | 2022-06-15 15:09:05 +0300 |
---|---|---|
committer | j.delarago <joeydelarago@gmail.com> | 2022-06-15 15:09:05 +0300 |
commit | 4e80d170d188863b1d8116e6d5d8470f721565aa (patch) | |
tree | b259acc5ca92de5a55e5ac6bf7ff8bf37bebbeaa /cura/CuraPackageManager.py | |
parent | 5d0e4238d595056f4f7f51af0a736d17afa94611 (diff) |
Add logs for debugging
CURA-8610
Diffstat (limited to 'cura/CuraPackageManager.py')
-rw-r--r-- | cura/CuraPackageManager.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 12a77fd234..fbede6d08b 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -63,8 +63,10 @@ class CuraPackageManager(PackageManager): # Secure search paths are install directory paths, if a material is in here it must be bundled. paths = [Path(p) for p in glob.glob(path + '/**/*.xml.fdm_material')] + Logger.info(f"All bundled Materials Found: {[str(path) for path in paths]}") for material in paths: if material.name == file_name: + Logger.info(f"Found bundled material: {material.name}. Located in path: {str(material)}") with open(material, 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. @@ -79,19 +81,21 @@ class CuraPackageManager(PackageManager): def getMaterialFilePackageId(self, file_name: str, guid: str) -> str: """Get the id of the installed material package that contains file_name""" + Logger.info(f'Searching paths for package: {[f for f in os.scandir(self._installation_dirs_dict["materials"]) if f.is_dir()]}') for material_package in [f for f in os.scandir(self._installation_dirs_dict["materials"]) if f.is_dir()]: package_id = material_package.name - 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 continue - + Logger.info(f"Found file: {file_name}") + Logger.info(f"Attempting to open {os.path.join(root, file_name)}") with open(os.path.join(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. parsed_guid = PluginRegistry.getInstance().getPluginObject("XmlMaterialProfile").getMetadataFromSerialized( f.read(), "GUID") + if guid == parsed_guid: return package_id |