From 9006d649690ac006fd573147adc7ed2f6f8adb11 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Fri, 27 May 2011 13:39:07 +0000 Subject: [PATCH] Geography : bug correction in popup events map view adding dates in popup menu in events, person and family map views. svn: r17586 --- src/plugins/view/geoevents.py | 26 ++++++-------------------- src/plugins/view/geofamily.py | 12 +++++++++--- src/plugins/view/geoperson.py | 14 +++++++++----- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/plugins/view/geoevents.py b/src/plugins/view/geoevents.py index 43110ec92..5fd642127 100644 --- a/src/plugins/view/geoevents.py +++ b/src/plugins/view/geoevents.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 @@ -296,7 +297,7 @@ class GeoEvents(GeoGraphyView): event = dbstate.db.get_event_from_handle(obj) self._createmap_for_one_event(event) self.sort = sorted(self.place_list, - key=operator.itemgetter(3, 4) + key=operator.itemgetter(3, 4, 6) ) self._create_markers() @@ -326,29 +327,14 @@ class GeoEvents(GeoGraphyView): event, lat, lon, prevmark) itemoption.append(center) if mark[0] != oldplace: - if message != "": - add_item = gtk.MenuItem(message) - add_item.show() - menu.append(add_item) - itemoption = gtk.Menu() - itemoption.set_title(message) - itemoption.show() - add_item.set_submenu(itemoption) - modify = gtk.MenuItem(_("Edit Event")) - modify.show() - modify.connect("activate", self.edit_event, - event, lat, lon, mark) - itemoption.append(modify) - center = gtk.MenuItem(_("Center on this place")) - center.show() - center.connect("activate", self.center_here, - event, lat, lon, mark) - itemoption.append(center) message = "%s :" % mark[0] self.add_place_bubble_message(event, lat, lon, marks, menu, message, mark) oldplace = mark[0] - message = "%s : %s" % (gen.lib.EventType( mark[7] ), mark[5] ) + 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()) + message = "(%s) %s : %s" % (date, gen.lib.EventType( mark[7] ), mark[5] ) prevmark = mark add_item = gtk.MenuItem(message) add_item.show() 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 faf6e6e01..d263658d5 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,18 +441,21 @@ class GeoPerson(GeoGraphyView): marks, menu, message, mark) oldplace = mark[0] message = "" + 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()