4491: Matching source and quality level(s)

svn: r16490
This commit is contained in:
Jérôme Rapinat 2011-01-28 09:03:32 +00:00
parent 6d79c4096d
commit 0c5424dcde
13 changed files with 204 additions and 3 deletions

View File

@ -480,6 +480,7 @@ src/Filters/Rules/Person/_IsSpouseOfFilterMatch.py
src/Filters/Rules/Person/_IsWitness.py
src/Filters/Rules/Person/_MatchesEventFilter.py
src/Filters/Rules/Person/_MatchesFilter.py
src/Filters/Rules/Person/_MatchesSourceConfidence.py
src/Filters/Rules/Person/_MatchIdOf.py
src/Filters/Rules/Person/_MissingParent.py
src/Filters/Rules/Person/_MultipleMarriages.py
@ -517,6 +518,7 @@ src/Filters/Rules/Family/_HasSource.py
src/Filters/Rules/Family/_HasTag.py
src/Filters/Rules/Family/_IsBookmarked.py
src/Filters/Rules/Family/_MatchesFilter.py
src/Filters/Rules/Family/_MatchesSourceConfidence.py
src/Filters/Rules/Family/_MotherHasIdOf.py
src/Filters/Rules/Family/_MotherHasNameOf.py
src/Filters/Rules/Family/_SearchFatherName.py
@ -544,6 +546,7 @@ src/Filters/Rules/Event/_HasType.py
src/Filters/Rules/Event/_MatchesFilter.py
src/Filters/Rules/Event/_MatchesPersonFilter.py
src/Filters/Rules/Event/_MatchesSourceFilter.py
src/Filters/Rules/Event/_MatchesSourceConfidence.py
src/Filters/Rules/Event/_RegExpIdOf.py
# Filters.Rules.Place package

View File

@ -13,11 +13,12 @@ pkgdata_PYTHON = \
_HasGallery.py \
_HasIdOf.py\
_HasNote.py \
_HasSource.py \
_HasSource.py \
_HasType.py\
_HasNoteMatchingSubstringOf.py\
_HasReferenceCountOf.py\
_MatchesPersonFilter.py\
_MatchesSourceConfidence.py\
_MatchesSourceFilter.py\
_HasAttribute.py\
__init__.py

View File

@ -0,0 +1,45 @@
#
# 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
#
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBase
#-------------------------------------------------------------------------
# "Confidence level"
# Sources of an attribute of an event are ignored
#-------------------------------------------------------------------------
class MatchesSourceConfidence(MatchesSourceConfidenceBase):
"""Events matching a specific confidence level on its 'direct' source references"""
labels = [_('Confidence level:')]
name = _('Events with at least one direct source >= <confidence level>')
description = _("Matches events with at least one direct source with confidence level(s)")

View File

@ -40,6 +40,7 @@ from _HasSource import HasSource
from _EventPrivate import EventPrivate
from _MatchesFilter import MatchesFilter
from _MatchesPersonFilter import MatchesPersonFilter
from _MatchesSourceConfidence import MatchesSourceConfidence
from _MatchesSourceFilter import MatchesSourceFilter
from _HasAttribute import HasAttribute
from _HasData import HasData
@ -59,6 +60,7 @@ editor_rule_list = [
EventPrivate,
MatchesFilter,
MatchesPersonFilter,
MatchesSourceConfidence,
MatchesSourceFilter,
HasAttribute,
HasData,

View File

@ -22,6 +22,7 @@ pkgdata_PYTHON = \
_IsBookmarked.py\
_RegExpIdOf.py\
_MatchesFilter.py\
_MatchesSourceConfidence.py\
_FatherHasNameOf.py\
_FatherHasIdOf.py\
_MotherHasNameOf.py\

View File

@ -0,0 +1,44 @@
#
# 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
#
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBase
#-------------------------------------------------------------------------
# "Confidence level"
#-------------------------------------------------------------------------
class MatchesSourceConfidence(MatchesSourceConfidenceBase):
"""Families matching a specific confidence level on its 'direct' source references"""
labels = [_('Confidence level:')]
name = _('Families with at least one direct source >= <confidence level>')
description = _("Matches families with at least one direct source with confidence level(s)")

View File

@ -48,6 +48,7 @@ from _HasAttribute import HasAttribute
from _HasEvent import HasEvent
from _IsBookmarked import IsBookmarked
from _MatchesFilter import MatchesFilter
from _MatchesSourceConfidence import MatchesSourceConfidence
from _FatherHasNameOf import FatherHasNameOf
from _FatherHasIdOf import FatherHasIdOf
from _MotherHasNameOf import MotherHasNameOf
@ -74,6 +75,7 @@ editor_rule_list = [
HasAttribute,
IsBookmarked,
MatchesFilter,
MatchesSourceConfidence,
FatherHasNameOf,
FatherHasIdOf,
MotherHasNameOf,

View File

@ -25,8 +25,9 @@ pkgdata_PYTHON = \
_RegExpIdBase.py\
_Rule.py\
_MatchesFilterBase.py\
_MatchesEventFilterBase.py \
_MatchesSourceFilterBase.py
_MatchesEventFilterBase.py \
_MatchesSourceConfidenceBase.py \
_MatchesSourceFilterBase.py
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules

View File

@ -61,6 +61,7 @@ pkgdata_PYTHON = \
_IsWitness.py \
_MatchesFilter.py \
_MatchesEventFilter.py \
_MatchesSourceConfidence.py \
_MissingParent.py \
_MultipleMarriages.py \
_NeverMarried.py \

View File

@ -0,0 +1,44 @@
#
# 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
#
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBase
#-------------------------------------------------------------------------
# "Confidence level"
#-------------------------------------------------------------------------
class MatchesSourceConfidence(MatchesSourceConfidenceBase):
"""Persons matching a specific confidence level on its 'direct' source references"""
labels = [_('Confidence level:')]
name = _('Persons with at least one direct source >= <confidence level>')
description = _("Matches persons with at least one direct source with confidence level(s)")

View File

@ -88,6 +88,7 @@ from _IsSpouseOfFilterMatch import IsSpouseOfFilterMatch
from _IsWitness import IsWitness
from _MatchesFilter import MatchesFilter
from _MatchesEventFilter import MatchesEventFilter
from _MatchesSourceConfidence import MatchesSourceConfidence
from _MissingParent import MissingParent
from _MultipleMarriages import MultipleMarriages
from _NeverMarried import NeverMarried
@ -166,6 +167,7 @@ editor_rule_list = [
HasCommonAncestorWithFilterMatch,
MatchesFilter,
MatchesEventFilter,
MatchesSourceConfidence,
MissingParent,
IsChildOfFilterMatch,
IsParentOfFilterMatch,

View File

@ -0,0 +1,54 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011 Jerome Rapinat
# Copyright (C) 2011 Douglas S. Blank
# Copyright (C) 2011 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
#
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._Rule import Rule
#-------------------------------------------------------------------------
# "Confidence level"
# Sources of an attribute of an event are ignored
#-------------------------------------------------------------------------
class MatchesSourceConfidenceBase(Rule):
"""Objects with a specific confidence level on 'direct' Source references"""
labels = [_('Confidence level:')]
name = _('Object with at least one direct source >= <confidence level>')
description = _("Matches objects with at least one direct source with confidence level(s)")
category = _('General filters')
def apply(self, db, obj):
for source in obj.get_source_references():
required_conf = int(self.list[0])
if required_conf <= source.get_confidence_level():
return True
return False

View File

@ -35,6 +35,7 @@ from Filters.Rules._HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
from Filters.Rules._HasTextMatchingRegexpOf import HasTextMatchingRegexpOf
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
from Filters.Rules._MatchesEventFilterBase import MatchesEventFilterBase
from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBase
from Filters.Rules._MatchesSourceFilterBase import MatchesSourceFilterBase
from Filters.Rules._ChangedSinceBase import ChangedSinceBase