* src/ReportUtils.py: allow start and stop event handle selection

for age estimation


svn: r3967
This commit is contained in:
Don Allingham 2005-01-26 04:21:38 +00:00
parent f875a3f8a8
commit 4cc40c0f34
3 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2005-01-25 Don Allingham <dallingham@users.sourceforge.net>
* src/ReportUtils.py: allow start and stop event handle selection
for age estimation
2005-01-25 Alex Roitman <shura@alex.neuro.umn.edu> 2005-01-25 Alex Roitman <shura@alex.neuro.umn.edu>
* src/TipOfDay.py (TipOfDay.__init__): Set transent property. * src/TipOfDay.py (TipOfDay.__init__): Set transent property.
* src/gramps_main.py (Gramnps.__init__): Pass itself to TipOfDay; * src/gramps_main.py (Gramnps.__init__): Pass itself to TipOfDay;

View File

@ -162,7 +162,7 @@ def draw_vertical_bar_graph(doc, format, start_x, start_y, height, width, data):
doc.draw_bar(data[index][0],start,bottom-size,start+box_width,bottom) doc.draw_bar(data[index][0],start,bottom-size,start+box_width,bottom)
start += box_width * 1.5 start += box_width * 1.5
def estimate_age(db, person): def estimate_age(db, person, end_handle=None, start_handle=None):
""" """
Estimates the age of a person based off the birth and death Estimates the age of a person based off the birth and death
dates of the person. A tuple containing the estimated upper dates of the person. A tuple containing the estimated upper
@ -173,12 +173,27 @@ def estimate_age(db, person):
@type db: GrampsDbBase @type db: GrampsDbBase
@param person: Person object to calculate the age of @param person: Person object to calculate the age of
@type person: Person @type person: Person
@param end_handle: Determines the event handle that determines
the upper limit of the age. If None, the death event is used
@type end_handle: str
@param start_handle: Determines the event handle that determines
the lower limit of the event. If None, the birth event is
used
@type start_handle: str
@returns: tuple containing the lower and upper bounds of the @returns: tuple containing the lower and upper bounds of the
person's age, or (-1,-1) if it could not be determined. person's age, or (-1,-1) if it could not be determined.
@rtype: tuple @rtype: tuple
""" """
bhandle = person.get_birth_handle()
dhandle = person.get_death_handle() if start_handle:
bhandle = start_handle
else:
bhandle = person.get_birth_handle()
if end_handle:
dhandle = end_handle
else:
dhandle = person.get_death_handle()
# if either of the events is not defined, return an error message # if either of the events is not defined, return an error message
if not bhandle or not dhandle: if not bhandle or not dhandle:

View File

@ -31250,7 +31250,7 @@ Family name Given name
<property name="layout_style">GTK_BUTTONBOX_END</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
<child> <child>
<widget class="GtkButton" id="button1"> <widget class="GtkButton" id="next">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -31321,7 +31321,7 @@ Family name Given name
</child> </child>
<child> <child>
<widget class="GtkButton" id="button2"> <widget class="GtkButton" id="close">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -31330,6 +31330,7 @@ Family name Given name
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
<property name="response_id">-7</property> <property name="response_id">-7</property>
<signal name="clicked" handler="gtk_widget_destroy" last_modification_time="Wed, 26 Jan 2005 02:18:57 GMT"/>
</widget> </widget>
</child> </child>
</widget> </widget>