Geography : bug correction in popup events map view

adding dates in popup menu in events, person and family map views.


svn: r17586
This commit is contained in:
Serge Noiraud 2011-05-27 13:39:07 +00:00
parent e332b75caf
commit 9006d64969
3 changed files with 24 additions and 28 deletions

View File

@ -58,6 +58,7 @@ import gen.lib
import Utils import Utils
import config import config
import Errors import Errors
import DateHandler
from gen.display.name import displayer as _nd from gen.display.name import displayer as _nd
from PlaceUtils import conv_lat_lon from PlaceUtils import conv_lat_lon
from gui.views.pageview import PageView from gui.views.pageview import PageView
@ -296,7 +297,7 @@ class GeoEvents(GeoGraphyView):
event = dbstate.db.get_event_from_handle(obj) event = dbstate.db.get_event_from_handle(obj)
self._createmap_for_one_event(event) self._createmap_for_one_event(event)
self.sort = sorted(self.place_list, self.sort = sorted(self.place_list,
key=operator.itemgetter(3, 4) key=operator.itemgetter(3, 4, 6)
) )
self._create_markers() self._create_markers()
@ -326,29 +327,14 @@ class GeoEvents(GeoGraphyView):
event, lat, lon, prevmark) event, lat, lon, prevmark)
itemoption.append(center) itemoption.append(center)
if mark[0] != oldplace: 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] message = "%s :" % mark[0]
self.add_place_bubble_message(event, lat, lon, self.add_place_bubble_message(event, lat, lon,
marks, menu, message, mark) marks, menu, message, mark)
oldplace = mark[0] 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 prevmark = mark
add_item = gtk.MenuItem(message) add_item = gtk.MenuItem(message)
add_item.show() add_item.show()

View File

@ -58,6 +58,7 @@ import gen.lib
import Utils import Utils
import config import config
import Errors import Errors
import DateHandler
from gen.display.name import displayer as _nd from gen.display.name import displayer as _nd
from PlaceUtils import conv_lat_lon from PlaceUtils import conv_lat_lon
from gui.views.pageview import PageView from gui.views.pageview import PageView
@ -394,18 +395,23 @@ class GeoFamily(GeoGraphyView):
self.add_place_bubble_message(event, lat, lon, self.add_place_bubble_message(event, lat, lon,
marks, menu, message, mark) marks, menu, message, mark)
oldplace = mark[0] 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 ): 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 ): elif ( mark[5] == gen.lib.EventRoleType.FAMILY ):
evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
(father_name, mother_name) = self._get_father_and_mother_name(evt) (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: else:
evt = self.dbstate.db.get_event_from_gramps_id(mark[10]) evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
descr = evt.get_description() descr = evt.get_description()
if descr == "": if descr == "":
descr = _('No description') descr = _('No description')
message = "%s => %s" % ( mark[5], descr) message = "(%s) %s => %s" % ( date, mark[5], descr)
prevmark = mark prevmark = mark
add_item = gtk.MenuItem(message) add_item = gtk.MenuItem(message)
add_item.show() add_item.show()

View File

@ -59,6 +59,7 @@ import gen.lib
import Utils import Utils
import config import config
import Errors import Errors
import DateHandler
from gen.display.name import displayer as _nd from gen.display.name import displayer as _nd
from PlaceUtils import conv_lat_lon from PlaceUtils import conv_lat_lon
from gui.views.pageview import PageView from gui.views.pageview import PageView
@ -440,18 +441,21 @@ class GeoPerson(GeoGraphyView):
marks, menu, message, mark) marks, menu, message, mark)
oldplace = mark[0] oldplace = mark[0]
message = "" 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 ): 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 ): 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) (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: else:
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
descr = evt.get_description() descr = evt.get_description()
if descr == "": if descr == "":
descr = _('No description') descr = _('No description')
message = "%s => %s" % ( mark[11], descr) message = "(%s) %s => %s" % ( date, mark[11], descr)
prevmark = mark prevmark = mark
add_item = gtk.MenuItem(message) add_item = gtk.MenuItem(message)
add_item.show() add_item.show()