2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/GenericFilter.py: added a current year parameter to probably alive rule. * src/Utils.py: added a current year parameter to probably alive function. svn: r4312
This commit is contained in:
parent
4aa708e30e
commit
76c44f2694
@ -1,3 +1,7 @@
|
|||||||
|
2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
|
* src/GenericFilter.py: added a current year parameter to probably alive rule.
|
||||||
|
* src/Utils.py: added a current year parameter to probably alive function.
|
||||||
|
|
||||||
2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/plugins/FilterEditor.py: Added source IDs into the source combobox.
|
* src/plugins/FilterEditor.py: Added source IDs into the source combobox.
|
||||||
|
|
||||||
|
@ -1724,7 +1724,7 @@ class FamilyWithIncompleteEvent(Rule):
|
|||||||
class ProbablyAlive(Rule):
|
class ProbablyAlive(Rule):
|
||||||
"""People probably alive"""
|
"""People probably alive"""
|
||||||
|
|
||||||
labels = []
|
labels = ["On year"]
|
||||||
|
|
||||||
def name(self):
|
def name(self):
|
||||||
return 'People probably alive'
|
return 'People probably alive'
|
||||||
@ -1737,8 +1737,12 @@ class ProbablyAlive(Rule):
|
|||||||
|
|
||||||
|
|
||||||
def apply(self,db,p_id):
|
def apply(self,db,p_id):
|
||||||
|
if len(self.list) == 0:
|
||||||
|
current_year = None
|
||||||
|
else:
|
||||||
|
current_year = int(self.list[0])
|
||||||
p = db.get_person_from_handle(p_id)
|
p = db.get_person_from_handle(p_id)
|
||||||
return probably_alive(p,db)
|
return probably_alive(p,db,current_year)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "People marked private"
|
# "People marked private"
|
||||||
|
@ -438,7 +438,7 @@ def create_id():
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
def probably_alive(person,db):
|
def probably_alive(person,db,current_year=None):
|
||||||
"""Returns true if the person may be alive."""
|
"""Returns true if the person may be alive."""
|
||||||
if person.death_handle:
|
if person.death_handle:
|
||||||
return False
|
return False
|
||||||
@ -453,7 +453,7 @@ def probably_alive(person,db):
|
|||||||
if person.birth_handle:
|
if person.birth_handle:
|
||||||
birth = db.get_event_from_handle(person.birth_handle)
|
birth = db.get_event_from_handle(person.birth_handle)
|
||||||
if birth.get_date_object().get_start_date() != Date.EMPTY:
|
if birth.get_date_object().get_start_date() != Date.EMPTY:
|
||||||
return not_too_old(birth.get_date_object())
|
return not_too_old(birth.get_date_object(),current_year)
|
||||||
|
|
||||||
# Neither birth nor death events are available. Try looking
|
# Neither birth nor death events are available. Try looking
|
||||||
# for descendants that were born more than a lifespan ago.
|
# for descendants that were born more than a lifespan ago.
|
||||||
@ -475,14 +475,14 @@ def probably_alive(person,db):
|
|||||||
val = d.get_start_date()
|
val = d.get_start_date()
|
||||||
val = d.get_year() - years
|
val = d.get_year() - years
|
||||||
d.set_year(val)
|
d.set_year(val)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d,current_year):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if child.death_handle:
|
if child.death_handle:
|
||||||
child_death = db.get_event_from_handle(child.death_handle)
|
child_death = db.get_event_from_handle(child.death_handle)
|
||||||
dobj = child_death.get_date_object()
|
dobj = child_death.get_date_object()
|
||||||
if dobj.get_start_date() != Date.EMPTY:
|
if dobj.get_start_date() != Date.EMPTY:
|
||||||
if not not_too_old (dobj):
|
if not not_too_old (dobj,current_year):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if descendants_too_old (child, years + min_generation):
|
if descendants_too_old (child, years + min_generation):
|
||||||
@ -492,9 +492,10 @@ def probably_alive(person,db):
|
|||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def not_too_old(date):
|
def not_too_old(date,current_year=None):
|
||||||
time_struct = time.localtime(time.time())
|
if not current_year:
|
||||||
current_year = time_struct[0]
|
time_struct = time.localtime(time.time())
|
||||||
|
current_year = time_struct[0]
|
||||||
year = date.get_year()
|
year = date.get_year()
|
||||||
return not( year != 0 and current_year - year > 110)
|
return not( year != 0 and current_year - year > 110)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user