BIM: Fixed image loading of the tutorial - fixes #17863

This commit is contained in:
Yorik van Havre
2024-11-15 13:23:53 +01:00
committed by Yorik van Havre
parent 6f8abe880c
commit 36cf031f0b

View File

@@ -169,8 +169,12 @@ class BIM_Tutorial:
os.makedirs(store)
for path in imagepaths:
# name = re.findall(r"[\\w.-]+\\.(?i)(?:jpg|png|gif|bmp)",path)
name = re.findall(r"(?i)[\\w.-]+\\.(?:jpg|png|gif|bmp)", path)
if name:
# name = re.findall(r"(?i)[\\w.-]+\\.(?:jpg|png|gif|bmp)", path)
try:
name = os.path.splitext(os.path.basename(path))[0]
except:
print("unparsable image path:", path)
else:
name = name[-1]
storename = os.path.join(store, name)
if not os.path.exists(storename):
@@ -190,8 +194,6 @@ class BIM_Tutorial:
descr = descr.replace(
path, "file:///" + storename.replace("\\", "/")
)
else:
print("unparsable image path:", path)
nd.append(descr)
self.descriptions = nd