mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Remove excessive logs, make path search recursive for materials.
CURA-8610
This commit is contained in:
parent
4e80d170d1
commit
8c2ac9f21e
2 changed files with 3 additions and 6 deletions
|
@ -62,8 +62,7 @@ class CuraPackageManager(PackageManager):
|
||||||
for path in Resources.getSecureSearchPaths():
|
for path in Resources.getSecureSearchPaths():
|
||||||
# Secure search paths are install directory paths, if a material is in here it must be bundled.
|
# 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')]
|
paths = [Path(p) for p in glob.glob(path + '/**/*.xml.fdm_material', recursive=True)]
|
||||||
Logger.info(f"All bundled Materials Found: {[str(path) for path in paths]}")
|
|
||||||
for material in paths:
|
for material in paths:
|
||||||
if material.name == file_name:
|
if material.name == file_name:
|
||||||
Logger.info(f"Found bundled material: {material.name}. Located in path: {str(material)}")
|
Logger.info(f"Found bundled material: {material.name}. Located in path: {str(material)}")
|
||||||
|
@ -81,15 +80,14 @@ class CuraPackageManager(PackageManager):
|
||||||
|
|
||||||
def getMaterialFilePackageId(self, file_name: str, guid: str) -> str:
|
def getMaterialFilePackageId(self, file_name: str, guid: str) -> str:
|
||||||
"""Get the id of the installed material package that contains file_name"""
|
"""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()]:
|
for material_package in [f for f in os.scandir(self._installation_dirs_dict["materials"]) if f.is_dir()]:
|
||||||
package_id = material_package.name
|
package_id = material_package.name
|
||||||
|
|
||||||
for root, _, file_names in os.walk(material_package.path):
|
for root, _, file_names in os.walk(material_package.path):
|
||||||
if file_name not in file_names:
|
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
|
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:
|
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
|
# 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.
|
# Parsing this xml would be better but the namespace is needed to search it.
|
||||||
|
|
|
@ -278,7 +278,6 @@ class ThreeMFWriter(MeshWriter):
|
||||||
if not package_data:
|
if not package_data:
|
||||||
# We failed to find the package for this material
|
# We failed to find the package for this material
|
||||||
|
|
||||||
Logger.info(f"Secure resource paths searched for: {Resources.getSecureSearchPaths()}")
|
|
||||||
message = Message(catalog.i18nc("@error:material",
|
message = Message(catalog.i18nc("@error:material",
|
||||||
"It was not possible to store material package information in project file: {material}. This project may not open correctly on other systems.".format(material=extruder.getName())),
|
"It was not possible to store material package information in project file: {material}. This project may not open correctly on other systems.".format(material=extruder.getName())),
|
||||||
title=catalog.i18nc("@info:title", "Failed to save material package information"),
|
title=catalog.i18nc("@info:title", "Failed to save material package information"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue