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
b0d15a6b01
commit
f8f8f480f8
@ -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,26 +1419,56 @@ 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):
|
||||||
if family:
|
family = person.getMainParents ()
|
||||||
for parent in [family.getFather (), family.getMother ()]:
|
if family:
|
||||||
if not parent:
|
for parent in [family.getFather (), family.getMother ()]:
|
||||||
|
if not parent:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if parent.birth.getDate () != "":
|
||||||
|
d = SingleDate (parent.birth.getDateObj ().
|
||||||
|
get_start_date ())
|
||||||
|
d.setYear (d.getYear () + max_generation +
|
||||||
|
age_difference)
|
||||||
|
if not not_too_old (d):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if parent.death.getDate () != "":
|
||||||
|
d = SingleDate (parent.death.getDateObj ().
|
||||||
|
get_start_date ())
|
||||||
|
d.setYear (d.getYear () + age_difference)
|
||||||
|
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
|
continue
|
||||||
|
if spouse == self:
|
||||||
if parent.birth.getDate () != "":
|
continue
|
||||||
d = SingleDate (parent.birth.getDateObj ().
|
if spouse.birth.getDate () != "":
|
||||||
|
d = SingleDate (spouse.birth.getDateObj().
|
||||||
get_start_date ())
|
get_start_date ())
|
||||||
d.setYear (d.getYear () + min_generation)
|
d.setYear (d.getYear () + max_age_difference)
|
||||||
print d.getYear ()
|
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if parent.death.getDate () != "":
|
if spouse.death.getDate () != "":
|
||||||
d = SingleDate (parent.death.getDateObj ().
|
d = SingleDate (spouse.birth.getDateObj().
|
||||||
get_start_date ())
|
get_start_date ())
|
||||||
|
d.setYear (d.getYear () - min_generation)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if parents_too_old (spouse, max_age_difference):
|
||||||
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
class Event(DataObj):
|
class Event(DataObj):
|
||||||
|
Loading…
Reference in New Issue
Block a user