aboutsummaryrefslogtreecommitdiffstats
path: root/tagit/widgets
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-02-08 21:16:55 +0100
committerMatthias Baumgartner <dev@igsor.net>2023-02-08 21:16:55 +0100
commitf39d577421bc2e4b041b5d22e788f4615ef78d77 (patch)
tree417f4fe5af06bfeb028e96c809bb23bf58bb4e29 /tagit/widgets
parente4b98fb261c83588ca1151a1c3f8891965051b2f (diff)
downloadtagit-f39d577421bc2e4b041b5d22e788f4615ef78d77.tar.gz
tagit-f39d577421bc2e4b041b5d22e788f4615ef78d77.tar.bz2
tagit-f39d577421bc2e4b041b5d22e788f4615ef78d77.zip
adapt to upstream changes
Diffstat (limited to 'tagit/widgets')
-rw-r--r--tagit/widgets/browser.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tagit/widgets/browser.py b/tagit/widgets/browser.py
index 4a254ee..1e42c9c 100644
--- a/tagit/widgets/browser.py
+++ b/tagit/widgets/browser.py
@@ -7,6 +7,7 @@ Author: Matthias Baumgartner, 2022
# standard imports
from collections import defaultdict
from functools import reduce, partial
+import io
import logging
import math
import operator
@@ -421,8 +422,13 @@ class Browser(GridLayout, StorageAwareMixin, ConfigAwareMixin):
# select the best fitting preview
chosen = rmatcher.by_area_min(resolution, options)
# open the preview file, default if no asset is available
- thumb = open(chosen.get(ns.bsp.asset, default=default), 'rb') # FIXME: mb/port: asset storage
- except IndexError:
+ thumb_data = chosen.asset(default=None) # FIXME: get all assets in one call
+ if thumb_data is None:
+ raise KeyError()
+ thumb = io.BytesIO(thumb_data)
+
+ except (KeyError, IndexError):
+ # KeyError:
# no viable resolution found
thumb = open(default, 'rb')
# update the image in the child widget