Skip to content
Snippets Groups Projects
Commit ba638648 authored by Simon Kindhauser's avatar Simon Kindhauser Committed by Caspar Martens
Browse files

fix image preview not updated when path is invalid

parent 0e3af8c6
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ class ImagePreview(Gtk.Button):
"""Preview for the core type Image."""
__gtype_name__ = 'ImagePreview'
_image: Gtk.Image = Gtk.Template.Child()
_image: Adw.Avatar = Gtk.Template.Child()
def __init__(self, view_model: ImageViewModel):
"""Construct with view_model.
......@@ -42,8 +42,12 @@ class ImagePreview(Gtk.Button):
paintable = Gdk.Texture.new_from_filename(file_path)
self._image.set_custom_image(paintable)
except Exception as e:
self._set_image_not_found()
logger.info(e)
def _set_image_not_found(self):
self._image.set_custom_image(None)
def _update_values(self, unused_sender,
unused_notification: ChangeNotification):
self._set_image_from_path(self._view_model.file_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment