Add support for filtering on event and media attributes
svn: r10834
This commit is contained in:
		| @@ -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, | ||||
|   | ||||
| @@ -15,6 +15,7 @@ pkgdata_PYTHON = \ | ||||
| 	_HasReferenceCountOf.py\ | ||||
| 	_MatchesPersonFilter.py\ | ||||
| 	_MatchesSourceFilter.py\ | ||||
| 	_HasAttribute.py\ | ||||
| 	__init__.py | ||||
|  | ||||
| pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Event | ||||
|   | ||||
							
								
								
									
										48
									
								
								src/Filters/Rules/Event/_HasAttribute.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/Filters/Rules/Event/_HasAttribute.py
									
									
									
									
									
										Normal 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") | ||||
| @@ -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, | ||||
| ] | ||||
|   | ||||
| @@ -11,6 +11,7 @@ pkgdata_PYTHON = \ | ||||
| 	_HasReferenceCountOf.py\ | ||||
| 	_MatchesFilter.py\ | ||||
| 	_MediaPrivate.py\ | ||||
| 	_HasAttribute.py\ | ||||
| 	_RegExpIdOf.py\ | ||||
| 	__init__.py | ||||
|  | ||||
|   | ||||
							
								
								
									
										48
									
								
								src/Filters/Rules/MediaObject/_HasAttribute.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/Filters/Rules/MediaObject/_HasAttribute.py
									
									
									
									
									
										Normal 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") | ||||
| @@ -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, | ||||
| ] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user