new reference count filters
svn: r8892
This commit is contained in:
		
							
								
								
									
										35
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,3 +1,38 @@
 | 
			
		||||
2007-08-30  Stephane Charette  <stephanecharette@gmail.com>
 | 
			
		||||
	* src/FilterEditor/_EditRule.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Repository/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Repository/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Repository/_HasReferenceCountOf.py: new reference
 | 
			
		||||
	count filters
 | 
			
		||||
	* src/Filters/Rules/Event/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Event/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Event/_HasReferenceCountOf.py: new reference count
 | 
			
		||||
	filters
 | 
			
		||||
	* src/Filters/Rules/Family/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Family/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Family/_HasReferenceCountOf.py: new reference count
 | 
			
		||||
	filters
 | 
			
		||||
	* src/Filters/Rules/Place/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Place/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Place/_HasReferenceCountOf.py: new reference count
 | 
			
		||||
	filters
 | 
			
		||||
	* src/Filters/Rules/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/_HasReferenceCountBase.py: new reference count
 | 
			
		||||
	filters
 | 
			
		||||
	* src/Filters/Rules/Source/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Source/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Source/_HasReferenceCountOf.py: new reference count
 | 
			
		||||
	filters
 | 
			
		||||
	* src/Filters/Rules/Note/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Note/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/Note/_HasReferenceCountOf.py: new reference count
 | 
			
		||||
	filters
 | 
			
		||||
	* src/Filters/Rules/MediaObject/__init__.py: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/MediaObject/Makefile.am: new reference count filters
 | 
			
		||||
	* src/Filters/Rules/MediaObject/_HasReferenceCountOf.py: new reference
 | 
			
		||||
	count filters
 | 
			
		||||
	* po/POTFILES.in: new reference count filters
 | 
			
		||||
 | 
			
		||||
2007-08-29  Don Allingham  <don@gramps-project.org>
 | 
			
		||||
	* src/RelLib/_Source.py: fix fast unserialize()
 | 
			
		||||
	* src/RelLib/_Place.py: fix fast unserialize()
 | 
			
		||||
 
 | 
			
		||||
@@ -459,6 +459,7 @@ src/Filters/Rules/_HasEventBase.py
 | 
			
		||||
src/Filters/Rules/_HasGrampsId.py
 | 
			
		||||
src/Filters/Rules/_HasNoteRegexBase.py
 | 
			
		||||
src/Filters/Rules/_HasNoteSubstrBase.py
 | 
			
		||||
src/Filters/Rules/_HasReferenceCountBase.py
 | 
			
		||||
src/Filters/Rules/_HasTextMatchingRegexpOf.py
 | 
			
		||||
src/Filters/Rules/_HasTextMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/__init__.py
 | 
			
		||||
@@ -542,6 +543,7 @@ src/Filters/Rules/Family/_HasEvent.py
 | 
			
		||||
src/Filters/Rules/Family/_HasIdOf.py
 | 
			
		||||
src/Filters/Rules/Family/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Family/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Family/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/Family/_HasRelType.py
 | 
			
		||||
src/Filters/Rules/Family/_RegExpIdOf.py
 | 
			
		||||
src/Filters/Rules/Family/_MatchesFilter.py
 | 
			
		||||
@@ -564,6 +566,7 @@ src/Filters/Rules/Family/_HasMarkerOf.py
 | 
			
		||||
src/Filters/Rules/Event/_MatchesFilter.py
 | 
			
		||||
src/Filters/Rules/Event/_EventPrivate.py
 | 
			
		||||
src/Filters/Rules/Event/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Event/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/Event/_RegExpIdOf.py
 | 
			
		||||
src/Filters/Rules/Event/_AllEvents.py
 | 
			
		||||
src/Filters/Rules/Event/_HasIdOf.py
 | 
			
		||||
@@ -580,6 +583,7 @@ src/Filters/Rules/Place/_HasNoLatOrLon.py
 | 
			
		||||
src/Filters/Rules/Place/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Place/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Place/_HasPlace.py
 | 
			
		||||
src/Filters/Rules/Place/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/Place/_InLatLonNeighborhood.py
 | 
			
		||||
src/Filters/Rules/Place/_MatchesFilter.py
 | 
			
		||||
src/Filters/Rules/Place/_MatchesEventFilter.py
 | 
			
		||||
@@ -591,6 +595,7 @@ src/Filters/Rules/Place/__init__.py
 | 
			
		||||
src/Filters/Rules/Source/_MatchesFilter.py
 | 
			
		||||
src/Filters/Rules/Source/_SourcePrivate.py
 | 
			
		||||
src/Filters/Rules/Source/_RegExpIdOf.py
 | 
			
		||||
src/Filters/Rules/Source/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/Source/_HasSource.py
 | 
			
		||||
src/Filters/Rules/Source/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Source/_AllSources.py
 | 
			
		||||
@@ -604,6 +609,7 @@ src/Filters/Rules/MediaObject/_HasIdOf.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_HasMedia.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_MatchesFilter.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_MediaPrivate.py
 | 
			
		||||
src/Filters/Rules/MediaObject/_RegExpIdOf.py
 | 
			
		||||
@@ -614,6 +620,7 @@ src/Filters/Rules/Repository/_AllRepos.py
 | 
			
		||||
src/Filters/Rules/Repository/_HasIdOf.py
 | 
			
		||||
src/Filters/Rules/Repository/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Repository/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Repository/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/Repository/_HasRepo.py
 | 
			
		||||
src/Filters/Rules/Repository/_MatchesFilter.py
 | 
			
		||||
src/Filters/Rules/Repository/_RegExpIdOf.py
 | 
			
		||||
@@ -627,6 +634,7 @@ src/Filters/Rules/Note/_HasMarkerOf.py
 | 
			
		||||
src/Filters/Rules/Note/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Note/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Note/_HasNote.py
 | 
			
		||||
src/Filters/Rules/Note/_HasReferenceCountOf.py
 | 
			
		||||
src/Filters/Rules/Note/_MatchesFilter.py
 | 
			
		||||
src/Filters/Rules/Note/_RegExpIdOf.py
 | 
			
		||||
src/Filters/Rules/Note/_NotePrivate.py
 | 
			
		||||
 
 | 
			
		||||
@@ -166,6 +166,38 @@ class MyFilters(gtk.ComboBox):
 | 
			
		||||
        if val in self.flist:
 | 
			
		||||
            self.set_active(self.flist.index(val))
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# MyLesserEqualGreater - Combo box to allow selection of "<", "=", or ">"
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class MyLesserEqualGreater(gtk.ComboBox):
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        gtk.ComboBox.__init__(self)
 | 
			
		||||
        store = gtk.ListStore(str)
 | 
			
		||||
        self.set_model(store)
 | 
			
		||||
        cell = gtk.CellRendererText()
 | 
			
		||||
        self.pack_start(cell,True)
 | 
			
		||||
        self.add_attribute(cell,'text',0)
 | 
			
		||||
        self.clist = [_('lesser than'), _('equal to'), _('greater than')]
 | 
			
		||||
        for name in self.clist:
 | 
			
		||||
            store.append(row=[name])
 | 
			
		||||
        self.set_active(0)
 | 
			
		||||
        self.show()
 | 
			
		||||
 | 
			
		||||
    def get_text(self):
 | 
			
		||||
        active = self.get_active()
 | 
			
		||||
        if active < 0:
 | 
			
		||||
            return _('equal to')
 | 
			
		||||
        return self.clist[active]
 | 
			
		||||
 | 
			
		||||
    def set_text(self,val):
 | 
			
		||||
        if val in self.clist:
 | 
			
		||||
            self.set_active(self.clist.index(val))
 | 
			
		||||
        else:
 | 
			
		||||
            self.set_active(self.clist.index(_('equal to')))
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# MySource - Combo box with list of sources with a standard interface
 | 
			
		||||
@@ -424,6 +456,10 @@ class EditRule(ManagedWindow.ManagedWindow):
 | 
			
		||||
                l.show()
 | 
			
		||||
                if v == _('Place:'):
 | 
			
		||||
                    t = MyPlaces([])
 | 
			
		||||
                elif v == _('Reference count:'):
 | 
			
		||||
                    t = MyInteger(0, 999)
 | 
			
		||||
                elif v == _('Reference count must be:'):
 | 
			
		||||
                    t = MyLesserEqualGreater()
 | 
			
		||||
                elif v == _('Number of generations:'):
 | 
			
		||||
                    t = MyInteger(1,32)
 | 
			
		||||
                elif v == _('ID:'):
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasMarkerOf.py\
 | 
			
		||||
	_HasType.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_MatchesPersonFilter.py\
 | 
			
		||||
	__init__.py
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/Event/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/Event/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Events with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Events with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Events with a reference count of <count>')
 | 
			
		||||
    description = _("Matches events with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -36,6 +36,7 @@ from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _EventPrivate import EventPrivate
 | 
			
		||||
from _MatchesFilter import MatchesFilter
 | 
			
		||||
from _MatchesPersonFilter import MatchesPersonFilter
 | 
			
		||||
@@ -49,6 +50,7 @@ editor_rule_list = [
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    EventPrivate,
 | 
			
		||||
    MatchesFilter,
 | 
			
		||||
    MatchesPersonFilter,
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasIdOf.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasNoteRegexp.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_HasRelType.py\
 | 
			
		||||
	__init__.py\
 | 
			
		||||
	_RegExpIdOf.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/Family/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/Family/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Family objects with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Family objects with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Family objects with a reference count of <count>')
 | 
			
		||||
    description = _("Matches family objects with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -39,6 +39,7 @@ from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _FamilyPrivate import FamilyPrivate
 | 
			
		||||
from _HasAttribute import HasAttribute
 | 
			
		||||
from _HasEvent import HasEvent
 | 
			
		||||
@@ -58,6 +59,7 @@ editor_rule_list = [
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    FamilyPrivate,
 | 
			
		||||
    HasEvent,
 | 
			
		||||
    HasAttribute,
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasGrampsId.py\
 | 
			
		||||
	_HasNoteRegexBase.py\
 | 
			
		||||
	_HasNoteSubstrBase.py\
 | 
			
		||||
	_HasReferenceCountBase.py \
 | 
			
		||||
	_HasTextMatchingRegexpOf.py\
 | 
			
		||||
	_HasTextMatchingSubstringOf.py\
 | 
			
		||||
	__init__.py\
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasMedia.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasNoteRegexp.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_MatchesFilter.py\
 | 
			
		||||
	_MediaPrivate.py\
 | 
			
		||||
	_RegExpIdOf.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/MediaObject/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/MediaObject/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Media objects with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Media objects with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Media objects with a reference count of <count>')
 | 
			
		||||
    description = _("Matches media objects with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -31,6 +31,7 @@ from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _MediaPrivate import MediaPrivate
 | 
			
		||||
from _MatchesFilter import MatchesFilter
 | 
			
		||||
from _HasMedia import HasMedia
 | 
			
		||||
@@ -41,6 +42,7 @@ editor_rule_list = [
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    MediaPrivate,
 | 
			
		||||
    MatchesFilter,
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasNoteRegexp.py\
 | 
			
		||||
	_HasNote.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_MatchesFilter.py\
 | 
			
		||||
	_RegExpIdOf.py\
 | 
			
		||||
	_NotePrivate.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/Note/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/Note/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Notes with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Notes with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Notes with a reference count of <count>')
 | 
			
		||||
    description = _("Matches notes with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -33,6 +33,7 @@ from _HasMarkerOf import HasMarkerOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _NotePrivate import NotePrivate
 | 
			
		||||
from _MatchesFilter import MatchesFilter
 | 
			
		||||
from _HasNote import HasNote
 | 
			
		||||
@@ -45,6 +46,7 @@ editor_rule_list = [
 | 
			
		||||
    HasNote,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    NotePrivate,
 | 
			
		||||
    MatchesFilter,
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasNoteRegexp.py\
 | 
			
		||||
	_HasPlace.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_MatchesFilter.py\
 | 
			
		||||
	_MatchesEventFilter.py\
 | 
			
		||||
	_PlacePrivate.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/Place/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/Place/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Place objects with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Place objects with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Place objects with a reference count of <count>')
 | 
			
		||||
    description = _("Matches place objects with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -31,6 +31,7 @@ from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _PlacePrivate import PlacePrivate
 | 
			
		||||
from _MatchesFilter import MatchesFilter
 | 
			
		||||
from _HasPlace import HasPlace
 | 
			
		||||
@@ -44,6 +45,7 @@ editor_rule_list = [
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    PlacePrivate,
 | 
			
		||||
    MatchesFilter,
 | 
			
		||||
    HasPlace,
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_HasIdOf.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasNoteRegexp.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_HasRepo.py\
 | 
			
		||||
	_MatchesFilter.py\
 | 
			
		||||
	_RegExpIdOf.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/Repository/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/Repository/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Repositories with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Repositories with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Repositories with a reference count of <count>')
 | 
			
		||||
    description = _("Matches repositories with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -31,6 +31,7 @@ from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _RepoPrivate import RepoPrivate
 | 
			
		||||
from _MatchesFilter import MatchesFilter
 | 
			
		||||
from _HasRepo import HasRepo
 | 
			
		||||
@@ -41,6 +42,7 @@ editor_rule_list = [
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    RepoPrivate,
 | 
			
		||||
    MatchesFilter,
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_SourcePrivate.py\
 | 
			
		||||
	_RegExpIdOf.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasReferenceCountOf.py\
 | 
			
		||||
	_AllSources.py\
 | 
			
		||||
	_HasIdOf.py\
 | 
			
		||||
	_HasSource.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/Filters/Rules/Source/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/Filters/Rules/Source/_HasReferenceCountOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._HasReferenceCountBase import HasReferenceCountBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Source objects with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountOf(HasReferenceCountBase):
 | 
			
		||||
    """Source objects with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    name        = _('Source objects with a reference count of <count>')
 | 
			
		||||
    description = _("Matches source objects with a certain reference count")
 | 
			
		||||
 | 
			
		||||
@@ -31,6 +31,7 @@ from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
from _HasReferenceCountOf import HasReferenceCountOf
 | 
			
		||||
from _SourcePrivate import SourcePrivate
 | 
			
		||||
from _MatchesFilter import MatchesFilter
 | 
			
		||||
from _HasSource import HasSource
 | 
			
		||||
@@ -41,6 +42,7 @@ editor_rule_list = [
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
    HasReferenceCountOf,
 | 
			
		||||
    SourcePrivate,
 | 
			
		||||
    MatchesFilter,
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										61
									
								
								src/Filters/Rules/_HasReferenceCountBase.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/Filters/Rules/_HasReferenceCountBase.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007  Stephane Charette
 | 
			
		||||
#
 | 
			
		||||
# 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._Rule import Rule
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
# "Objects with a certain reference count"
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasReferenceCountBase(Rule):
 | 
			
		||||
    """Objects with a reference count of <count>"""
 | 
			
		||||
 | 
			
		||||
    labels      = [ _('Reference count must be:'), _('Reference count:')]
 | 
			
		||||
    name        = _('Objects with a reference count of <count>')
 | 
			
		||||
    description = _("Matches objects with a certain reference count")
 | 
			
		||||
    category    = _('General filters')
 | 
			
		||||
 | 
			
		||||
    def apply(self,db,object):
 | 
			
		||||
        handle = object.get_handle()
 | 
			
		||||
        count = 0
 | 
			
		||||
        for item in db.find_backlink_handles(handle):
 | 
			
		||||
            count += 1
 | 
			
		||||
 | 
			
		||||
        value = int(self.list[1])
 | 
			
		||||
 | 
			
		||||
        if self.list[0] == _('lesser than'):
 | 
			
		||||
            return count < value
 | 
			
		||||
        elif self.list[0] == _('greater than'):
 | 
			
		||||
            return count > value
 | 
			
		||||
        return count == value
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user