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

This commit is contained in:
SNoiraud 2016-01-31 11:16:10 +01:00
parent abd69fbebd
commit dfd1a596ab
2 changed files with 23 additions and 4 deletions

View File

@ -97,3 +97,15 @@ class Photo(Gtk.EventBox):
""" """
self.uistate = uistate self.uistate = uistate
self.handle = handle 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.gen.plug import Gramplet
from gramps.gui.widgets import Photo 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 gramps.gen.utils.file import media_path_full
from gi.repository import Gtk from gi.repository import Gtk
@ -63,10 +64,16 @@ class Gallery(Gramplet):
photo = Photo(self.uistate.screen_height() < 1000) photo = Photo(self.uistate.screen_height() < 1000)
photo.set_image(full_path, mime_type, media_ref.get_rectangle()) photo.set_image(full_path, mime_type, media_ref.get_rectangle())
photo.set_uistate(self.uistate, media_handle) photo.set_uistate(self.uistate, media_handle)
self.image_list.append(photo) else:
self.top.pack_start(photo, False, False, 0) photo = Photo(self.uistate.screen_height() < 1000)
self.top.show_all() photo.set_pixbuf(full_path,
count += 1 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) self.set_has_data(count > 0)
def get_has_data(self, obj): def get_has_data(self, obj):