diff --git a/gramps/gui/widgets/photo.py b/gramps/gui/widgets/photo.py index 4ce0d829c..8ee690a0a 100644 --- a/gramps/gui/widgets/photo.py +++ b/gramps/gui/widgets/photo.py @@ -98,3 +98,14 @@ class Photo(Gtk.EventBox): """ self.uistate = uistate self.handle = handle + + def set_pixbuf(self, full_path, pixbuf): + """ + Set the image to be displayed from a pixbuf. + """ + self.full_path = full_path + if full_path: + self.photo.set_from_pixbuf(pixbuf) + self.photo.show() + else: + self.photo.hide() diff --git a/gramps/plugins/gramplet/gallery.py b/gramps/plugins/gramplet/gallery.py index dd6eb43ad..93cc5f2ae 100644 --- a/gramps/plugins/gramplet/gallery.py +++ b/gramps/plugins/gramplet/gallery.py @@ -20,6 +20,7 @@ from gramps.gen.plug import Gramplet from gramps.gui.widgets import Photo +from gramps.gui.thumbnails import get_thumbnail_image from gramps.gen.utils.file import media_path_full from gi.repository import Gtk @@ -63,10 +64,16 @@ class Gallery(Gramplet): photo = Photo(self.uistate.screen_height() < 1000) photo.set_image(full_path, mime_type, media_ref.get_rectangle()) photo.set_uistate(self.uistate, media_handle) - self.image_list.append(photo) - self.top.pack_start(photo, False, False, 0) - self.top.show_all() - count += 1 + else: + photo = Photo(self.uistate.screen_height() < 1000) + photo.set_pixbuf(full_path, + get_thumbnail_image(full_path, + mime_type, + media_ref.get_rectangle())) + self.image_list.append(photo) + self.top.pack_start(photo, False, False, 0) + count += 1 + self.top.show_all() self.set_has_data(count > 0) def get_has_data(self, obj):