* src/Filters/Rules/Event/_MatchesSourceFilter.py: new filter

* src/Filters/Rules/Event/__init__.py: load new filter
	* src/Filters/Rules/Event/Makefile.am: distribute
	* src/Filters/Rules/Person/_MatchesEventFilter.py: new filter
	* src/Filters/Rules/Person/__init__.py: load new filter
	* src/Filters/Rules/Person/Makefile.am: distribute
	* po/POTFILES.in: translate new filters
	This is issue #1249

2007-10-12 Benny Malengier <benny.malengier@gramps-project.org> 


svn: r9160
This commit is contained in:
Benny Malengier 2007-10-12 11:26:28 +00:00
parent 1add2aa37b
commit 5495c3f705
8 changed files with 159 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2007-10-12 Benny Malengier <benny.malengier@gramps-project.org>
* src/Filters/Rules/Event/_MatchesSourceFilter.py: new filter
* src/Filters/Rules/Event/__init__.py: load new filter
* src/Filters/Rules/Event/Makefile.am: distribute
* src/Filters/Rules/Person/_MatchesEventFilter.py: new filter
* src/Filters/Rules/Person/__init__.py: load new filter
* src/Filters/Rules/Person/Makefile.am: distribute
* po/POTFILES.in: translate new filters
This is issue #1249
2007-10-12 Benny Malengier <benny.malengier@gramps-project.org> 2007-10-12 Benny Malengier <benny.malengier@gramps-project.org>
* src/gen/db/dbdir.py: do name group change from GrampsBSDDB to dbdir. * src/gen/db/dbdir.py: do name group change from GrampsBSDDB to dbdir.

View File

@ -506,6 +506,7 @@ src/Filters/Rules/Person/_IsParentOfFilterMatch.py
src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py
src/Filters/Rules/Person/_IsSpouseOfFilterMatch.py src/Filters/Rules/Person/_IsSpouseOfFilterMatch.py
src/Filters/Rules/Person/_IsWitness.py src/Filters/Rules/Person/_IsWitness.py
src/Filters/Rules/Person/_MatchesEventFilter.py
src/Filters/Rules/Person/_MatchesFilter.py src/Filters/Rules/Person/_MatchesFilter.py
src/Filters/Rules/Person/_MatchIdOf.py src/Filters/Rules/Person/_MatchIdOf.py
src/Filters/Rules/Person/_MultipleMarriages.py src/Filters/Rules/Person/_MultipleMarriages.py
@ -562,6 +563,7 @@ src/Filters/Rules/Event/_HasMarkerOf.py
src/Filters/Rules/Event/_HasType.py src/Filters/Rules/Event/_HasType.py
src/Filters/Rules/Event/_HasNoteMatchingSubstringOf.py src/Filters/Rules/Event/_HasNoteMatchingSubstringOf.py
src/Filters/Rules/Event/_MatchesPersonFilter.py src/Filters/Rules/Event/_MatchesPersonFilter.py
src/Filters/Rules/Event/_MatchesSourceFilter.py
src/Filters/Rules/Event/__init__.py src/Filters/Rules/Event/__init__.py
# Filters.Rules.Place package # Filters.Rules.Place package

View File

@ -14,6 +14,7 @@ pkgdata_PYTHON = \
_HasNoteMatchingSubstringOf.py\ _HasNoteMatchingSubstringOf.py\
_HasReferenceCountOf.py\ _HasReferenceCountOf.py\
_MatchesPersonFilter.py\ _MatchesPersonFilter.py\
_MatchesSourceFilter.py\
__init__.py __init__.py
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Event pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Event

View File

@ -0,0 +1,69 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: _MatchesFilter.py 6932 2006-06-21 16:30:35Z dallingham $
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Filters
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
#-------------------------------------------------------------------------
#
# MatchesFilter
#
#-------------------------------------------------------------------------
class MatchesSourceFilter(MatchesFilterBase):
"""
Rule that checks against another filter.
"""
labels = [_('Source filter name:')]
name = _('Events with source matching the <source filter>')
description = _("Matches events with sources that match the "
"specified source filter name")
category = _('General filters')
# we want to have this filter show source filters
namespace = 'Source'
def prepare(self, db):
MatchesFilterBase.prepare(self, db)
self.MSF_filt = self.find_filter()
def apply(self, db, event):
if self.MSF_filt is None :
return False
sourcelist = [x.ref for x in event.get_source_references()]
for sourcehandle in sourcelist:
#check if source in source filter
if self.MSF_filt.check(db, sourcehandle):
return True
return False

View File

@ -40,6 +40,7 @@ from _HasReferenceCountOf import HasReferenceCountOf
from _EventPrivate import EventPrivate from _EventPrivate import EventPrivate
from _MatchesFilter import MatchesFilter from _MatchesFilter import MatchesFilter
from _MatchesPersonFilter import MatchesPersonFilter from _MatchesPersonFilter import MatchesPersonFilter
from _MatchesSourceFilter import MatchesSourceFilter
editor_rule_list = [ editor_rule_list = [
AllEvents, AllEvents,
@ -54,4 +55,5 @@ editor_rule_list = [
EventPrivate, EventPrivate,
MatchesFilter, MatchesFilter,
MatchesPersonFilter, MatchesPersonFilter,
MatchesSourceFilter,
] ]

View File

@ -49,6 +49,7 @@ pkgdata_PYTHON = \
_IsSpouseOfFilterMatch.py \ _IsSpouseOfFilterMatch.py \
_IsWitness.py \ _IsWitness.py \
_MatchesFilter.py \ _MatchesFilter.py \
_MatchesEventFilter.py \
_MissingParent.py \ _MissingParent.py \
_MultipleMarriages.py \ _MultipleMarriages.py \
_NeverMarried.py \ _NeverMarried.py \

View File

@ -0,0 +1,72 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: $
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Filters
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
#-------------------------------------------------------------------------
#
# MatchesFilter
#
#-------------------------------------------------------------------------
class MatchesEventFilter(MatchesFilterBase):
"""
Rule that checks against another filter.
This is a base rule for subclassing by specific objects.
Subclasses need to define the namespace class attribute.
"""
labels = [_('Event filter name:')]
name = _('Persons with events matching the <event filter>')
description = _("Matches persons who have events that match a certain"
" event filter")
category = _('General filters')
# we want to have this filter show event filters
namespace = 'Event'
def prepare(self, db):
MatchesFilterBase.prepare(self, db)
self.MEF_filt = self.find_filter()
def apply(self, db, person):
if self.MEF_filt is None :
return False
eventlist = [x.ref for x in person.get_event_ref_list()]
for eventhandle in eventlist:
#check if event in event filter
if self.MEF_filt.check(db, eventhandle):
return True
return False

View File

@ -80,6 +80,7 @@ from _IsSiblingOfFilterMatch import IsSiblingOfFilterMatch
from _IsSpouseOfFilterMatch import IsSpouseOfFilterMatch from _IsSpouseOfFilterMatch import IsSpouseOfFilterMatch
from _IsWitness import IsWitness from _IsWitness import IsWitness
from _MatchesFilter import MatchesFilter from _MatchesFilter import MatchesFilter
from _MatchesEventFilter import MatchesEventFilter
from _MissingParent import MissingParent from _MissingParent import MissingParent
from _MultipleMarriages import MultipleMarriages from _MultipleMarriages import MultipleMarriages
from _NeverMarried import NeverMarried from _NeverMarried import NeverMarried
@ -146,6 +147,7 @@ editor_rule_list = [
HasCommonAncestorWith, HasCommonAncestorWith,
HasCommonAncestorWithFilterMatch, HasCommonAncestorWithFilterMatch,
MatchesFilter, MatchesFilter,
MatchesEventFilter,
MissingParent, MissingParent,
IsChildOfFilterMatch, IsChildOfFilterMatch,
IsParentOfFilterMatch, IsParentOfFilterMatch,