diff --git a/po/POTFILES.in b/po/POTFILES.in index 71abc33b2..dd8d89e70 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/src/Filters/Rules/Event/Makefile.am b/src/Filters/Rules/Event/Makefile.am index 662695992..5d6f498bf 100644 --- a/src/Filters/Rules/Event/Makefile.am +++ b/src/Filters/Rules/Event/Makefile.am @@ -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 diff --git a/src/Filters/Rules/Event/_MatchesSourceConfidence.py b/src/Filters/Rules/Event/_MatchesSourceConfidence.py new file mode 100644 index 000000000..c10f4168d --- /dev/null +++ b/src/Filters/Rules/Event/_MatchesSourceConfidence.py @@ -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 >= ') + description = _("Matches events with at least one direct source with confidence level(s)") + diff --git a/src/Filters/Rules/Event/__init__.py b/src/Filters/Rules/Event/__init__.py index 9b33df93b..affc9cdaa 100644 --- a/src/Filters/Rules/Event/__init__.py +++ b/src/Filters/Rules/Event/__init__.py @@ -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, diff --git a/src/Filters/Rules/Family/Makefile.am b/src/Filters/Rules/Family/Makefile.am index c16e0ecbb..eb8a8d5fb 100644 --- a/src/Filters/Rules/Family/Makefile.am +++ b/src/Filters/Rules/Family/Makefile.am @@ -22,6 +22,7 @@ pkgdata_PYTHON = \ _IsBookmarked.py\ _RegExpIdOf.py\ _MatchesFilter.py\ + _MatchesSourceConfidence.py\ _FatherHasNameOf.py\ _FatherHasIdOf.py\ _MotherHasNameOf.py\ diff --git a/src/Filters/Rules/Family/_MatchesSourceConfidence.py b/src/Filters/Rules/Family/_MatchesSourceConfidence.py new file mode 100644 index 000000000..71e9439d6 --- /dev/null +++ b/src/Filters/Rules/Family/_MatchesSourceConfidence.py @@ -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 >= ') + description = _("Matches families with at least one direct source with confidence level(s)") + diff --git a/src/Filters/Rules/Family/__init__.py b/src/Filters/Rules/Family/__init__.py index 9fc85b850..3eb635713 100644 --- a/src/Filters/Rules/Family/__init__.py +++ b/src/Filters/Rules/Family/__init__.py @@ -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, diff --git a/src/Filters/Rules/Makefile.am b/src/Filters/Rules/Makefile.am index 4b19bed51..552ff18fa 100644 --- a/src/Filters/Rules/Makefile.am +++ b/src/Filters/Rules/Makefile.am @@ -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 diff --git a/src/Filters/Rules/Person/Makefile.am b/src/Filters/Rules/Person/Makefile.am index d3e0e4519..3e340ec8f 100644 --- a/src/Filters/Rules/Person/Makefile.am +++ b/src/Filters/Rules/Person/Makefile.am @@ -61,6 +61,7 @@ pkgdata_PYTHON = \ _IsWitness.py \ _MatchesFilter.py \ _MatchesEventFilter.py \ + _MatchesSourceConfidence.py \ _MissingParent.py \ _MultipleMarriages.py \ _NeverMarried.py \ diff --git a/src/Filters/Rules/Person/_MatchesSourceConfidence.py b/src/Filters/Rules/Person/_MatchesSourceConfidence.py new file mode 100644 index 000000000..c8c72de0b --- /dev/null +++ b/src/Filters/Rules/Person/_MatchesSourceConfidence.py @@ -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 >= ') + description = _("Matches persons with at least one direct source with confidence level(s)") + diff --git a/src/Filters/Rules/Person/__init__.py b/src/Filters/Rules/Person/__init__.py index db9a855ed..13b48d627 100644 --- a/src/Filters/Rules/Person/__init__.py +++ b/src/Filters/Rules/Person/__init__.py @@ -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, diff --git a/src/Filters/Rules/_MatchesSourceConfidenceBase.py b/src/Filters/Rules/_MatchesSourceConfidenceBase.py new file mode 100644 index 000000000..a8ab0f71a --- /dev/null +++ b/src/Filters/Rules/_MatchesSourceConfidenceBase.py @@ -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 >= ') + 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 diff --git a/src/Filters/Rules/__init__.py b/src/Filters/Rules/__init__.py index 5e2f2ab1f..06126339e 100644 --- a/src/Filters/Rules/__init__.py +++ b/src/Filters/Rules/__init__.py @@ -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