Add support for filtering on event and media attributes

svn: r10834
This commit is contained in:
Gary Burton 2008-06-28 22:53:36 +00:00
parent c82c8d58dc
commit 445c32f425
7 changed files with 104 additions and 0 deletions

View File

@ -81,6 +81,8 @@ _name2typeclass = {
_('Event type:') : gen.lib.EventType, _('Event type:') : gen.lib.EventType,
_('Personal attribute:') : gen.lib.AttributeType, _('Personal attribute:') : gen.lib.AttributeType,
_('Family attribute:') : gen.lib.AttributeType, _('Family attribute:') : gen.lib.AttributeType,
_('Event attribute:') : gen.lib.AttributeType,
_('Media attribute:') : gen.lib.AttributeType,
_('Relationship type:') : gen.lib.FamilyRelType, _('Relationship type:') : gen.lib.FamilyRelType,
_('Marker type:') : gen.lib.MarkerType, _('Marker type:') : gen.lib.MarkerType,
_('Note type:') : gen.lib.NoteType, _('Note type:') : gen.lib.NoteType,

View File

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

View File

@ -0,0 +1,48 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 Gary Burton
#
# 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
#
#-------------------------------------------------------------------------
from Filters.Rules._HasAttributeBase import HasAttributeBase
#-------------------------------------------------------------------------
#
# HasAttribute
#
#-------------------------------------------------------------------------
class HasAttribute(HasAttributeBase):
"""Rule that checks for an event with a particular event attribute"""
labels = [ _('Event attribute:'), _('Value:') ]
name = _('Events with the attribute <attribute>')
description = _("Matches events with the event attribute "
"of a particular value")

View File

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

View File

@ -11,6 +11,7 @@ pkgdata_PYTHON = \
_HasReferenceCountOf.py\ _HasReferenceCountOf.py\
_MatchesFilter.py\ _MatchesFilter.py\
_MediaPrivate.py\ _MediaPrivate.py\
_HasAttribute.py\
_RegExpIdOf.py\ _RegExpIdOf.py\
__init__.py __init__.py

View File

@ -0,0 +1,48 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 Gary Burton
#
# 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
#
#-------------------------------------------------------------------------
from Filters.Rules._HasAttributeBase import HasAttributeBase
#-------------------------------------------------------------------------
#
# HasAttribute
#
#-------------------------------------------------------------------------
class HasAttribute(HasAttributeBase):
"""Rule that checks for a media object with a particular attribute"""
labels = [ _('Media attribute:'), _('Value:') ]
name = _('Media objects with the attribute <attribute>')
description = _("Matches media objects with the attribute "
"of a particular value")

View File

@ -33,6 +33,7 @@ from _HasReferenceCountOf import HasReferenceCountOf
from _MediaPrivate import MediaPrivate from _MediaPrivate import MediaPrivate
from _MatchesFilter import MatchesFilter from _MatchesFilter import MatchesFilter
from _HasMedia import HasMedia from _HasMedia import HasMedia
from _HasAttribute import HasAttribute
editor_rule_list = [ editor_rule_list = [
AllMedia, AllMedia,
@ -43,4 +44,5 @@ editor_rule_list = [
HasReferenceCountOf, HasReferenceCountOf,
MediaPrivate, MediaPrivate,
MatchesFilter, MatchesFilter,
HasAttribute,
] ]