Consolidate all definitions of probably_alive() into one.
svn: r623
This commit is contained in:
parent
751a00162e
commit
a81fd54c10
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
from re import IGNORECASE, compile
|
from re import IGNORECASE, compile
|
||||||
import string
|
import string
|
||||||
|
import time
|
||||||
|
|
||||||
from Calendar import *
|
from Calendar import *
|
||||||
from intl import gettext
|
from intl import gettext
|
||||||
@ -962,6 +963,18 @@ class SingleDate:
|
|||||||
self.month = m-1
|
self.month = m-1
|
||||||
self.day = d
|
self.day = d
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
def not_too_old(date):
|
||||||
|
time_struct = time.localtime(time.time())
|
||||||
|
current_year = time_struct[0]
|
||||||
|
if date.year != UNDEF and current_year - date.year > 110:
|
||||||
|
return 0
|
||||||
|
return 1
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -24,7 +24,7 @@ __author__ = "Don Allingham"
|
|||||||
|
|
||||||
|
|
||||||
from re import compile
|
from re import compile
|
||||||
from Date import Date, compare_dates
|
from Date import Date, compare_dates, not_too_old
|
||||||
from string import strip
|
from string import strip
|
||||||
|
|
||||||
CONF_VERY_HIGH = 4
|
CONF_VERY_HIGH = 4
|
||||||
@ -1105,6 +1105,14 @@ class Person:
|
|||||||
|
|
||||||
def getLdsSeal(self):
|
def getLdsSeal(self):
|
||||||
return self.lds_seal
|
return self.lds_seal
|
||||||
|
|
||||||
|
def probablyAlive(self):
|
||||||
|
if self.death.getDate() != "":
|
||||||
|
return 0
|
||||||
|
if self.birth.getDate() != "":
|
||||||
|
return not_too_old(self.birth.getDateObj().get_start_date())
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
class Event(DataObj):
|
class Event(DataObj):
|
||||||
"""Event record, recording the event type, description, place, and date
|
"""Event record, recording the event type, description, place, and date
|
||||||
|
@ -92,7 +92,7 @@ class IndividualPage:
|
|||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.list = map
|
self.list = map
|
||||||
self.private = private
|
self.private = private
|
||||||
self.alive = probably_alive(person) and restrict
|
self.alive = person.probablyAlive() and restrict
|
||||||
self.photos = (photos == 2) or (photos == 1 and not self.alive)
|
self.photos = (photos == 2) or (photos == 1 and not self.alive)
|
||||||
self.usecomments = not uc
|
self.usecomments = not uc
|
||||||
self.dir = dir_name
|
self.dir = dir_name
|
||||||
@ -671,29 +671,6 @@ filter_map = {
|
|||||||
_("Entire database") : entire_db_filter
|
_("Entire database") : entire_db_filter
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def probably_alive(person):
|
|
||||||
|
|
||||||
if person == None:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
death = person.getDeath()
|
|
||||||
birth = person.getBirth()
|
|
||||||
|
|
||||||
if death.getDate() != "":
|
|
||||||
return 0
|
|
||||||
if birth.getDate() != "":
|
|
||||||
year = birth.getDateObj().get_start_date()
|
|
||||||
time_struct = time.localtime(time.time())
|
|
||||||
current_year = time_struct[0]
|
|
||||||
if year.getYearValid() and current_year - year.getYear() > 110:
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -571,18 +571,19 @@ class GedcomWriter:
|
|||||||
nump = float(len(self.flist))
|
nump = float(len(self.flist))
|
||||||
index = 0.0
|
index = 0.0
|
||||||
for family in self.flist:
|
for family in self.flist:
|
||||||
|
father_alive = mother_alive = 0
|
||||||
self.g.write("0 @%s@ FAM\n" % self.fid(family.getId()))
|
self.g.write("0 @%s@ FAM\n" % self.fid(family.getId()))
|
||||||
person = family.getFather()
|
person = family.getFather()
|
||||||
if person != None:
|
if person != None:
|
||||||
self.g.write("1 HUSB @%s@\n" % self.pid(person.getId()))
|
self.g.write("1 HUSB @%s@\n" % self.pid(person.getId()))
|
||||||
|
father_alive = person.probablyAlive()
|
||||||
|
|
||||||
person = family.getMother()
|
person = family.getMother()
|
||||||
if person != None:
|
if person != None:
|
||||||
self.g.write("1 WIFE @%s@\n" % self.pid(person.getId()))
|
self.g.write("1 WIFE @%s@\n" % self.pid(person.getId()))
|
||||||
|
mother_alive = person.probablyAlive()
|
||||||
|
|
||||||
father = family.getFather()
|
if not self.restrict or ( not father_alive and not mother_alive ):
|
||||||
mother = family.getMother()
|
|
||||||
if not self.probably_alive(father) or not self.probably_alive(mother):
|
|
||||||
self.write_ord("SLGS",family.getLdsSeal(),1)
|
self.write_ord("SLGS",family.getLdsSeal(),1)
|
||||||
|
|
||||||
for event in family.getEventList():
|
for event in family.getEventList():
|
||||||
@ -665,7 +666,7 @@ class GedcomWriter:
|
|||||||
elif person.getGender() == Person.female:
|
elif person.getGender() == Person.female:
|
||||||
self.g.write("1 SEX F\n")
|
self.g.write("1 SEX F\n")
|
||||||
|
|
||||||
if not self.probably_alive(person):
|
if not self.restrict or not person.probablyAlive():
|
||||||
|
|
||||||
birth = person.getBirth()
|
birth = person.getBirth()
|
||||||
if not (self.private and birth.getPrivacy()):
|
if not (self.private and birth.getPrivacy()):
|
||||||
@ -980,25 +981,6 @@ class GedcomWriter:
|
|||||||
if ref.getComments() != "":
|
if ref.getComments() != "":
|
||||||
self.write_long_text("NOTE",level+1,ref.getComments())
|
self.write_long_text("NOTE",level+1,ref.getComments())
|
||||||
|
|
||||||
def probably_alive(self,person):
|
|
||||||
if person == None:
|
|
||||||
return 1
|
|
||||||
if self.restrict == 0:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
death = person.getDeath()
|
|
||||||
birth = person.getBirth()
|
|
||||||
|
|
||||||
if death.getDate() != "":
|
|
||||||
return 0
|
|
||||||
if birth.getDate() != "":
|
|
||||||
year = birth.getDateObj()
|
|
||||||
time_struct = time.localtime(time.time())
|
|
||||||
current_year = time_struct[0]
|
|
||||||
if year.getYearValid() and current_year - year.getYear() > 110:
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def fid(self,id):
|
def fid(self,id):
|
||||||
if self.fidmap.has_key(id):
|
if self.fidmap.has_key(id):
|
||||||
return self.fidmap[id]
|
return self.fidmap[id]
|
||||||
|
@ -260,32 +260,6 @@ def sortByName(first,second):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def probably_alive(person):
|
|
||||||
|
|
||||||
if person == None:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if restrict == 0:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
death = person.getDeath()
|
|
||||||
birth = person.getBirth()
|
|
||||||
|
|
||||||
if death.getDate() != "":
|
|
||||||
return 0
|
|
||||||
if birth.getDate() != "":
|
|
||||||
year = birth.getDateObj()
|
|
||||||
time_struct = time.localtime(time.time())
|
|
||||||
current_year = time_struct[0]
|
|
||||||
if year.getYearValid() and current_year - year.getYear() > 110:
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user