5417 : Non-image media objects don't appear in the main window gallery.

This commit is contained in:
SNoiraud 2016-01-31 10:53:07 +01:00
parent b7b61e3cf0
commit 425fe632f3
2 changed files with 22 additions and 4 deletions

View File

@ -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()

View File

@ -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):