diff --git a/src/FilterEditor/_EditRule.py b/src/FilterEditor/_EditRule.py index 7ddeb1109..17051f216 100644 --- a/src/FilterEditor/_EditRule.py +++ b/src/FilterEditor/_EditRule.py @@ -81,6 +81,8 @@ _name2typeclass = { _('Event type:') : gen.lib.EventType, _('Personal attribute:') : gen.lib.AttributeType, _('Family attribute:') : gen.lib.AttributeType, + _('Event attribute:') : gen.lib.AttributeType, + _('Media attribute:') : gen.lib.AttributeType, _('Relationship type:') : gen.lib.FamilyRelType, _('Marker type:') : gen.lib.MarkerType, _('Note type:') : gen.lib.NoteType, diff --git a/src/Filters/Rules/Event/Makefile.am b/src/Filters/Rules/Event/Makefile.am index 14e99a0b3..68e859194 100644 --- a/src/Filters/Rules/Event/Makefile.am +++ b/src/Filters/Rules/Event/Makefile.am @@ -15,6 +15,7 @@ pkgdata_PYTHON = \ _HasReferenceCountOf.py\ _MatchesPersonFilter.py\ _MatchesSourceFilter.py\ + _HasAttribute.py\ __init__.py pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Event diff --git a/src/Filters/Rules/Event/_HasAttribute.py b/src/Filters/Rules/Event/_HasAttribute.py new file mode 100644 index 000000000..8ca1e6a00 --- /dev/null +++ b/src/Filters/Rules/Event/_HasAttribute.py @@ -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 ') + description = _("Matches events with the event attribute " + "of a particular value") diff --git a/src/Filters/Rules/Event/__init__.py b/src/Filters/Rules/Event/__init__.py index a38c4381d..069d6998d 100644 --- a/src/Filters/Rules/Event/__init__.py +++ b/src/Filters/Rules/Event/__init__.py @@ -39,6 +39,7 @@ from _EventPrivate import EventPrivate from _MatchesFilter import MatchesFilter from _MatchesPersonFilter import MatchesPersonFilter from _MatchesSourceFilter import MatchesSourceFilter +from _HasAttribute import HasAttribute editor_rule_list = [ AllEvents, @@ -54,4 +55,5 @@ editor_rule_list = [ MatchesFilter, MatchesPersonFilter, MatchesSourceFilter, + HasAttribute, ] diff --git a/src/Filters/Rules/MediaObject/Makefile.am b/src/Filters/Rules/MediaObject/Makefile.am index 9dfdd49b0..4b482ae4d 100644 --- a/src/Filters/Rules/MediaObject/Makefile.am +++ b/src/Filters/Rules/MediaObject/Makefile.am @@ -11,6 +11,7 @@ pkgdata_PYTHON = \ _HasReferenceCountOf.py\ _MatchesFilter.py\ _MediaPrivate.py\ + _HasAttribute.py\ _RegExpIdOf.py\ __init__.py diff --git a/src/Filters/Rules/MediaObject/_HasAttribute.py b/src/Filters/Rules/MediaObject/_HasAttribute.py new file mode 100644 index 000000000..3f5f02fd8 --- /dev/null +++ b/src/Filters/Rules/MediaObject/_HasAttribute.py @@ -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 ') + description = _("Matches media objects with the attribute " + "of a particular value") diff --git a/src/Filters/Rules/MediaObject/__init__.py b/src/Filters/Rules/MediaObject/__init__.py index 020fe5b16..46711c26a 100644 --- a/src/Filters/Rules/MediaObject/__init__.py +++ b/src/Filters/Rules/MediaObject/__init__.py @@ -33,6 +33,7 @@ from _HasReferenceCountOf import HasReferenceCountOf from _MediaPrivate import MediaPrivate from _MatchesFilter import MatchesFilter from _HasMedia import HasMedia +from _HasAttribute import HasAttribute editor_rule_list = [ AllMedia, @@ -43,4 +44,5 @@ editor_rule_list = [ HasReferenceCountOf, MediaPrivate, MatchesFilter, + HasAttribute, ]