* src/plugins/Verify.py: add ability to disable age estimation

* src/plugins/verify.glade: add ability to disable age estimation


svn: r2226
This commit is contained in:
Don Allingham 2003-10-11 03:13:41 +00:00
parent efd35b299c
commit 03644b93cf
2 changed files with 73 additions and 56 deletions

View File

@ -106,7 +106,8 @@ def on_apply_clicked(obj):
yngdad = int(verifySettings.get_widget("yngdad").get_text())
wedder = int(verifySettings.get_widget("wedder").get_text())
lngwdw = int(verifySettings.get_widget("lngwdw").get_text())
estimate_age = verifySettings.get_widget("estimate").get_active()
oldunm = 99 # maximum age at death for unmarried person
error = cStringIO.StringIO()
@ -116,6 +117,7 @@ def on_apply_clicked(obj):
idstr = person.getPrimaryName().getName() + " (" + person.getId() + ")"
# individual checks
ageatdeath = 0
byear = get_year( person.getBirth() )
bapyear = 0
dyear = get_year( person.getDeath() )
@ -178,47 +180,38 @@ def on_apply_clicked(obj):
if person.getGender() == RelLib.Person.female:
error.write( _("Buried before baptism: %(female_name)s baptized %(bapyear)d, buried %(buryear)d.\n") % {
'female_name' : idstr, 'bapyear' : bapyear, 'buryear' : buryear } )
if byear == 0:
byear = bapyear # guess baptism = birth
if dyear == 0:
dyear = buryear # guess burial = death
if byear>0 and dyear>0:
ageatdeath = dyear - byear
else:
ageatdeath = 0
if byear == 0 and estimate_age:
byear = bapyear # guess baptism = birth
if dyear == 0 and estimate_age:
dyear = buryear # guess burial = death
if byear>0 and dyear>0:
ageatdeath = dyear - byear
else:
ageatdeath = 0
if ageatdeath > oldage:
if person.getGender() == RelLib.Person.male:
warn.write( _("Old age: %(male_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % {
'male_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } )
if person.getGender() == RelLib.Person.female:
warn.write( _("Old age: %(female_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % {
'female_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } )
if person.getGender() == RelLib.Person.male:
warn.write( _("Old age: %(male_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % {
'male_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } )
if person.getGender() == RelLib.Person.female:
warn.write( _("Old age: %(female_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % {
'female_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } )
# gender checks
#FIXME
if person.getGender() == RelLib.Person.female:
# parstr = _("mother ")
oldpar = oldmom
yngpar = yngmom
# waswidstr = _(" was a widow ")
if person.getGender() == RelLib.Person.male:
# parstr = _("father ")
oldpar = olddad
yngpar = yngdad
# waswidstr = _(" was a widower ")
if (person.getGender() != RelLib.Person.female) and (person.getGender() != RelLib.Person.male):
warn.write( _("Unknown gender for %s.\n") % idstr )
# parstr = _("parent ")
oldpar = olddad
yngpar = yngdad
# waswidstr = _(" was a widow ")
if (person.getGender() == RelLib.Person.female) and (person.getGender() == RelLib.Person.male):
error.write( _("Ambiguous gender for %s.\n") % idstr )
# parstr = _("parent ")
oldpar = olddad
yngpar = yngdad
# waswidstr = _(" was a widow ")
# multiple parentage check
if( len( person.getParentList() ) > 1 ):
@ -264,13 +257,15 @@ def on_apply_clicked(obj):
spouse = family.getFather()
if spouse != None:
if person.getGender() == RelLib.Person.male and \
person.getPrimaryName().getSurname() == spouse.getPrimaryName().getSurname():
warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % ( idstr,family.getId(), spouse.getPrimaryName().getName() ) )
person.getPrimaryName().getSurname() == spouse.getPrimaryName().getSurname():
warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % (
idstr,family.getId(), spouse.getPrimaryName().getName() ) )
sdyear = get_year( spouse.getDeath() )
if sdyear == 0:
sdyear = 0 # burial year
maryear = get_year( family.getMarriage() )
if maryear == 0: # estimate marriage year
if maryear == 0 and estimate_age: # estimate marriage year
cnum=0
for child in family.getChildList():
cnum = cnum + 1

View File

@ -2,6 +2,7 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="verify_result_old">
<property name="visible">True</property>
@ -173,7 +174,7 @@
<widget class="GtkTable" id="table5">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">17</property>
<property name="n_rows">18</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -588,8 +589,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -612,8 +613,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -634,8 +635,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -658,8 +659,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -682,8 +683,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -704,8 +705,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -726,8 +727,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -750,8 +751,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -774,8 +775,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -796,8 +797,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -820,8 +821,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -844,8 +845,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="top_attach">17</property>
<property name="bottom_attach">18</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -866,8 +867,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -888,12 +889,33 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="top_attach">17</property>
<property name="bottom_attach">18</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="estimate">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Estimate missing dates</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>