diff --git a/gramps/gui/widgets/photo.py b/gramps/gui/widgets/photo.py index f9280f31c..75060557d 100644 --- a/gramps/gui/widgets/photo.py +++ b/gramps/gui/widgets/photo.py @@ -97,3 +97,15 @@ 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 b0add2ff5..486a19688 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.gen.utils.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):