* 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>
|
2005-06-19 Don Allingham <don@gramps-project.org>
|
||||||
* src/AddSpouse.py: display idle cursor, build better likely filter
|
* src/AddSpouse.py: display idle cursor, build better likely filter
|
||||||
* src/SelectChild.py: display idle cursor
|
* src/SelectChild.py: display idle cursor
|
||||||
|
@ -393,14 +393,19 @@ class LikelyFilter(GenericFilter.Rule):
|
|||||||
|
|
||||||
def prepare(self,db):
|
def prepare(self,db):
|
||||||
person = db.get_person_from_handle(self.list[0])
|
person = db.get_person_from_handle(self.list[0])
|
||||||
birth = db.get_event_from_handle(person.birth_handle)
|
if person.birth_handle:
|
||||||
dateobj = Date.Date(birth.date)
|
birth = db.get_event_from_handle(person.birth_handle)
|
||||||
year = dateobj.get_year()
|
dateobj = Date.Date(birth.date)
|
||||||
dateobj.set_year(year+40)
|
year = dateobj.get_year()
|
||||||
self.lower = dateobj.sortval
|
dateobj.set_year(year+40)
|
||||||
dateobj.set_year(year-40)
|
self.lower = dateobj.sortval
|
||||||
self.upper = dateobj.sortval
|
dateobj.set_year(year-40)
|
||||||
if self.list[0] == RelLib.Person.MALE:
|
self.upper = dateobj.sortval
|
||||||
|
else:
|
||||||
|
self.upper = None
|
||||||
|
self.lower = None
|
||||||
|
|
||||||
|
if person.gender == RelLib.Person.MALE:
|
||||||
self.gender = RelLib.Person.FEMALE
|
self.gender = RelLib.Person.FEMALE
|
||||||
else:
|
else:
|
||||||
self.gender = RelLib.Person.MALE
|
self.gender = RelLib.Person.MALE
|
||||||
@ -409,7 +414,8 @@ class LikelyFilter(GenericFilter.Rule):
|
|||||||
person = db.get_person_from_handle(handle)
|
person = db.get_person_from_handle(handle)
|
||||||
if person.gender != self.gender:
|
if person.gender != self.gender:
|
||||||
return False
|
return False
|
||||||
if not person.birth_handle:
|
if not person.birth_handle or (self.upper == None and
|
||||||
|
self.lower == None):
|
||||||
return True
|
return True
|
||||||
event = db.get_event_from_handle(person.birth_handle)
|
event = db.get_event_from_handle(person.birth_handle)
|
||||||
return (event.date == None or event.date.sortval == 0 or
|
return (event.date == None or event.date.sortval == 0 or
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# 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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -303,20 +303,25 @@ class SelectChild:
|
|||||||
class LikelyFilter(GenericFilter.Rule):
|
class LikelyFilter(GenericFilter.Rule):
|
||||||
|
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
def prepare(self,db):
|
def prepare(self,db):
|
||||||
person = db.get_person_from_handle(self.list[0])
|
person = db.get_person_from_handle(self.list[0])
|
||||||
birth = db.get_event_from_handle(person.birth_handle)
|
if person.birth_handle:
|
||||||
dateobj = Date.Date(birth.date)
|
birth = db.get_event_from_handle(person.birth_handle)
|
||||||
year = dateobj.get_year()
|
dateobj = Date.Date(birth.date)
|
||||||
dateobj.set_year(year+10)
|
year = dateobj.get_year()
|
||||||
self.lower = dateobj.sortval
|
dateobj.set_year(year+10)
|
||||||
dateobj.set_year(year+70)
|
self.lower = dateobj.sortval
|
||||||
self.upper = dateobj.sortval
|
dateobj.set_year(year+70)
|
||||||
|
self.upper = dateobj.sortval
|
||||||
|
else:
|
||||||
|
self.lower = None
|
||||||
|
self.upper = None
|
||||||
|
|
||||||
def apply(self,db,handle):
|
def apply(self,db,handle):
|
||||||
person = db.get_person_from_handle(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
|
return True
|
||||||
event = db.get_event_from_handle(person.birth_handle)
|
event = db.get_event_from_handle(person.birth_handle)
|
||||||
return (event.date == None or event.date.sortval == 0 or
|
return (event.date == None or event.date.sortval == 0 or
|
||||||
|
Loading…
x
Reference in New Issue
Block a user