2003-07-22 Tim Waugh <twaugh@redhat.com>
* src/RelLib.py: Made Person.probablyAlive() take partners into consideration if all else fails. svn: r1919
This commit is contained in:
parent
aeea4b56a5
commit
d1c1c2e4da
@ -1,4 +1,6 @@
|
|||||||
2003-07-22 Tim Waugh <twaugh@redhat.com>
|
2003-07-22 Tim Waugh <twaugh@redhat.com>
|
||||||
|
* src/RelLib.py: Made Person.probablyAlive() take partners into
|
||||||
|
consideration if all else fails.
|
||||||
* src/plugins/WriteGedcom.py, src/plugins/gedcomexport.glade: New
|
* src/plugins/WriteGedcom.py, src/plugins/gedcomexport.glade: New
|
||||||
option for obscuring names of living people.
|
option for obscuring names of living people.
|
||||||
|
|
||||||
|
@ -1394,6 +1394,8 @@ class Person(Persistent):
|
|||||||
# for descendants that were born more than a lifespan ago.
|
# for descendants that were born more than a lifespan ago.
|
||||||
|
|
||||||
min_generation = 13
|
min_generation = 13
|
||||||
|
max_generation = 60
|
||||||
|
max_age_difference = 60
|
||||||
def descendants_too_old (person, years):
|
def descendants_too_old (person, years):
|
||||||
for family in person.getFamilyList ():
|
for family in person.getFamilyList ():
|
||||||
for child in family.getChildList ():
|
for child in family.getChildList ():
|
||||||
@ -1417,7 +1419,8 @@ class Person(Persistent):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
# What about their parents?
|
# What about their parents?
|
||||||
family = self.getMainParents ()
|
def parents_too_old (person, age_difference):
|
||||||
|
family = person.getMainParents ()
|
||||||
if family:
|
if family:
|
||||||
for parent in [family.getFather (), family.getMother ()]:
|
for parent in [family.getFather (), family.getMother ()]:
|
||||||
if not parent:
|
if not parent:
|
||||||
@ -1426,15 +1429,44 @@ class Person(Persistent):
|
|||||||
if parent.birth.getDate () != "":
|
if parent.birth.getDate () != "":
|
||||||
d = SingleDate (parent.birth.getDateObj ().
|
d = SingleDate (parent.birth.getDateObj ().
|
||||||
get_start_date ())
|
get_start_date ())
|
||||||
d.setYear (d.getYear () + min_generation)
|
d.setYear (d.getYear () + max_generation +
|
||||||
print d.getYear ()
|
age_difference)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 0
|
return 1
|
||||||
|
|
||||||
if parent.death.getDate () != "":
|
if parent.death.getDate () != "":
|
||||||
d = SingleDate (parent.death.getDateObj ().
|
d = SingleDate (parent.death.getDateObj ().
|
||||||
get_start_date ())
|
get_start_date ())
|
||||||
|
d.setYear (d.getYear () + age_difference)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if parents_too_old (self, 0):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# As a last resort, trying seeing if their spouse's age gives
|
||||||
|
# any clue.
|
||||||
|
for family in self.getFamilyList ():
|
||||||
|
for spouse in [family.getFather (), family.getMother ()]:
|
||||||
|
if not spouse:
|
||||||
|
continue
|
||||||
|
if spouse == self:
|
||||||
|
continue
|
||||||
|
if spouse.birth.getDate () != "":
|
||||||
|
d = SingleDate (spouse.birth.getDateObj().
|
||||||
|
get_start_date ())
|
||||||
|
d.setYear (d.getYear () + max_age_difference)
|
||||||
|
if not not_too_old (d):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if spouse.death.getDate () != "":
|
||||||
|
d = SingleDate (spouse.birth.getDateObj().
|
||||||
|
get_start_date ())
|
||||||
|
d.setYear (d.getYear () - min_generation)
|
||||||
|
if not not_too_old (d):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if parents_too_old (spouse, max_age_difference):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user