update
svn: r3608
This commit is contained in:
parent
8ab5b5ac59
commit
e2a30436e1
@ -552,118 +552,6 @@ class Person(PrimaryObject,SourceNote):
|
|||||||
"""Gets the LDS Sealing ordinance"""
|
"""Gets the LDS Sealing ordinance"""
|
||||||
return self.lds_seal
|
return self.lds_seal
|
||||||
|
|
||||||
def probably_alive(self,db):
|
|
||||||
"""Returns true if the person may be alive."""
|
|
||||||
if self.death_handle:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Look for Cause Of Death, Burial or Cremation events.
|
|
||||||
# These are fairly good indications that someone's not alive.
|
|
||||||
for ev_handle in self.event_list:
|
|
||||||
ev = db.get_event_from_handle(ev_handle)
|
|
||||||
if ev.name in ["Cause Of Death", "Burial", "Cremation"]:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if self.birth_handle:
|
|
||||||
birth = db.get_event_from_handle(self.birth_handle)
|
|
||||||
if birth.get_date_object().get_start_date() != Date.EMPTY:
|
|
||||||
return not_too_old(birth.get_date_object())
|
|
||||||
|
|
||||||
# Neither birth nor death events are available. Try looking
|
|
||||||
# for descendants that were born more than a lifespan ago.
|
|
||||||
|
|
||||||
min_generation = 13
|
|
||||||
max_generation = 60
|
|
||||||
max_age_difference = 60
|
|
||||||
def descendants_too_old (person, years):
|
|
||||||
for family_handle in person.get_family_handle_list():
|
|
||||||
family = db.get_family_from_handle(family_handle)
|
|
||||||
for child_handle in family.get_child_handle_list():
|
|
||||||
child = db.get_person_from_handle(child_handle)
|
|
||||||
if child.birth_handle:
|
|
||||||
child_birth = db.get_event_from_handle(child.birth_handle)
|
|
||||||
dobj = child_birth.get_date_object()
|
|
||||||
if dobj.get_start_date() != Date.EMPTY:
|
|
||||||
d = Date(dobj)
|
|
||||||
d.set_year(d.get_year() - years)
|
|
||||||
if not not_too_old (d):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if child.death_handle:
|
|
||||||
child_death = db.get_event_from_handle(child.death_handle)
|
|
||||||
dobj = child_death.get_date_object()
|
|
||||||
if dobj.get_start_date != Date.EMPTY:
|
|
||||||
if not not_too_old (dobj):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if descendants_too_old (child, years + min_generation):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if descendants_too_old (self, min_generation):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
# What about their parents?
|
|
||||||
def parents_too_old (person, age_difference):
|
|
||||||
family_handle = person.get_main_parents_family_handle()
|
|
||||||
if family_handle:
|
|
||||||
family = db.get_family_from_handle(family_handle)
|
|
||||||
for parent_id in [family.get_father_handle(), family.get_mother_handle()]:
|
|
||||||
if not parent_id:
|
|
||||||
continue
|
|
||||||
|
|
||||||
parent = db.get_person_from_handle(parent_id)
|
|
||||||
if parent.birth_handle:
|
|
||||||
parent_birth = db.get_event_from_handle(parent.birth_handle)
|
|
||||||
if parent_birth.get_date():
|
|
||||||
d = SingleDate (parent_birth.get_date_object().get_start_date())
|
|
||||||
d.set_year (d.get_year() + max_generation + age_difference)
|
|
||||||
if not not_too_old (d):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if parent.death_handle:
|
|
||||||
parent_death = db.get_event_from_handle(parent.death_handle)
|
|
||||||
if parent_death.get_date() != "":
|
|
||||||
d = SingleDate (parent_death.get_date_object().
|
|
||||||
get_start_date())
|
|
||||||
d.set_year (d.get_year() + age_difference)
|
|
||||||
if not not_too_old (d):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if parents_too_old (self, 0):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# As a last resort, trying seeing if their spouse's age gives
|
|
||||||
# any clue.
|
|
||||||
for family_handle in self.get_family_handle_list():
|
|
||||||
family = db.get_family_from_handle(family_handle)
|
|
||||||
for spouse_id in [family.get_father_handle(), family.get_mother_handle()]:
|
|
||||||
if not spouse_id or spouse_id == self.handle:
|
|
||||||
continue
|
|
||||||
spouse = db.get_person_from_handle(spouse_id)
|
|
||||||
sp_birth_handle = spouse.get_birth_handle()
|
|
||||||
sp_death_handle = spouse.get_death_handle()
|
|
||||||
if sp_birth_handle:
|
|
||||||
spouse_birth = db.get_event_from_handle(sp_birth_handle)
|
|
||||||
if spouse_birth.get_date() != "":
|
|
||||||
d = SingleDate (spouse_birth.get_date_object().get_start_date())
|
|
||||||
d.set_year (d.get_year() + max_age_difference)
|
|
||||||
if not not_too_old (d):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if sp_death_handle:
|
|
||||||
spouse_death = db.get_event_from_handle(sp_death_handle)
|
|
||||||
if spouse_death.get_date() != "":
|
|
||||||
d = SingleDate (spouse_death.get_date_object().get_start_date())
|
|
||||||
d.set_year (d.get_year() - min_generation)
|
|
||||||
if not not_too_old (d):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if parents_too_old (spouse, max_age_difference):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
class Family(PrimaryObject,SourceNote):
|
class Family(PrimaryObject,SourceNote):
|
||||||
"""
|
"""
|
||||||
GRAMPS Family record. Represents a family unit, which defines the
|
GRAMPS Family record. Represents a family unit, which defines the
|
||||||
|
Loading…
Reference in New Issue
Block a user