* src/Utils.py (probably_alive): Add some checks to make current year parameter work.
svn: r4315
This commit is contained in:
parent
b0b84ebb1f
commit
f7a5765a44
@ -4,6 +4,8 @@
|
|||||||
(HasSourceOf): get handle only once, removed unused code.
|
(HasSourceOf): get handle only once, removed unused code.
|
||||||
* src/gramps_main.py: Show label for filter input field.
|
* src/gramps_main.py: Show label for filter input field.
|
||||||
|
|
||||||
|
* src/Utils.py (probably_alive): Add some checks to make current year parameter work.
|
||||||
|
|
||||||
2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2005-04-06 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/GenericFilter.py: added a current year parameter to probably alive rule.
|
* src/GenericFilter.py: added a current year parameter to probably alive rule.
|
||||||
* src/Utils.py: added a current year parameter to probably alive function.
|
* src/Utils.py: added a current year parameter to probably alive function.
|
||||||
|
@ -441,6 +441,14 @@ def create_id():
|
|||||||
def probably_alive(person,db,current_year=None):
|
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:
|
||||||
|
if not current_year:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
death = db.get_event_from_handle(person.death_handle)
|
||||||
|
if death.get_date_object().get_start_date() != Date.EMPTY:
|
||||||
|
if death.get_date_object().get_year < current_year:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Look for Cause Of Death, Burial or Cremation events.
|
# Look for Cause Of Death, Burial or Cremation events.
|
||||||
@ -448,6 +456,12 @@ def probably_alive(person,db,current_year=None):
|
|||||||
for ev_handle in person.event_list:
|
for ev_handle in person.event_list:
|
||||||
ev = db.get_event_from_handle(ev_handle)
|
ev = db.get_event_from_handle(ev_handle)
|
||||||
if ev and ev.name in ["Cause Of Death", "Burial", "Cremation"]:
|
if ev and ev.name in ["Cause Of Death", "Burial", "Cremation"]:
|
||||||
|
if not current_year:
|
||||||
|
return False
|
||||||
|
if ev.get_date_object().get_start_date() != Date.EMPTY:
|
||||||
|
if ev.get_date_object().get_year < current_year:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if person.birth_handle:
|
if person.birth_handle:
|
||||||
@ -497,6 +511,8 @@ def not_too_old(date,current_year=None):
|
|||||||
time_struct = time.localtime(time.time())
|
time_struct = time.localtime(time.time())
|
||||||
current_year = time_struct[0]
|
current_year = time_struct[0]
|
||||||
year = date.get_year()
|
year = date.get_year()
|
||||||
|
if year > current_year:
|
||||||
|
return False
|
||||||
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