* src/GenericFilter.py (PersonWithIncompleteEvent,

FamilyWithIncompleteEvent, ProbablyAlive,PeoplePrivate):
Add filter rules.
* src/gramps_main.py (init_filters): Add new filters to the menu.


svn: r4159
This commit is contained in:
Martin Hawlisch 2005-03-11 20:53:53 +00:00
parent 1869866af9
commit 1901e63677
3 changed files with 147 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-03-11 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/GenericFilter.py (PersonWithIncompleteEvent,
FamilyWithIncompleteEvent, ProbablyAlive,PeoplePrivate):
Add filter rules.
* src/gramps_main.py (init_filters): Add new filters to the menu.
2005-03-10 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/GenericFilter.py (IsBookmarked,IncompleteNames,
HaveAltFamilies,HavePhotos,HaveChildren,NeverMarried,

View File

@ -58,6 +58,7 @@ import DateHandler
import NameDisplay
from TransTable import TransTable
from Utils import for_each_ancestor
from Utils import probably_alive
#-------------------------------------------------------------------------
#
@ -1674,6 +1675,119 @@ class NoBirthdate(Rule):
return 1
return 0
#-------------------------------------------------------------------------
# "People with incomplete events"
#-------------------------------------------------------------------------
class PersonWithIncompleteEvent(Rule):
"""People with incomplete events"""
labels = []
def name(self):
return 'People with incomplete events'
def description(self):
return _("Matches persons with missing date or place in an event")
def category(self):
return _('Event filters')
def apply(self,db,p_id):
p = db.get_person_from_handle(p_id)
for event_handle in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]:
event = db.get_event_from_handle(event_handle)
if event:
if not event.get_place_handle():
return 1
if not event.get_date_object():
return 1
return 0
#-------------------------------------------------------------------------
# "Families with incomplete events"
#-------------------------------------------------------------------------
class FamilyWithIncompleteEvent(Rule):
"""Families with incomplete events"""
labels = []
def name(self):
return 'Families with incomplete events'
def description(self):
return _("Matches persons with missing date or place in an event of the family")
def category(self):
return _('Event filters')
def apply(self,db,p_id):
p = db.get_person_from_handle(p_id)
for family_handle in p.get_family_handle_list():
family = db.get_family_from_handle(family_handle)
for event_handle in family.get_event_list():
event = db.get_event_from_handle(event_handle)
if event:
if not event.get_place_handle():
return 1
if not event.get_date_object():
return 1
return 0
#-------------------------------------------------------------------------
# "People probably alive"
#-------------------------------------------------------------------------
class ProbablyAlive(Rule):
"""People probably alive"""
labels = []
def name(self):
return 'People probably alive'
def description(self):
return _("Matches persons without indications of death that are not too old")
def category(self):
return _('General filters')
def apply(self,db,p_id):
p = db.get_person_from_handle(p_id)
return probably_alive(p,db)
#-------------------------------------------------------------------------
# "People marked private"
#-------------------------------------------------------------------------
class PeoplePrivate(Rule):
"""People marked private"""
labels = []
def name(self):
return 'People marked private'
def description(self):
return _("Matches persons that are indicated as private")
def category(self):
return _('General filters')
def apply(self,db,p_id):
p = db.get_person_from_handle(p_id)
return p.get_privacy()
#-------------------------------------------------------------------------
#
# GenericFilter
@ -1853,8 +1967,11 @@ tasks = {
unicode(_("People with no marriage records")) : NeverMarried,
unicode(_("People with multiple marriage records")): MultipleMarriages,
unicode(_("People without a birth date")) : NoBirthdate,
}
unicode(_("People with incomplete events")) : PersonWithIncompleteEvent,
unicode(_("Families with incomplete events")) : FamilyWithIncompleteEvent,
unicode(_("People probably alive")) : ProbablyAlive,
unicode(_("People marked private")) : PeoplePrivate,
}
#-------------------------------------------------------------------------
#

View File

@ -912,14 +912,34 @@ class Gramps:
all.add_rule(GenericFilter.NeverMarried([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("People with multiple marriage records"))
all.add_rule(GenericFilter.MultipleMarriages([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("People without a birth date"))
all.add_rule(GenericFilter.NoBirthdate([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("People with multiple marriage records"))
all.add_rule(GenericFilter.MultipleMarriages([]))
all.set_name(_("People with incomplete events"))
all.add_rule(GenericFilter.PersonWithIncompleteEvent([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("Families with incomplete events"))
all.add_rule(GenericFilter.FamilyWithIncompleteEvent([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("People probably alive"))
all.add_rule(GenericFilter.ProbablyAlive([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("People marked private"))
all.add_rule(GenericFilter.PeoplePrivate([]))
filter_list.append(all)
self.filter_model = GenericFilter.FilterStore(filter_list)