Added to display age at death if dead, or current age if alive
svn: r11471
This commit is contained in:
parent
ab98ce5d88
commit
246f76621a
@ -567,11 +567,34 @@ class RelationshipView(PageView.PersonNavView):
|
|||||||
else:
|
else:
|
||||||
death_title = _("Death")
|
death_title = _("Death")
|
||||||
|
|
||||||
subtbl.attach(widgets.BasicLabel("%s:" % death_title),
|
showed_death = False
|
||||||
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
|
if birth:
|
||||||
subtbl.attach(widgets.BasicLabel(self.format_event(death)),
|
birth_date = birth.get_date_object()
|
||||||
2, 3, 2, 3, yoptions=0)
|
if (birth_date and birth_date.get_valid()):
|
||||||
|
if death:
|
||||||
|
death_date = death.get_date_object()
|
||||||
|
if (death_date and death_date.get_valid()):
|
||||||
|
age = death_date - birth_date
|
||||||
|
subtbl.attach(widgets.BasicLabel("%s:" % death_title),
|
||||||
|
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
|
||||||
|
subtbl.attach(widgets.BasicLabel("%s (%s)" %
|
||||||
|
(self.format_event(death),
|
||||||
|
age)),
|
||||||
|
2, 3, 2, 3, yoptions=0)
|
||||||
|
showed_death = True
|
||||||
|
if not showed_death:
|
||||||
|
age = gen.lib.date.Today() - birth_date
|
||||||
|
subtbl.attach(widgets.BasicLabel("%s:" % death_title),
|
||||||
|
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
|
||||||
|
subtbl.attach(widgets.BasicLabel("(%s)" % age),
|
||||||
|
2, 3, 2, 3, yoptions=0)
|
||||||
|
showed_death = True
|
||||||
|
|
||||||
|
if not showed_death:
|
||||||
|
subtbl.attach(widgets.BasicLabel("%s:" % death_title),
|
||||||
|
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
|
||||||
|
subtbl.attach(widgets.BasicLabel(self.format_event(death)),
|
||||||
|
2, 3, 2, 3, yoptions=0)
|
||||||
|
|
||||||
mbox = gtk.HBox()
|
mbox = gtk.HBox()
|
||||||
mbox.add(table)
|
mbox.add(table)
|
||||||
|
@ -1140,4 +1140,12 @@ class Date:
|
|||||||
"""
|
"""
|
||||||
return self._get_low_item_valid(Date._POS_SL)
|
return self._get_low_item_valid(Date._POS_SL)
|
||||||
|
|
||||||
|
def Today():
|
||||||
|
"""
|
||||||
|
Returns a Date object set to the current date.
|
||||||
|
"""
|
||||||
|
import time
|
||||||
|
current_date = Date()
|
||||||
|
current_date.set_yr_mon_day(*time.localtime(time.time())[0:3])
|
||||||
|
return current_date
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user