Add image viewer with click on image

svn: r16243
This commit is contained in:
Doug Blank 2010-12-03 14:42:35 +00:00
parent 442475c8da
commit d59ad5e63f

View File

@ -52,6 +52,7 @@ from gui.editors import EditPerson, EditFamily
from gui.filtereditor import FilterEditor from gui.filtereditor import FilterEditor
from gen.display.name import displayer as name_displayer from gen.display.name import displayer as name_displayer
from Utils import media_path_full, probably_alive from Utils import media_path_full, probably_alive
from gui.utils import open_file_with_default_application
import DateHandler import DateHandler
import ThumbNails import ThumbNails
import config import config
@ -684,12 +685,21 @@ class RelationshipView(NavigationView):
rectangle=image_list[0].get_rectangle()) rectangle=image_list[0].get_rectangle())
image = gtk.Image() image = gtk.Image()
image.set_from_pixbuf(pixbuf) image.set_from_pixbuf(pixbuf)
image.show() button = gtk.Button()
mbox.pack_end(image, False) button.add(image)
button.connect("clicked", lambda obj: self.view_photo(mobj))
mbox.pack_end(button, False)
mbox.show_all() mbox.show_all()
self.header.pack_start(mbox, False) self.header.pack_start(mbox, False)
def view_photo(self, photo):
"""
Open this picture in the default picture viewer.
"""
photo_path = media_path_full(self.dbstate.db, photo.get_path())
open_file_with_default_application(photo_path)
def write_person_event(self, ename, event): def write_person_event(self, ename, event):
if event: if event:
dobj = event.get_date_object() dobj = event.get_date_object()