From 2f02d233bc5634bbf103e601771619b00d05a141 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Thu, 26 May 2011 09:00:06 +0000 Subject: [PATCH] Geography : adding date in popup to person and family views ( feature request #0004882 ) svn: r17567 --- src/plugins/view/geofamily.py | 12 +++++++++--- src/plugins/view/geoperson.py | 14 +++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/plugins/view/geofamily.py b/src/plugins/view/geofamily.py index ff36fc11a..4b36eba8f 100644 --- a/src/plugins/view/geofamily.py +++ b/src/plugins/view/geofamily.py @@ -58,6 +58,7 @@ import gen.lib import Utils import config import Errors +import DateHandler from gen.display.name import displayer as _nd from PlaceUtils import conv_lat_lon from gui.views.pageview import PageView @@ -394,18 +395,23 @@ class GeoFamily(GeoGraphyView): self.add_place_bubble_message(event, lat, lon, marks, menu, message, mark) oldplace = mark[0] + evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) + # format the date as described in preferences. + date = DateHandler.displayer.display(evt.get_date_object()) + if date == "": + date = _("Unknown") if ( mark[5] == gen.lib.EventRoleType.PRIMARY ): - message = "%s : %s" % ( mark[7], mark[1] ) + message = "(%s) %s : %s" % ( date, mark[7], mark[1] ) elif ( mark[5] == gen.lib.EventRoleType.FAMILY ): evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) (father_name, mother_name) = self._get_father_and_mother_name(evt) - message = "%s : %s - %s" % ( mark[7], father_name, mother_name ) + message = "(%s) %s : %s - %s" % ( date, mark[7], father_name, mother_name ) else: evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) descr = evt.get_description() if descr == "": descr = _('No description') - message = "%s => %s" % ( mark[5], descr) + message = "(%s) %s => %s" % ( date, mark[5], descr) prevmark = mark add_item = gtk.MenuItem(message) add_item.show() diff --git a/src/plugins/view/geoperson.py b/src/plugins/view/geoperson.py index b9409710f..692295a3d 100644 --- a/src/plugins/view/geoperson.py +++ b/src/plugins/view/geoperson.py @@ -59,6 +59,7 @@ import gen.lib import Utils import config import Errors +import DateHandler from gen.display.name import displayer as _nd from PlaceUtils import conv_lat_lon from gui.views.pageview import PageView @@ -440,19 +441,22 @@ class GeoPerson(GeoGraphyView): marks, menu, message, mark) oldplace = mark[0] message = "" - print "role : ", mark[11] + evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) + # format the date as described in preferences. + date = DateHandler.displayer.display(evt.get_date_object()) + if date == "": + date = _("Unknown") if ( mark[11] == gen.lib.EventRoleType.PRIMARY ): - message = "%s : %s" % ( mark[2], mark[1] ) + message = "(%s) %s : %s" % ( date, mark[2], mark[1] ) elif ( mark[11] == gen.lib.EventRoleType.FAMILY ): - evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) (father_name, mother_name) = self._get_father_and_mother_name(evt) - message = "%s : %s - %s" % ( mark[7], father_name, mother_name ) + message = "(%s) %s : %s - %s" % ( date, mark[7], father_name, mother_name ) else: evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) descr = evt.get_description() if descr == "": descr = _('No description') - message = "%s => %s" % ( mark[11], descr) + message = "(%s) %s => %s" % ( date, mark[11], descr) prevmark = mark add_item = gtk.MenuItem(message) add_item.show()