* src/SelectChildpy (LikelyFilter.prepare,LikelyFilter.apply):
Handle absent birth of a parent. * src/AddSpouse.py (LikelyFilter.prepare,LikelyFilter.apply): Handle absent birth of a parent; correctly use gender. svn: r4850
This commit is contained in:
parent
eb3331c178
commit
f768299812
@ -1,3 +1,9 @@
|
||||
2005-06-20 Alexander Roitman <shura@gramps-project.org>
|
||||
* src/SelectChildpy (LikelyFilter.prepare,LikelyFilter.apply):
|
||||
Handle absent birth of a parent.
|
||||
* src/AddSpouse.py (LikelyFilter.prepare,LikelyFilter.apply):
|
||||
Handle absent birth of a parent; correctly use gender.
|
||||
|
||||
2005-06-19 Don Allingham <don@gramps-project.org>
|
||||
* src/AddSpouse.py: display idle cursor, build better likely filter
|
||||
* src/SelectChild.py: display idle cursor
|
||||
|
@ -393,14 +393,19 @@ class LikelyFilter(GenericFilter.Rule):
|
||||
|
||||
def prepare(self,db):
|
||||
person = db.get_person_from_handle(self.list[0])
|
||||
birth = db.get_event_from_handle(person.birth_handle)
|
||||
dateobj = Date.Date(birth.date)
|
||||
year = dateobj.get_year()
|
||||
dateobj.set_year(year+40)
|
||||
self.lower = dateobj.sortval
|
||||
dateobj.set_year(year-40)
|
||||
self.upper = dateobj.sortval
|
||||
if self.list[0] == RelLib.Person.MALE:
|
||||
if person.birth_handle:
|
||||
birth = db.get_event_from_handle(person.birth_handle)
|
||||
dateobj = Date.Date(birth.date)
|
||||
year = dateobj.get_year()
|
||||
dateobj.set_year(year+40)
|
||||
self.lower = dateobj.sortval
|
||||
dateobj.set_year(year-40)
|
||||
self.upper = dateobj.sortval
|
||||
else:
|
||||
self.upper = None
|
||||
self.lower = None
|
||||
|
||||
if person.gender == RelLib.Person.MALE:
|
||||
self.gender = RelLib.Person.FEMALE
|
||||
else:
|
||||
self.gender = RelLib.Person.MALE
|
||||
@ -409,7 +414,8 @@ class LikelyFilter(GenericFilter.Rule):
|
||||
person = db.get_person_from_handle(handle)
|
||||
if person.gender != self.gender:
|
||||
return False
|
||||
if not person.birth_handle:
|
||||
if not person.birth_handle or (self.upper == None and
|
||||
self.lower == None):
|
||||
return True
|
||||
event = db.get_event_from_handle(person.birth_handle)
|
||||
return (event.date == None or event.date.sortval == 0 or
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -306,17 +306,22 @@ class LikelyFilter(GenericFilter.Rule):
|
||||
|
||||
def prepare(self,db):
|
||||
person = db.get_person_from_handle(self.list[0])
|
||||
birth = db.get_event_from_handle(person.birth_handle)
|
||||
dateobj = Date.Date(birth.date)
|
||||
year = dateobj.get_year()
|
||||
dateobj.set_year(year+10)
|
||||
self.lower = dateobj.sortval
|
||||
dateobj.set_year(year+70)
|
||||
self.upper = dateobj.sortval
|
||||
if person.birth_handle:
|
||||
birth = db.get_event_from_handle(person.birth_handle)
|
||||
dateobj = Date.Date(birth.date)
|
||||
year = dateobj.get_year()
|
||||
dateobj.set_year(year+10)
|
||||
self.lower = dateobj.sortval
|
||||
dateobj.set_year(year+70)
|
||||
self.upper = dateobj.sortval
|
||||
else:
|
||||
self.lower = None
|
||||
self.upper = None
|
||||
|
||||
def apply(self,db,handle):
|
||||
person = db.get_person_from_handle(handle)
|
||||
if not person.birth_handle:
|
||||
if not person.birth_handle or (self.upper == None and
|
||||
self.lower == None):
|
||||
return True
|
||||
event = db.get_event_from_handle(person.birth_handle)
|
||||
return (event.date == None or event.date.sortval == 0 or
|
||||
|
Loading…
Reference in New Issue
Block a user