Fix T63504: Python Template 'ui_previews_dynamic_enum' error

thx @nacioss for the fix
This commit is contained in:
Philipp Oeser 2019-04-12 14:00:57 +02:00
parent a96d42b2e8
commit f3fc8271b8

@ -51,7 +51,11 @@ def enum_previews_from_directory_items(self, context):
for i, name in enumerate(image_paths): for i, name in enumerate(image_paths):
# generates a thumbnail preview for a file. # generates a thumbnail preview for a file.
filepath = os.path.join(directory, name) filepath = os.path.join(directory, name)
thumb = pcoll.load(filepath, filepath, 'IMAGE') icon = pcoll.get(name)
if not icon:
thumb = pcoll.load(name, filepath, 'IMAGE')
else:
thumb = pcoll[name]
enum_items.append((name, name, "", thumb.icon_id, i)) enum_items.append((name, name, "", thumb.icon_id, i))
pcoll.my_previews = enum_items pcoll.my_previews = enum_items