6003: Not all sourcebase objects have the same source filters
svn: r20270
This commit is contained in:
@@ -454,6 +454,7 @@ src/Filters/Rules/_HasGrampsId.py
|
|||||||
src/Filters/Rules/_HasTextMatchingSubstringOf.py
|
src/Filters/Rules/_HasTextMatchingSubstringOf.py
|
||||||
src/Filters/Rules/_IsPrivate.py
|
src/Filters/Rules/_IsPrivate.py
|
||||||
src/Filters/Rules/_Rule.py
|
src/Filters/Rules/_Rule.py
|
||||||
|
src/Filters/Rules/_HasSourceOfBase.py
|
||||||
|
|
||||||
# Filters.Rules.Person package
|
# Filters.Rules.Person package
|
||||||
src/Filters/Rules/Person/_ChangedSince.py
|
src/Filters/Rules/Person/_ChangedSince.py
|
||||||
@@ -553,6 +554,7 @@ src/Filters/Rules/Family/_HasNoteRegexp.py
|
|||||||
src/Filters/Rules/Family/_HasReferenceCountOf.py
|
src/Filters/Rules/Family/_HasReferenceCountOf.py
|
||||||
src/Filters/Rules/Family/_HasRelType.py
|
src/Filters/Rules/Family/_HasRelType.py
|
||||||
src/Filters/Rules/Family/_HasSourceCount.py
|
src/Filters/Rules/Family/_HasSourceCount.py
|
||||||
|
src/Filters/Rules/Family/_HasSourceOf.py
|
||||||
src/Filters/Rules/Family/_HasTag.py
|
src/Filters/Rules/Family/_HasTag.py
|
||||||
src/Filters/Rules/Family/_IsBookmarked.py
|
src/Filters/Rules/Family/_IsBookmarked.py
|
||||||
src/Filters/Rules/Family/_MatchesFilter.py
|
src/Filters/Rules/Family/_MatchesFilter.py
|
||||||
@@ -604,6 +606,10 @@ src/Filters/Rules/Place/_MatchesFilter.py
|
|||||||
src/Filters/Rules/Place/_MatchesEventFilter.py
|
src/Filters/Rules/Place/_MatchesEventFilter.py
|
||||||
src/Filters/Rules/Place/_PlacePrivate.py
|
src/Filters/Rules/Place/_PlacePrivate.py
|
||||||
src/Filters/Rules/Place/_RegExpIdOf.py
|
src/Filters/Rules/Place/_RegExpIdOf.py
|
||||||
|
src/Filters/Rules/Place/_HasSourceOf.py
|
||||||
|
src/Filters/Rules/Place/_MatchesSourceConfidence.py
|
||||||
|
src/Filters/Rules/Place/_HasSourceCount.py
|
||||||
|
src/Filters/Rules/Place/_HasCitation.py
|
||||||
|
|
||||||
# Filters.Rules.Source package
|
# Filters.Rules.Source package
|
||||||
src/Filters/Rules/Source/_AllSources.py
|
src/Filters/Rules/Source/_AllSources.py
|
||||||
@@ -652,6 +658,10 @@ src/Filters/Rules/MediaObject/_HasTag.py
|
|||||||
src/Filters/Rules/MediaObject/_MatchesFilter.py
|
src/Filters/Rules/MediaObject/_MatchesFilter.py
|
||||||
src/Filters/Rules/MediaObject/_MediaPrivate.py
|
src/Filters/Rules/MediaObject/_MediaPrivate.py
|
||||||
src/Filters/Rules/MediaObject/_RegExpIdOf.py
|
src/Filters/Rules/MediaObject/_RegExpIdOf.py
|
||||||
|
src/Filters/Rules/MediaObject/_HasSourceCount.py
|
||||||
|
src/Filters/Rules/MediaObject/_HasCitation.py
|
||||||
|
src/Filters/Rules/MediaObject/_HasSourceOf.py
|
||||||
|
src/Filters/Rules/MediaObject/_MatchesSourceConfidence.py
|
||||||
|
|
||||||
# Filters.Rules.Repository package
|
# Filters.Rules.Repository package
|
||||||
src/Filters/Rules/Repository/_AllRepos.py
|
src/Filters/Rules/Repository/_AllRepos.py
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pkgpython_PYTHON = \
|
|||||||
_HasReferenceCountOf.py\
|
_HasReferenceCountOf.py\
|
||||||
_HasRelType.py\
|
_HasRelType.py\
|
||||||
_HasSourceCount.py \
|
_HasSourceCount.py \
|
||||||
|
_HasSourceOf.py \
|
||||||
_HasTag.py \
|
_HasTag.py \
|
||||||
__init__.py\
|
__init__.py\
|
||||||
_IsBookmarked.py\
|
_IsBookmarked.py\
|
||||||
|
|||||||
@@ -52,10 +52,3 @@ class HasCitation(HasCitationBase):
|
|||||||
name = _('Family with the <citation>')
|
name = _('Family with the <citation>')
|
||||||
description = _("Matches families with a citation of a particular "
|
description = _("Matches families with a citation of a particular "
|
||||||
"value")
|
"value")
|
||||||
|
|
||||||
def apply(self, dbase, family):
|
|
||||||
for citation_handle in family.get_citation_list():
|
|
||||||
citation = dbase.get_citation_from_handle(citation_handle)
|
|
||||||
if HasCitationBase.apply(self, dbase, citation):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|||||||
49
src/Filters/Rules/Family/_HasSourceOf.py
Normal file
49
src/Filters/Rules/Family/_HasSourceOf.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||||
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
|
#
|
||||||
|
# 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: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasSourceOfBase import HasSourceOfBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasSourceOf
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasSourceOf(HasSourceOfBase):
|
||||||
|
"""Rule that checks family that have a particular source."""
|
||||||
|
|
||||||
|
labels = [ _('Source ID:') ]
|
||||||
|
name = _('Families with the <source>')
|
||||||
|
category = _('Citation/source filters')
|
||||||
|
description = _('Matches families who have a particular source')
|
||||||
@@ -48,6 +48,7 @@ from _HasCitation import HasCitation
|
|||||||
from _FamilyPrivate import FamilyPrivate
|
from _FamilyPrivate import FamilyPrivate
|
||||||
from _HasAttribute import HasAttribute
|
from _HasAttribute import HasAttribute
|
||||||
from _HasEvent import HasEvent
|
from _HasEvent import HasEvent
|
||||||
|
from _HasSourceOf import HasSourceOf
|
||||||
from _IsBookmarked import IsBookmarked
|
from _IsBookmarked import IsBookmarked
|
||||||
from _MatchesFilter import MatchesFilter
|
from _MatchesFilter import MatchesFilter
|
||||||
from _MatchesSourceConfidence import MatchesSourceConfidence
|
from _MatchesSourceConfidence import MatchesSourceConfidence
|
||||||
@@ -72,6 +73,7 @@ editor_rule_list = [
|
|||||||
HasNoteMatchingSubstringOf,
|
HasNoteMatchingSubstringOf,
|
||||||
HasReferenceCountOf,
|
HasReferenceCountOf,
|
||||||
HasSourceCount,
|
HasSourceCount,
|
||||||
|
HasSourceOf,
|
||||||
HasCitation,
|
HasCitation,
|
||||||
FamilyPrivate,
|
FamilyPrivate,
|
||||||
HasEvent,
|
HasEvent,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pkgpython_PYTHON = \
|
|||||||
_HasReferenceCountBase.py \
|
_HasReferenceCountBase.py \
|
||||||
_HasSourceCountBase.py \
|
_HasSourceCountBase.py \
|
||||||
_HasSourceBase.py \
|
_HasSourceBase.py \
|
||||||
|
_HasSourceOfBase.py \
|
||||||
_HasTagBase.py \
|
_HasTagBase.py \
|
||||||
_HasTextMatchingRegexpOf.py\
|
_HasTextMatchingRegexpOf.py\
|
||||||
_HasTextMatchingSubstringOf.py\
|
_HasTextMatchingSubstringOf.py\
|
||||||
|
|||||||
@@ -6,13 +6,17 @@ pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/MediaObject
|
|||||||
pkgpython_PYTHON = \
|
pkgpython_PYTHON = \
|
||||||
_AllMedia.py\
|
_AllMedia.py\
|
||||||
_ChangedSince.py\
|
_ChangedSince.py\
|
||||||
|
_HasCitation.py \
|
||||||
_HasIdOf.py\
|
_HasIdOf.py\
|
||||||
_HasMedia.py\
|
_HasMedia.py\
|
||||||
_HasNoteMatchingSubstringOf.py\
|
_HasNoteMatchingSubstringOf.py\
|
||||||
_HasNoteRegexp.py\
|
_HasNoteRegexp.py\
|
||||||
_HasReferenceCountOf.py\
|
_HasReferenceCountOf.py\
|
||||||
|
_HasSourceCount.py \
|
||||||
|
_HasSourceOf.py \
|
||||||
_HasTag.py\
|
_HasTag.py\
|
||||||
_MatchesFilter.py\
|
_MatchesFilter.py\
|
||||||
|
_MatchesSourceConfidence.py \
|
||||||
_MediaPrivate.py\
|
_MediaPrivate.py\
|
||||||
_HasAttribute.py\
|
_HasAttribute.py\
|
||||||
_RegExpIdOf.py\
|
_RegExpIdOf.py\
|
||||||
|
|||||||
53
src/Filters/Rules/MediaObject/_HasCitation.py
Normal file
53
src/Filters/Rules/MediaObject/_HasCitation.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#
|
||||||
|
# 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: _HasCitation.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
"""
|
||||||
|
Filter rule to match persons with a particular citation.
|
||||||
|
"""
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasCitationBase import HasCitationBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasEvent
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasCitation(HasCitationBase):
|
||||||
|
"""Rule that checks for a person with a particular value"""
|
||||||
|
|
||||||
|
labels = [ _('Volume/Page:'),
|
||||||
|
_('Date:'),
|
||||||
|
_('Confidence level:')]
|
||||||
|
name = _('Media with the <citation>')
|
||||||
|
description = _("Matches media with a citation of a particular "
|
||||||
|
"value")
|
||||||
47
src/Filters/Rules/MediaObject/_HasSourceCount.py
Normal file
47
src/Filters/Rules/MediaObject/_HasSourceCount.py
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2007 Donald N. Allingham
|
||||||
|
# Copyright (C) 2007-2008 Brian G. Matherly
|
||||||
|
# Copyright (C) 2008 Jerome Rapinat
|
||||||
|
# Copyright (C) 2008 Benny Malengier
|
||||||
|
#
|
||||||
|
# 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: _HasSourceCount.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasSourceCountBase import HasSourceCountBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "People having sources"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasSourceCount(HasSourceCountBase):
|
||||||
|
"""Media with sources"""
|
||||||
|
|
||||||
|
name = _('Media with <count> sources')
|
||||||
|
description = _("Matches media with a certain number of sources connected to it")
|
||||||
49
src/Filters/Rules/MediaObject/_HasSourceOf.py
Normal file
49
src/Filters/Rules/MediaObject/_HasSourceOf.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||||
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
|
#
|
||||||
|
# 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: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasSourceOfBase import HasSourceOfBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasSourceOf
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasSourceOf(HasSourceOfBase):
|
||||||
|
"""Rule that checks media that have a particular source."""
|
||||||
|
|
||||||
|
labels = [ _('Source ID:') ]
|
||||||
|
name = _('Media with the <source>')
|
||||||
|
category = _('Citation/source filters')
|
||||||
|
description = _('Matches media who have a particular source')
|
||||||
46
src/Filters/Rules/MediaObject/_MatchesSourceConfidence.py
Normal file
46
src/Filters/Rules/MediaObject/_MatchesSourceConfidence.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 Jerome Rapinat
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Filters/Rules/Person/_MatchesSourceConfidence.py
|
||||||
|
# $Id: _MatchesSourceConfidence.py 18361 2011-10-23 03:13:50Z paul-franklin $
|
||||||
|
#
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import sgettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "Confidence level"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class MatchesSourceConfidence(MatchesSourceConfidenceBase):
|
||||||
|
"""Media matching a specific confidence level on its 'direct' source references"""
|
||||||
|
|
||||||
|
labels = [_('Confidence level:')]
|
||||||
|
name = _('Media with at least one direct source >= <confidence level>')
|
||||||
|
description = _("Matches media with at least one direct source with confidence level(s)")
|
||||||
@@ -27,11 +27,15 @@ Package providing filter rules for GRAMPS.
|
|||||||
from _AllMedia import AllMedia
|
from _AllMedia import AllMedia
|
||||||
from _HasIdOf import HasIdOf
|
from _HasIdOf import HasIdOf
|
||||||
from _RegExpIdOf import RegExpIdOf
|
from _RegExpIdOf import RegExpIdOf
|
||||||
|
from _HasCitation import HasCitation
|
||||||
from _HasNoteRegexp import HasNoteRegexp
|
from _HasNoteRegexp import HasNoteRegexp
|
||||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
||||||
from _HasReferenceCountOf import HasReferenceCountOf
|
from _HasReferenceCountOf import HasReferenceCountOf
|
||||||
|
from _HasSourceCount import HasSourceCount
|
||||||
|
from _HasSourceOf import HasSourceOf
|
||||||
from _MediaPrivate import MediaPrivate
|
from _MediaPrivate import MediaPrivate
|
||||||
from _MatchesFilter import MatchesFilter
|
from _MatchesFilter import MatchesFilter
|
||||||
|
from _MatchesSourceConfidence import MatchesSourceConfidence
|
||||||
from _HasMedia import HasMedia
|
from _HasMedia import HasMedia
|
||||||
from _HasAttribute import HasAttribute
|
from _HasAttribute import HasAttribute
|
||||||
from _ChangedSince import ChangedSince
|
from _ChangedSince import ChangedSince
|
||||||
@@ -41,11 +45,15 @@ editor_rule_list = [
|
|||||||
AllMedia,
|
AllMedia,
|
||||||
HasIdOf,
|
HasIdOf,
|
||||||
RegExpIdOf,
|
RegExpIdOf,
|
||||||
|
HasCitation,
|
||||||
HasNoteRegexp,
|
HasNoteRegexp,
|
||||||
HasNoteMatchingSubstringOf,
|
HasNoteMatchingSubstringOf,
|
||||||
HasReferenceCountOf,
|
HasReferenceCountOf,
|
||||||
|
HasSourceCount,
|
||||||
|
HasSourceOf,
|
||||||
MediaPrivate,
|
MediaPrivate,
|
||||||
MatchesFilter,
|
MatchesFilter,
|
||||||
|
MatchesSourceConfidence,
|
||||||
HasAttribute,
|
HasAttribute,
|
||||||
ChangedSince,
|
ChangedSince,
|
||||||
HasTag,
|
HasTag,
|
||||||
|
|||||||
@@ -51,10 +51,3 @@ class HasCitation(HasCitationBase):
|
|||||||
name = _('People with the <citation>')
|
name = _('People with the <citation>')
|
||||||
description = _("Matches people with a citation of a particular "
|
description = _("Matches people with a citation of a particular "
|
||||||
"value")
|
"value")
|
||||||
|
|
||||||
def apply(self, dbase, person):
|
|
||||||
for citation_handle in person.get_citation_list():
|
|
||||||
citation = dbase.get_citation_from_handle(citation_handle)
|
|
||||||
if HasCitationBase.apply(self, dbase, citation):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|||||||
@@ -33,45 +33,17 @@ from gen.ggettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules._HasSourceOfBase import HasSourceOfBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasSourceOf
|
# HasSourceOf
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasSourceOf(Rule):
|
class HasSourceOf(HasSourceOfBase):
|
||||||
"""Rule that checks people that have a particular source."""
|
"""Rule that checks people that have a particular source."""
|
||||||
|
|
||||||
labels = [ _('Source ID:') ]
|
labels = [ _('Source ID:') ]
|
||||||
name = _('People with the <source>')
|
name = _('People with the <source>')
|
||||||
category = _('Citation/source filters')
|
category = _('Citation/source filters')
|
||||||
description = _('Matches people who have a particular source')
|
description = _('Matches people who have a particular source')
|
||||||
|
|
||||||
def prepare(self,db):
|
|
||||||
if self.list[0] == '':
|
|
||||||
self.source_handle = None
|
|
||||||
self.nosource = True
|
|
||||||
return
|
|
||||||
|
|
||||||
self.nosource = False
|
|
||||||
try:
|
|
||||||
self.source_handle = db.get_source_from_gramps_id(
|
|
||||||
self.list[0]).get_handle()
|
|
||||||
except:
|
|
||||||
self.source_handle = None
|
|
||||||
|
|
||||||
def apply(self, db, person):
|
|
||||||
if not self.source_handle:
|
|
||||||
if self.nosource:
|
|
||||||
# check whether the citation list is empty as a proxy for
|
|
||||||
# there being no sources
|
|
||||||
return len(person.get_all_citation_lists()) == 0
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
for citation_handle in person.get_all_citation_lists():
|
|
||||||
citation = db.get_citation_from_handle(citation_handle)
|
|
||||||
if citation.get_reference_handle() == self.source_handle:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Place
|
|||||||
pkgpython_PYTHON = \
|
pkgpython_PYTHON = \
|
||||||
_AllPlaces.py\
|
_AllPlaces.py\
|
||||||
_ChangedSince.py\
|
_ChangedSince.py\
|
||||||
|
_HasCitation.py \
|
||||||
_HasIdOf.py\
|
_HasIdOf.py\
|
||||||
_HasNoLatOrLon.py\
|
_HasNoLatOrLon.py\
|
||||||
_InLatLonNeighborhood.py\
|
_InLatLonNeighborhood.py\
|
||||||
@@ -15,8 +16,11 @@ pkgpython_PYTHON = \
|
|||||||
_HasPlace.py\
|
_HasPlace.py\
|
||||||
_HasNote.py \
|
_HasNote.py \
|
||||||
_HasReferenceCountOf.py\
|
_HasReferenceCountOf.py\
|
||||||
|
_HasSourceCount.py \
|
||||||
|
_HasSourceOf.py \
|
||||||
_MatchesFilter.py\
|
_MatchesFilter.py\
|
||||||
_MatchesEventFilter.py\
|
_MatchesEventFilter.py\
|
||||||
|
_MatchesSourceConfidence.py \
|
||||||
_PlacePrivate.py\
|
_PlacePrivate.py\
|
||||||
_RegExpIdOf.py\
|
_RegExpIdOf.py\
|
||||||
__init__.py
|
__init__.py
|
||||||
|
|||||||
54
src/Filters/Rules/Place/_HasCitation.py
Normal file
54
src/Filters/Rules/Place/_HasCitation.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||||
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
|
#
|
||||||
|
# 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: _HasCitation.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
"""
|
||||||
|
Filter rule to match family with a particular citation.
|
||||||
|
"""
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasCitationBase import HasCitationBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasEvent
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasCitation(HasCitationBase):
|
||||||
|
"""Rule that checks for a family with a particular value"""
|
||||||
|
|
||||||
|
labels = [ _('Volume/Page:'),
|
||||||
|
_('Date:'),
|
||||||
|
_('Confidence level:')]
|
||||||
|
name = _('Place with the <citation>')
|
||||||
|
description = _("Matches places with a citation of a particular "
|
||||||
|
"value")
|
||||||
47
src/Filters/Rules/Place/_HasSourceCount.py
Normal file
47
src/Filters/Rules/Place/_HasSourceCount.py
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2007 Donald N. Allingham
|
||||||
|
# Copyright (C) 2007-2008 Brian G. Matherly
|
||||||
|
# Copyright (C) 2008 Jerome Rapinat
|
||||||
|
# Copyright (C) 2008 Benny Malengier
|
||||||
|
#
|
||||||
|
# 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: _HasSourceCount.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasSourceCountBase import HasSourceCountBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "People having sources"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasSourceCount(HasSourceCountBase):
|
||||||
|
"""Place with sources"""
|
||||||
|
|
||||||
|
name = _('Place with <count> sources')
|
||||||
|
description = _("Matches places with a certain number of sources connected to it")
|
||||||
49
src/Filters/Rules/Place/_HasSourceOf.py
Normal file
49
src/Filters/Rules/Place/_HasSourceOf.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||||
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
|
#
|
||||||
|
# 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: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasSourceOfBase import HasSourceOfBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasSourceOf
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasSourceOf(HasSourceOfBase):
|
||||||
|
"""Rule that checks family that have a particular source."""
|
||||||
|
|
||||||
|
labels = [ _('Source ID:') ]
|
||||||
|
name = _('Places with the <source>')
|
||||||
|
category = _('Citation/source filters')
|
||||||
|
description = _('Matches places who have a particular source')
|
||||||
46
src/Filters/Rules/Place/_MatchesSourceConfidence.py
Normal file
46
src/Filters/Rules/Place/_MatchesSourceConfidence.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 Jerome Rapinat
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Filters/Rules/Person/_MatchesSourceConfidence.py
|
||||||
|
# $Id: _MatchesSourceConfidence.py 18361 2011-10-23 03:13:50Z paul-franklin $
|
||||||
|
#
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import sgettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "Confidence level"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class MatchesSourceConfidence(MatchesSourceConfidenceBase):
|
||||||
|
"""Media matching a specific confidence level on its 'direct' source references"""
|
||||||
|
|
||||||
|
labels = [_('Confidence level:')]
|
||||||
|
name = _('Place with direct source >= <confidence level>')
|
||||||
|
description = _("Matches places with at least one direct source with confidence level(s)")
|
||||||
@@ -29,12 +29,16 @@ from _AllPlaces import AllPlaces
|
|||||||
from _HasGallery import HasGallery
|
from _HasGallery import HasGallery
|
||||||
from _HasIdOf import HasIdOf
|
from _HasIdOf import HasIdOf
|
||||||
from _RegExpIdOf import RegExpIdOf
|
from _RegExpIdOf import RegExpIdOf
|
||||||
|
from _HasCitation import HasCitation
|
||||||
|
from _HasSourceOf import HasSourceOf
|
||||||
|
from _HasSourceCount import HasSourceCount
|
||||||
from _HasNote import HasNote
|
from _HasNote import HasNote
|
||||||
from _HasNoteRegexp import HasNoteRegexp
|
from _HasNoteRegexp import HasNoteRegexp
|
||||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
||||||
from _HasReferenceCountOf import HasReferenceCountOf
|
from _HasReferenceCountOf import HasReferenceCountOf
|
||||||
from _PlacePrivate import PlacePrivate
|
from _PlacePrivate import PlacePrivate
|
||||||
from _MatchesFilter import MatchesFilter
|
from _MatchesFilter import MatchesFilter
|
||||||
|
from _MatchesSourceConfidence import MatchesSourceConfidence
|
||||||
from _HasPlace import HasPlace
|
from _HasPlace import HasPlace
|
||||||
from _HasNoLatOrLon import HasNoLatOrLon
|
from _HasNoLatOrLon import HasNoLatOrLon
|
||||||
from _InLatLonNeighborhood import InLatLonNeighborhood
|
from _InLatLonNeighborhood import InLatLonNeighborhood
|
||||||
@@ -46,12 +50,16 @@ editor_rule_list = [
|
|||||||
HasGallery,
|
HasGallery,
|
||||||
HasIdOf,
|
HasIdOf,
|
||||||
RegExpIdOf,
|
RegExpIdOf,
|
||||||
|
HasCitation,
|
||||||
HasNote,
|
HasNote,
|
||||||
HasNoteRegexp,
|
HasNoteRegexp,
|
||||||
HasNoteMatchingSubstringOf,
|
HasNoteMatchingSubstringOf,
|
||||||
HasReferenceCountOf,
|
HasReferenceCountOf,
|
||||||
|
HasSourceOf,
|
||||||
|
HasSourceCount,
|
||||||
PlacePrivate,
|
PlacePrivate,
|
||||||
MatchesFilter,
|
MatchesFilter,
|
||||||
|
MatchesSourceConfidence,
|
||||||
HasPlace,
|
HasPlace,
|
||||||
HasNoLatOrLon,
|
HasNoLatOrLon,
|
||||||
InLatLonNeighborhood,
|
InLatLonNeighborhood,
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class HasCitationBase(Rule):
|
|||||||
First parameter is [Volume/page, Date, Confidence]
|
First parameter is [Volume/page, Date, Confidence]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
labels = [ _('Volume/Page:'),
|
labels = [ _('Volume/Page:'),
|
||||||
_('Date:'),
|
_('Date:'),
|
||||||
_('Confidence:') ]
|
_('Confidence:') ]
|
||||||
@@ -63,7 +62,14 @@ class HasCitationBase(Rule):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def apply(self,db,citation):
|
def apply(self, dbase, object):
|
||||||
|
for citation_handle in object.get_citation_list():
|
||||||
|
citation = dbase.get_citation_from_handle(citation_handle)
|
||||||
|
if self._apply(dbase, citation):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _apply(self, db, citation):
|
||||||
if not self.match_substring(0, citation.get_page()):
|
if not self.match_substring(0, citation.get_page()):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
77
src/Filters/Rules/_HasSourceOfBase.py
Normal file
77
src/Filters/Rules/_HasSourceOfBase.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||||
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
|
#
|
||||||
|
# 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: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._Rule import Rule
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasSourceOf
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasSourceOfBase(Rule):
|
||||||
|
"""Rule that checks for objects that have a particular source."""
|
||||||
|
|
||||||
|
labels = [ _('Source ID:') ]
|
||||||
|
name = _('Object with the <source>')
|
||||||
|
category = _('Citation/source filters')
|
||||||
|
description = _('Matches objects who have a particular source')
|
||||||
|
|
||||||
|
def prepare(self,db):
|
||||||
|
if self.list[0] == '':
|
||||||
|
self.source_handle = None
|
||||||
|
self.nosource = True
|
||||||
|
return
|
||||||
|
|
||||||
|
self.nosource = False
|
||||||
|
try:
|
||||||
|
self.source_handle = db.get_source_from_gramps_id(
|
||||||
|
self.list[0]).get_handle()
|
||||||
|
except:
|
||||||
|
self.source_handle = None
|
||||||
|
|
||||||
|
def apply(self, db, object):
|
||||||
|
if not self.source_handle:
|
||||||
|
if self.nosource:
|
||||||
|
# check whether the citation list is empty as a proxy for
|
||||||
|
# there being no sources
|
||||||
|
return len(object.get_all_citation_lists()) == 0
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
for citation_handle in object.get_all_citation_lists():
|
||||||
|
citation = db.get_citation_from_handle(citation_handle)
|
||||||
|
if citation.get_reference_handle() == self.source_handle:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
Reference in New Issue
Block a user