2006-05-23 Alex Roitman <shura@gramps-project.org>

* src/Utils.py (probably_alive): Adapt to new birth/death refs.



svn: r6763
This commit is contained in:
Alex Roitman 2006-05-23 20:31:39 +00:00
parent 9e45d663b6
commit d1d1c2fb5b
2 changed files with 30 additions and 18 deletions

View File

@ -1,3 +1,6 @@
2006-05-23 Alex Roitman <shura@gramps-project.org>
* src/Utils.py (probably_alive): Adapt to new birth/death refs.
2006-05-23 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2006-05-23 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DataViews/_PedigreeView.py: Use dbstate only to not get out of * src/DataViews/_PedigreeView.py: Use dbstate only to not get out of
sync with db and active person. sync with db and active person.

View File

@ -625,8 +625,9 @@ def probably_alive(person,db,current_year=None,limit=0):
death_year = None death_year = None
# If the recorded death year is before current year then # If the recorded death year is before current year then
# things are simple. # things are simple.
if person.death_ref: death_ref = person.get_death_ref()
death = db.get_event_from_handle(person.death_ref.ref) if death_ref:
death = db.get_event_from_handle(death_ref.ref)
if death.get_date_object().get_start_date() != RelLib.Date.EMPTY: if death.get_date_object().get_start_date() != RelLib.Date.EMPTY:
death_year = death.get_date_object().get_year() death_year = death.get_date_object().get_year()
if death_year + limit < current_year: if death_year + limit < current_year:
@ -652,8 +653,9 @@ def probably_alive(person,db,current_year=None,limit=0):
birth_year = None birth_year = None
# If they were born within 100 years before current year then # If they were born within 100 years before current year then
# assume they are alive (we already know they are not dead). # assume they are alive (we already know they are not dead).
if person.birth_ref: birth_ref = person.get_birth_ref()
birth = db.get_event_from_handle(person.birth_ref.ref) if birth_ref:
birth = db.get_event_from_handle(birth_ref.ref)
if birth.get_date_object().get_start_date() != RelLib.Date.EMPTY: if birth.get_date_object().get_start_date() != RelLib.Date.EMPTY:
if not birth_year: if not birth_year:
birth_year = birth.get_date_object().get_year() birth_year = birth.get_date_object().get_year()
@ -681,8 +683,9 @@ def probably_alive(person,db,current_year=None,limit=0):
for child_ref in family.get_child_ref_list(): for child_ref in family.get_child_ref_list():
child_handle = child_ref.ref child_handle = child_ref.ref
child = db.get_person_from_handle(child_handle) child = db.get_person_from_handle(child_handle)
if child.birth_ref: child_birth_ref = child.get_birth_ref()
child_birth = db.get_event_from_handle(child.birth_ref.ref) if child_birth_ref:
child_birth = db.get_event_from_handle(child_birth_ref.ref)
dobj = child_birth.get_date_object() dobj = child_birth.get_date_object()
if dobj.get_start_date() != RelLib.Date.EMPTY: if dobj.get_start_date() != RelLib.Date.EMPTY:
d = RelLib.Date(dobj) d = RelLib.Date(dobj)
@ -692,8 +695,9 @@ def probably_alive(person,db,current_year=None,limit=0):
if not not_too_old (d,current_year): if not not_too_old (d,current_year):
return True return True
if child.death_ref: child_death_ref = child.get_death_ref()
child_death = db.get_event_from_handle(child.death_ref.ref) if child_death_ref:
child_death = db.get_event_from_handle(child_death_ref.ref)
dobj = child_death.get_date_object() dobj = child_death.get_date_object()
if dobj.get_start_date() != RelLib.Date.EMPTY: if dobj.get_start_date() != RelLib.Date.EMPTY:
if not not_too_old (dobj,current_year): if not not_too_old (dobj,current_year):
@ -725,8 +729,10 @@ def probably_alive(person,db,current_year=None,limit=0):
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
if father_handle: if father_handle:
father = db.get_person_from_handle(father_handle) father = db.get_person_from_handle(father_handle)
if father.birth_ref: father_birth_ref = father.get_birth_ref()
father_birth = db.get_event_from_handle(father.birth_ref.ref) if father_birth_ref:
father_birth = db.get_event_from_handle(
father_birth_ref.ref)
dobj = father_birth.get_date_object() dobj = father_birth.get_date_object()
if dobj.get_start_date() != RelLib.Date.EMPTY: if dobj.get_start_date() != RelLib.Date.EMPTY:
if not not_too_old (dobj,year - average_generation_gap): if not not_too_old (dobj,year - average_generation_gap):
@ -735,9 +741,10 @@ def probably_alive(person,db,current_year=None,limit=0):
#else: #else:
#print father.get_primary_name().get_name(), " father of ", person.get_primary_name().get_name(), " is NOT too old by birth. birth year ", dobj.get_year(), " test year ", year - average_generation_gap #print father.get_primary_name().get_name(), " father of ", person.get_primary_name().get_name(), " is NOT too old by birth. birth year ", dobj.get_year(), " test year ", year - average_generation_gap
father_death_ref = father.get_death_ref()
if father.death_ref: if father_death_ref:
father_death = db.get_event_from_handle(father.death_ref.ref) father_death = db.get_event_from_handle(
father_death_ref.ref)
dobj = father_death.get_date_object() dobj = father_death.get_date_object()
if dobj.get_start_date() != RelLib.Date.EMPTY: if dobj.get_start_date() != RelLib.Date.EMPTY:
if dobj.get_year() < year - average_generation_gap: if dobj.get_year() < year - average_generation_gap:
@ -750,8 +757,9 @@ def probably_alive(person,db,current_year=None,limit=0):
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if mother_handle: if mother_handle:
mother = db.get_person_from_handle(mother_handle) mother = db.get_person_from_handle(mother_handle)
if mother.birth_ref: mother_birth_ref = mother.get_birth_ref()
mother_birth = db.get_event_from_handle(mother.birth_ref.ref) if mother_birth_ref:
mother_birth = db.get_event_from_handle(mother_birth_ref.ref)
dobj = mother_birth.get_date_object() dobj = mother_birth.get_date_object()
if dobj.get_start_date() != RelLib.Date.EMPTY: if dobj.get_start_date() != RelLib.Date.EMPTY:
if not not_too_old (dobj,year - average_generation_gap): if not not_too_old (dobj,year - average_generation_gap):
@ -760,9 +768,10 @@ def probably_alive(person,db,current_year=None,limit=0):
#else: #else:
#print mother.get_primary_name().get_name(), " mother of ", person.get_primary_name().get_name(), " is NOT too old by birth. birth year ", dobj.get_year(), " test year ", year - average_generation_gap #print mother.get_primary_name().get_name(), " mother of ", person.get_primary_name().get_name(), " is NOT too old by birth. birth year ", dobj.get_year(), " test year ", year - average_generation_gap
mother_death_ref = mother.get_death_ref()
if mother.death_ref: if mother_death_ref:
mother_death = db.get_event_from_handle(mother.death_ref.ref) mother_death = db.get_event_from_handle(
mother_death_ref.ref)
dobj = mother_death.get_date_object() dobj = mother_death.get_date_object()
if dobj.get_start_date() != RelLib.Date.EMPTY: if dobj.get_start_date() != RelLib.Date.EMPTY:
if dobj.get_year() < year - average_generation_gap: if dobj.get_year() < year - average_generation_gap: