Geography : adding date in popup to person and family views ( feature request #0004882 )

svn: r17567
This commit is contained in:
Serge Noiraud 2011-05-26 09:00:06 +00:00
parent 610442278c
commit 2f02d233bc
2 changed files with 18 additions and 8 deletions

View File

@ -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()

View File

@ -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()