From 2dd9893045821b1c1d90499cdb13dfd07650e051 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 3 May 2006 06:29:07 +0000 Subject: [PATCH] * src/Filters/Rules/*: Add object-specific rules. svn: r6529 --- ChangeLog | 2 + src/DataViews/_PersonView.py | 46 ++-- src/Filters/Rules/Event/Makefile.am | 18 ++ src/Filters/Rules/Event/__init__.py | 27 +++ src/Filters/Rules/Family/Makefile.am | 18 ++ src/Filters/Rules/Family/__init__.py | 27 +++ src/Filters/Rules/Makefile.am | 58 +----- src/Filters/Rules/Media/Makefile.am | 18 ++ src/Filters/Rules/Media/__init__.py | 27 +++ src/Filters/Rules/Person/Makefile.am | 74 +++++++ .../Rules/{ => Person}/_Disconnected.py | 2 +- src/Filters/Rules/{ => Person}/_Everyone.py | 2 +- .../_FamilyWithIncompleteEvent.py | 2 +- .../Rules/{ => Person}/_HasAttribute.py | 2 +- src/Filters/Rules/{ => Person}/_HasBirth.py | 4 +- .../{ => Person}/_HasCommonAncestorWith.py | 2 +- .../_HasCommonAncestorWithFilterMatch.py | 0 .../Rules/{ => Person}/_HasCompleteRecord.py | 2 +- src/Filters/Rules/{ => Person}/_HasDeath.py | 4 +- src/Filters/Rules/{ => Person}/_HasEvent.py | 4 +- .../Rules/{ => Person}/_HasFamilyAttribute.py | 2 +- .../Rules/{ => Person}/_HasFamilyEvent.py | 4 +- src/Filters/Rules/{ => Person}/_HasIdOf.py | 2 +- src/Filters/Rules/{ => Person}/_HasNameOf.py | 2 +- src/Filters/Rules/{ => Person}/_HasNote.py | 2 +- .../_HasNoteMatchingSubstringOf.py | 2 +- .../Rules/{ => Person}/_HasRelationship.py | 2 +- .../Rules/{ => Person}/_HasSourceOf.py | 2 +- .../Rules/Person/_HasTextMatchingRegexpOf.py | 56 +++++ .../Person/_HasTextMatchingSubstringOf.py | 197 ++++++++++++++++++ .../Rules/{ => Person}/_HasUnknownGender.py | 2 +- .../Rules/{ => Person}/_HaveAltFamilies.py | 2 +- .../Rules/{ => Person}/_HaveChildren.py | 2 +- src/Filters/Rules/{ => Person}/_HavePhotos.py | 2 +- .../Rules/{ => Person}/_IncompleteNames.py | 2 +- .../Rules/{ => Person}/_IsAncestorOf.py | 2 +- .../{ => Person}/_IsAncestorOfFilterMatch.py | 0 .../Rules/{ => Person}/_IsBookmarked.py | 2 +- .../{ => Person}/_IsChildOfFilterMatch.py | 2 +- .../Rules/{ => Person}/_IsDefaultPerson.py | 2 +- .../{ => Person}/_IsDescendantFamilyOf.py | 2 +- .../Rules/{ => Person}/_IsDescendantOf.py | 2 +- .../_IsDescendantOfFilterMatch.py | 0 src/Filters/Rules/{ => Person}/_IsFemale.py | 2 +- .../_IsLessThanNthGenerationAncestorOf.py | 2 +- ...ssThanNthGenerationAncestorOfBookmarked.py | 2 +- ...hanNthGenerationAncestorOfDefaultPerson.py | 2 +- .../_IsLessThanNthGenerationDescendantOf.py | 2 +- src/Filters/Rules/{ => Person}/_IsMale.py | 2 +- .../_IsMoreThanNthGenerationAncestorOf.py | 2 +- .../_IsMoreThanNthGenerationDescendantOf.py | 2 +- .../{ => Person}/_IsParentOfFilterMatch.py | 2 +- .../{ => Person}/_IsSiblingOfFilterMatch.py | 2 +- .../{ => Person}/_IsSpouseOfFilterMatch.py | 2 +- src/Filters/Rules/{ => Person}/_IsWitness.py | 2 +- .../Rules/{ => Person}/_MatchesFilter.py | 2 +- .../Rules/{ => Person}/_MultipleMarriages.py | 2 +- .../Rules/{ => Person}/_NeverMarried.py | 2 +- .../Rules/{ => Person}/_NoBirthdate.py | 2 +- .../Rules/{ => Person}/_PeoplePrivate.py | 7 +- .../_PersonWithIncompleteEvent.py | 2 +- .../Rules/{ => Person}/_ProbablyAlive.py | 2 +- .../{ => Person}/_RelationshipPathBetween.py | 2 +- src/Filters/Rules/{ => Person}/_SearchName.py | 2 +- src/Filters/Rules/Person/__init__.py | 148 +++++++++++++ src/Filters/Rules/Place/Makefile.am | 18 ++ src/Filters/Rules/Place/__init__.py | 27 +++ src/Filters/Rules/Repository/Makefile.am | 18 ++ src/Filters/Rules/Repository/__init__.py | 27 +++ src/Filters/Rules/Source/Makefile.am | 18 ++ src/Filters/Rules/Source/__init__.py | 27 +++ src/Filters/Rules/_Everything.py | 53 +++++ src/Filters/Rules/_HasTextMatchingRegexpOf.py | 14 +- .../Rules/_HasTextMatchingSubstringOf.py | 148 +------------ src/Filters/Rules/_IsPrivate.py | 48 +++++ src/Filters/Rules/__init__.py | 126 +---------- src/Filters/_FilterList.py | 7 +- src/Filters/_FilterParser.py | 110 +++++----- src/GrampsDb/_WriteGedcom.py | 8 +- src/ObjectSelector/_PersonFilterFrame.py | 60 +++--- src/PageView.py | 4 +- src/PluginUtils/_Report.py | 2 +- src/plugins/Calendar.py | 13 +- src/plugins/EventCmp.py | 2 +- src/plugins/ExportVCalendar.py | 8 +- src/plugins/ExportVCard.py | 8 +- src/plugins/FilterEditor.py | 2 +- src/plugins/GraphViz.py | 8 +- src/plugins/IndivComplete.py | 10 +- src/plugins/NarrativeWeb.py | 10 +- src/plugins/StatisticsChart.py | 8 +- src/plugins/TimeLine.py | 8 +- src/plugins/WriteFtree.py | 8 +- src/plugins/WriteGeneWeb.py | 8 +- 94 files changed, 1085 insertions(+), 550 deletions(-) create mode 100644 src/Filters/Rules/Event/Makefile.am create mode 100644 src/Filters/Rules/Event/__init__.py create mode 100644 src/Filters/Rules/Family/Makefile.am create mode 100644 src/Filters/Rules/Family/__init__.py create mode 100644 src/Filters/Rules/Media/Makefile.am create mode 100644 src/Filters/Rules/Media/__init__.py create mode 100644 src/Filters/Rules/Person/Makefile.am rename src/Filters/Rules/{ => Person}/_Disconnected.py (97%) rename src/Filters/Rules/{ => Person}/_Everyone.py (97%) rename src/Filters/Rules/{ => Person}/_FamilyWithIncompleteEvent.py (98%) rename src/Filters/Rules/{ => Person}/_HasAttribute.py (98%) rename src/Filters/Rules/{ => Person}/_HasBirth.py (97%) rename src/Filters/Rules/{ => Person}/_HasCommonAncestorWith.py (98%) rename src/Filters/Rules/{ => Person}/_HasCommonAncestorWithFilterMatch.py (100%) rename src/Filters/Rules/{ => Person}/_HasCompleteRecord.py (97%) rename src/Filters/Rules/{ => Person}/_HasDeath.py (97%) rename src/Filters/Rules/{ => Person}/_HasEvent.py (97%) rename src/Filters/Rules/{ => Person}/_HasFamilyAttribute.py (98%) rename src/Filters/Rules/{ => Person}/_HasFamilyEvent.py (97%) rename src/Filters/Rules/{ => Person}/_HasIdOf.py (97%) rename src/Filters/Rules/{ => Person}/_HasNameOf.py (98%) rename src/Filters/Rules/{ => Person}/_HasNote.py (97%) rename src/Filters/Rules/{ => Person}/_HasNoteMatchingSubstringOf.py (98%) rename src/Filters/Rules/{ => Person}/_HasRelationship.py (98%) rename src/Filters/Rules/{ => Person}/_HasSourceOf.py (98%) create mode 100644 src/Filters/Rules/Person/_HasTextMatchingRegexpOf.py create mode 100644 src/Filters/Rules/Person/_HasTextMatchingSubstringOf.py rename src/Filters/Rules/{ => Person}/_HasUnknownGender.py (97%) rename src/Filters/Rules/{ => Person}/_HaveAltFamilies.py (98%) rename src/Filters/Rules/{ => Person}/_HaveChildren.py (97%) rename src/Filters/Rules/{ => Person}/_HavePhotos.py (97%) rename src/Filters/Rules/{ => Person}/_IncompleteNames.py (98%) rename src/Filters/Rules/{ => Person}/_IsAncestorOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsAncestorOfFilterMatch.py (100%) rename src/Filters/Rules/{ => Person}/_IsBookmarked.py (98%) rename src/Filters/Rules/{ => Person}/_IsChildOfFilterMatch.py (98%) rename src/Filters/Rules/{ => Person}/_IsDefaultPerson.py (98%) rename src/Filters/Rules/{ => Person}/_IsDescendantFamilyOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsDescendantOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsDescendantOfFilterMatch.py (100%) rename src/Filters/Rules/{ => Person}/_IsFemale.py (97%) rename src/Filters/Rules/{ => Person}/_IsLessThanNthGenerationAncestorOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsLessThanNthGenerationAncestorOfBookmarked.py (98%) rename src/Filters/Rules/{ => Person}/_IsLessThanNthGenerationAncestorOfDefaultPerson.py (98%) rename src/Filters/Rules/{ => Person}/_IsLessThanNthGenerationDescendantOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsMale.py (97%) rename src/Filters/Rules/{ => Person}/_IsMoreThanNthGenerationAncestorOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsMoreThanNthGenerationDescendantOf.py (98%) rename src/Filters/Rules/{ => Person}/_IsParentOfFilterMatch.py (98%) rename src/Filters/Rules/{ => Person}/_IsSiblingOfFilterMatch.py (98%) rename src/Filters/Rules/{ => Person}/_IsSpouseOfFilterMatch.py (98%) rename src/Filters/Rules/{ => Person}/_IsWitness.py (98%) rename src/Filters/Rules/{ => Person}/_MatchesFilter.py (98%) rename src/Filters/Rules/{ => Person}/_MultipleMarriages.py (97%) rename src/Filters/Rules/{ => Person}/_NeverMarried.py (97%) rename src/Filters/Rules/{ => Person}/_NoBirthdate.py (98%) rename src/Filters/Rules/{ => Person}/_PeoplePrivate.py (92%) rename src/Filters/Rules/{ => Person}/_PersonWithIncompleteEvent.py (98%) rename src/Filters/Rules/{ => Person}/_ProbablyAlive.py (98%) rename src/Filters/Rules/{ => Person}/_RelationshipPathBetween.py (99%) rename src/Filters/Rules/{ => Person}/_SearchName.py (98%) create mode 100644 src/Filters/Rules/Person/__init__.py create mode 100644 src/Filters/Rules/Place/Makefile.am create mode 100644 src/Filters/Rules/Place/__init__.py create mode 100644 src/Filters/Rules/Repository/Makefile.am create mode 100644 src/Filters/Rules/Repository/__init__.py create mode 100644 src/Filters/Rules/Source/Makefile.am create mode 100644 src/Filters/Rules/Source/__init__.py create mode 100644 src/Filters/Rules/_Everything.py create mode 100644 src/Filters/Rules/_IsPrivate.py diff --git a/ChangeLog b/ChangeLog index a019df919..f339cf123 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * data/gramps.schemas.in: add family-warn back in 2006-05-02 Alex Roitman + * src/Filters/Rules/*: Add object-specific rules. + * src/GrampsWidgets.py (IconButton): Replace event box with button. * src/GrampsWidgets.py (WarnButton): Replace event box with button. diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 176e316fb..d59e213be 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -348,29 +348,29 @@ class PersonView(PageView.PersonNavView): Builds the default filters and add them to the filter menu. """ default_filters = [ - [Rules.Everyone, []], - [Rules.IsFemale, []], - [Rules.IsMale, []], - [Rules.HasUnknownGender, []], - [Rules.Disconnected, []], - [Rules.SearchName, ['']], - [Rules.HaveAltFamilies, []], - [Rules.HavePhotos, []], - [Rules.IncompleteNames, []], - [Rules.HaveChildren, []], - [Rules.NeverMarried, []], - [Rules.MultipleMarriages, []], - [Rules.NoBirthdate, []], - [Rules.PersonWithIncompleteEvent, []], - [Rules.FamilyWithIncompleteEvent, []], - [Rules.ProbablyAlive, ['']], - [Rules.PeoplePrivate, []], - [Rules.IsWitness, ['','']], - [Rules.HasTextMatchingSubstringOf, ['',0,0]], - [Rules.HasTextMatchingRegexpOf, ['',0,1]], - [Rules.HasNote, []], - [Rules.HasNoteMatchingSubstringOf, ['']], - [Rules.IsFemale, []], + [Rules.Person.Everyone, []], + [Rules.Person.IsFemale, []], + [Rules.Person.IsMale, []], + [Rules.Person.HasUnknownGender, []], + [Rules.Person.Disconnected, []], + [Rules.Person.SearchName, ['']], + [Rules.Person.HaveAltFamilies, []], + [Rules.Person.HavePhotos, []], + [Rules.Person.IncompleteNames, []], + [Rules.Person.HaveChildren, []], + [Rules.Person.NeverMarried, []], + [Rules.Person.MultipleMarriages, []], + [Rules.Person.NoBirthdate, []], + [Rules.Person.PersonWithIncompleteEvent, []], + [Rules.Person.FamilyWithIncompleteEvent, []], + [Rules.Person.ProbablyAlive, ['']], + [Rules.Person.PeoplePrivate, []], + [Rules.Person.IsWitness, ['','']], + [Rules.Person.HasTextMatchingSubstringOf, ['',0,0]], + [Rules.Person.HasTextMatchingRegexpOf, ['',0,1]], + [Rules.Person.HasNote, []], + [Rules.Person.HasNoteMatchingSubstringOf, ['']], + [Rules.Person.IsFemale, []], ] self.generic_filter_widget.setup_filter( default_filters, "person") diff --git a/src/Filters/Rules/Event/Makefile.am b/src/Filters/Rules/Event/Makefile.am new file mode 100644 index 000000000..dd69192b6 --- /dev/null +++ b/src/Filters/Rules/Event/Makefile.am @@ -0,0 +1,18 @@ +# This is the src/Filters/Rules/Event level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Event + +pkgdata_PYTHON = \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Event +pkgpythondir = @pkgpythondir@/Filters/Rules/Event + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Event/__init__.py b/src/Filters/Rules/Event/__init__.py new file mode 100644 index 000000000..b73e6d238 --- /dev/null +++ b/src/Filters/Rules/Event/__init__.py @@ -0,0 +1,27 @@ +# +# 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: __init__.py 6521 2006-05-03 01:02:54Z rshura $ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" diff --git a/src/Filters/Rules/Family/Makefile.am b/src/Filters/Rules/Family/Makefile.am new file mode 100644 index 000000000..1740a30af --- /dev/null +++ b/src/Filters/Rules/Family/Makefile.am @@ -0,0 +1,18 @@ +# This is the src/Filters/Rules/Family level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Family + +pkgdata_PYTHON = \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Family +pkgpythondir = @pkgpythondir@/Filters/Rules/Family + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Family/__init__.py b/src/Filters/Rules/Family/__init__.py new file mode 100644 index 000000000..b73e6d238 --- /dev/null +++ b/src/Filters/Rules/Family/__init__.py @@ -0,0 +1,27 @@ +# +# 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: __init__.py 6521 2006-05-03 01:02:54Z rshura $ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" diff --git a/src/Filters/Rules/Makefile.am b/src/Filters/Rules/Makefile.am index a135ce0df..e525a6381 100644 --- a/src/Filters/Rules/Makefile.am +++ b/src/Filters/Rules/Makefile.am @@ -1,64 +1,12 @@ # This is the src/Filters/Rules level Makefile for Gramps +SUBDIRS = Person Family Event Place Source Media Repository + pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules pkgdata_PYTHON = \ - _Disconnected.py \ - _Everyone.py \ - _FamilyWithIncompleteEvent.py \ - _HasAttribute.py \ - _HasBirth.py \ - _HasCommonAncestorWith.py \ - _HasCommonAncestorWithFilterMatch.py \ - _HasCompleteRecord.py \ - _HasDeath.py \ - _HasEvent.py \ - _HasFamilyAttribute.py \ - _HasFamilyEvent.py \ - _HasIdOf.py \ - _HasNameOf.py \ - _HasNote.py \ - _HasNoteMatchingSubstringOf.py \ - _HasRelationship.py \ - _HasSourceOf.py \ - _HasTextMatchingRegexpOf.py \ - _HasTextMatchingSubstringOf.py \ - _HasUnknownGender.py \ - _HaveAltFamilies.py \ - _HaveChildren.py \ - _HavePhotos.py \ - _IncompleteNames.py \ - _IsAncestorOf.py \ - _IsAncestorOfFilterMatch.py \ - _IsBookmarked.py \ - _IsChildOfFilterMatch.py \ - _IsDefaultPerson.py \ - _IsDescendantFamilyOf.py \ - _IsDescendantOf.py \ - _IsDescendantOfFilterMatch.py \ - _IsFemale.py \ - _IsLessThanNthGenerationAncestorOf.py \ - _IsLessThanNthGenerationAncestorOfBookmarked.py \ - _IsLessThanNthGenerationAncestorOfDefaultPerson.py \ - _IsLessThanNthGenerationDescendantOf.py \ - _IsMale.py \ - _IsMoreThanNthGenerationAncestorOf.py \ - _IsMoreThanNthGenerationDescendantOf.py \ - _IsParentOfFilterMatch.py \ - _IsSiblingOfFilterMatch.py \ - _IsSpouseOfFilterMatch.py \ - _IsWitness.py \ - _MatchesFilter.py \ - _MultipleMarriages.py \ - _NeverMarried.py \ - _NoBirthdate.py \ - _PeoplePrivate.py \ - _PersonWithIncompleteEvent.py \ - _ProbablyAlive.py \ - _RelationshipPathBetween.py \ _Rule.py \ _RuleUtils.py \ - _SearchName.py \ __init__.py pkgpyexecdir = @pkgpyexecdir@/Filters/Rules @@ -67,7 +15,7 @@ pkgpythondir = @pkgpythondir@/Filters/Rules # Clean up all the byte-compiled files MOSTLYCLEANFILES = *pyc *pyo -GRAMPS_PY_MODPATH = "../" +GRAMPS_PY_MODPATH = "../../" pycheck: (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ diff --git a/src/Filters/Rules/Media/Makefile.am b/src/Filters/Rules/Media/Makefile.am new file mode 100644 index 000000000..e4fae5432 --- /dev/null +++ b/src/Filters/Rules/Media/Makefile.am @@ -0,0 +1,18 @@ +# This is the src/Filters/Rules/Media level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Media + +pkgdata_PYTHON = \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Media +pkgpythondir = @pkgpythondir@/Filters/Rules/Media + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Media/__init__.py b/src/Filters/Rules/Media/__init__.py new file mode 100644 index 000000000..b73e6d238 --- /dev/null +++ b/src/Filters/Rules/Media/__init__.py @@ -0,0 +1,27 @@ +# +# 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: __init__.py 6521 2006-05-03 01:02:54Z rshura $ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" diff --git a/src/Filters/Rules/Person/Makefile.am b/src/Filters/Rules/Person/Makefile.am new file mode 100644 index 000000000..70c5c6ed3 --- /dev/null +++ b/src/Filters/Rules/Person/Makefile.am @@ -0,0 +1,74 @@ +# This is the src/Filters/Rules/Person level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Person + +pkgdata_PYTHON = \ + _Disconnected.py \ + _Everyone.py \ + _FamilyWithIncompleteEvent.py \ + _HasAttribute.py \ + _HasBirth.py \ + _HasCommonAncestorWith.py \ + _HasCommonAncestorWithFilterMatch.py \ + _HasCompleteRecord.py \ + _HasDeath.py \ + _HasEvent.py \ + _HasFamilyAttribute.py \ + _HasFamilyEvent.py \ + _HasIdOf.py \ + _HasNameOf.py \ + _HasNote.py \ + _HasNoteMatchingSubstringOf.py \ + _HasRelationship.py \ + _HasSourceOf.py \ + _HasTextMatchingRegexpOf.py \ + _HasTextMatchingSubstringOf.py \ + _HasUnknownGender.py \ + _HaveAltFamilies.py \ + _HaveChildren.py \ + _HavePhotos.py \ + _IncompleteNames.py \ + _IsAncestorOf.py \ + _IsAncestorOfFilterMatch.py \ + _IsBookmarked.py \ + _IsChildOfFilterMatch.py \ + _IsDefaultPerson.py \ + _IsDescendantFamilyOf.py \ + _IsDescendantOf.py \ + _IsDescendantOfFilterMatch.py \ + _IsFemale.py \ + _IsLessThanNthGenerationAncestorOf.py \ + _IsLessThanNthGenerationAncestorOfBookmarked.py \ + _IsLessThanNthGenerationAncestorOfDefaultPerson.py \ + _IsLessThanNthGenerationDescendantOf.py \ + _IsMale.py \ + _IsMoreThanNthGenerationAncestorOf.py \ + _IsMoreThanNthGenerationDescendantOf.py \ + _IsParentOfFilterMatch.py \ + _IsSiblingOfFilterMatch.py \ + _IsSpouseOfFilterMatch.py \ + _IsWitness.py \ + _MatchesFilter.py \ + _MultipleMarriages.py \ + _NeverMarried.py \ + _NoBirthdate.py \ + _PeoplePrivate.py \ + _PersonWithIncompleteEvent.py \ + _ProbablyAlive.py \ + _RelationshipPathBetween.py \ + _Rule.py \ + _RuleUtils.py \ + _SearchName.py \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Person +pkgpythondir = @pkgpythondir@/Filters/Rules/Person + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/_Disconnected.py b/src/Filters/Rules/Person/_Disconnected.py similarity index 97% rename from src/Filters/Rules/_Disconnected.py rename to src/Filters/Rules/Person/_Disconnected.py index 478fa52a3..c33dbc0f7 100644 --- a/src/Filters/Rules/_Disconnected.py +++ b/src/Filters/Rules/Person/_Disconnected.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_Everyone.py b/src/Filters/Rules/Person/_Everyone.py similarity index 97% rename from src/Filters/Rules/_Everyone.py rename to src/Filters/Rules/Person/_Everyone.py index ce0650d67..578e51962 100644 --- a/src/Filters/Rules/_Everyone.py +++ b/src/Filters/Rules/Person/_Everyone.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_FamilyWithIncompleteEvent.py b/src/Filters/Rules/Person/_FamilyWithIncompleteEvent.py similarity index 98% rename from src/Filters/Rules/_FamilyWithIncompleteEvent.py rename to src/Filters/Rules/Person/_FamilyWithIncompleteEvent.py index d3dfeb219..03873564a 100644 --- a/src/Filters/Rules/_FamilyWithIncompleteEvent.py +++ b/src/Filters/Rules/Person/_FamilyWithIncompleteEvent.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "Families with incomplete events" diff --git a/src/Filters/Rules/_HasAttribute.py b/src/Filters/Rules/Person/_HasAttribute.py similarity index 98% rename from src/Filters/Rules/_HasAttribute.py rename to src/Filters/Rules/Person/_HasAttribute.py index 0bcd18162..fa55716d9 100644 --- a/src/Filters/Rules/_HasAttribute.py +++ b/src/Filters/Rules/Person/_HasAttribute.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasBirth.py b/src/Filters/Rules/Person/_HasBirth.py similarity index 97% rename from src/Filters/Rules/_HasBirth.py rename to src/Filters/Rules/Person/_HasBirth.py index 0c61eacff..e7734caca 100644 --- a/src/Filters/Rules/_HasBirth.py +++ b/src/Filters/Rules/Person/_HasBirth.py @@ -33,8 +33,8 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler -from _Rule import Rule -from _RuleUtils import date_cmp +from Filters.Rules._Rule import Rule +from Filters.Rules._RuleUtils import date_cmp #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasCommonAncestorWith.py b/src/Filters/Rules/Person/_HasCommonAncestorWith.py similarity index 98% rename from src/Filters/Rules/_HasCommonAncestorWith.py rename to src/Filters/Rules/Person/_HasCommonAncestorWith.py index 63c4935b6..8d73daa31 100644 --- a/src/Filters/Rules/_HasCommonAncestorWith.py +++ b/src/Filters/Rules/Person/_HasCommonAncestorWith.py @@ -33,7 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- from Utils import for_each_ancestor -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasCommonAncestorWithFilterMatch.py b/src/Filters/Rules/Person/_HasCommonAncestorWithFilterMatch.py similarity index 100% rename from src/Filters/Rules/_HasCommonAncestorWithFilterMatch.py rename to src/Filters/Rules/Person/_HasCommonAncestorWithFilterMatch.py diff --git a/src/Filters/Rules/_HasCompleteRecord.py b/src/Filters/Rules/Person/_HasCompleteRecord.py similarity index 97% rename from src/Filters/Rules/_HasCompleteRecord.py rename to src/Filters/Rules/Person/_HasCompleteRecord.py index d6e5efd80..ecd09cb49 100644 --- a/src/Filters/Rules/_HasCompleteRecord.py +++ b/src/Filters/Rules/Person/_HasCompleteRecord.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasDeath.py b/src/Filters/Rules/Person/_HasDeath.py similarity index 97% rename from src/Filters/Rules/_HasDeath.py rename to src/Filters/Rules/Person/_HasDeath.py index ae92007fc..7e392c11b 100644 --- a/src/Filters/Rules/_HasDeath.py +++ b/src/Filters/Rules/Person/_HasDeath.py @@ -33,8 +33,8 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler -from _Rule import Rule -from _RuleUtils import date_cmp +from Filters.Rules._Rule import Rule +from Filters.Rules._RuleUtils import date_cmp #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasEvent.py b/src/Filters/Rules/Person/_HasEvent.py similarity index 97% rename from src/Filters/Rules/_HasEvent.py rename to src/Filters/Rules/Person/_HasEvent.py index 1188d897f..ce32f5613 100644 --- a/src/Filters/Rules/_HasEvent.py +++ b/src/Filters/Rules/Person/_HasEvent.py @@ -33,8 +33,8 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler -from _Rule import Rule -from _RuleUtils import date_cmp +from Filters.Rules._Rule import Rule +from Filters.Rules._RuleUtils import date_cmp #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasFamilyAttribute.py b/src/Filters/Rules/Person/_HasFamilyAttribute.py similarity index 98% rename from src/Filters/Rules/_HasFamilyAttribute.py rename to src/Filters/Rules/Person/_HasFamilyAttribute.py index 6e54dad20..471a71991 100644 --- a/src/Filters/Rules/_HasFamilyAttribute.py +++ b/src/Filters/Rules/Person/_HasFamilyAttribute.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasFamilyEvent.py b/src/Filters/Rules/Person/_HasFamilyEvent.py similarity index 97% rename from src/Filters/Rules/_HasFamilyEvent.py rename to src/Filters/Rules/Person/_HasFamilyEvent.py index 13040dab7..9522e22f9 100644 --- a/src/Filters/Rules/_HasFamilyEvent.py +++ b/src/Filters/Rules/Person/_HasFamilyEvent.py @@ -33,8 +33,8 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler -from _Rule import Rule -from _RuleUtils import date_cmp +from Filters.Rules._Rule import Rule +from Filters.Rules._RuleUtils import date_cmp #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasIdOf.py b/src/Filters/Rules/Person/_HasIdOf.py similarity index 97% rename from src/Filters/Rules/_HasIdOf.py rename to src/Filters/Rules/Person/_HasIdOf.py index 86291d58c..e0027661a 100644 --- a/src/Filters/Rules/_HasIdOf.py +++ b/src/Filters/Rules/Person/_HasIdOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasNameOf.py b/src/Filters/Rules/Person/_HasNameOf.py similarity index 98% rename from src/Filters/Rules/_HasNameOf.py rename to src/Filters/Rules/Person/_HasNameOf.py index 7a2345da3..c89542ac5 100644 --- a/src/Filters/Rules/_HasNameOf.py +++ b/src/Filters/Rules/Person/_HasNameOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasNote.py b/src/Filters/Rules/Person/_HasNote.py similarity index 97% rename from src/Filters/Rules/_HasNote.py rename to src/Filters/Rules/Person/_HasNote.py index e0f59e2b2..a19dd7a42 100644 --- a/src/Filters/Rules/_HasNote.py +++ b/src/Filters/Rules/Person/_HasNote.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People having notes" diff --git a/src/Filters/Rules/_HasNoteMatchingSubstringOf.py b/src/Filters/Rules/Person/_HasNoteMatchingSubstringOf.py similarity index 98% rename from src/Filters/Rules/_HasNoteMatchingSubstringOf.py rename to src/Filters/Rules/Person/_HasNoteMatchingSubstringOf.py index ade764beb..1c36a4e4e 100644 --- a/src/Filters/Rules/_HasNoteMatchingSubstringOf.py +++ b/src/Filters/Rules/Person/_HasNoteMatchingSubstringOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People having notes that contain a substring" diff --git a/src/Filters/Rules/_HasRelationship.py b/src/Filters/Rules/Person/_HasRelationship.py similarity index 98% rename from src/Filters/Rules/_HasRelationship.py rename to src/Filters/Rules/Person/_HasRelationship.py index 54fa52209..f7fb3f7ed 100644 --- a/src/Filters/Rules/_HasRelationship.py +++ b/src/Filters/Rules/Person/_HasRelationship.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_HasSourceOf.py b/src/Filters/Rules/Person/_HasSourceOf.py similarity index 98% rename from src/Filters/Rules/_HasSourceOf.py rename to src/Filters/Rules/Person/_HasSourceOf.py index 29dc857a0..4dad53c52 100644 --- a/src/Filters/Rules/_HasSourceOf.py +++ b/src/Filters/Rules/Person/_HasSourceOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/Person/_HasTextMatchingRegexpOf.py b/src/Filters/Rules/Person/_HasTextMatchingRegexpOf.py new file mode 100644 index 000000000..9d097b1cd --- /dev/null +++ b/src/Filters/Rules/Person/_HasTextMatchingRegexpOf.py @@ -0,0 +1,56 @@ +# +# 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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf + +#------------------------------------------------------------------------- +# "HasTextMatchingRegexOf" +#------------------------------------------------------------------------- +class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf): + """This is wrapping HasTextMatchingSubstringOf to enable the regex_match parameter""" + def __init__(self,list): + HasTextMatchingSubstringOf.__init__(self,list) + + def prepare(self,db): + self.db = db + self.person_map = {} + self.event_map = {} + self.source_map = {} + self.repo_map = {} + self.family_map = {} + self.place_map = {} + self.media_map = {} + self.case_sensitive = False + self.regexp_match = True + self.cache_sources() diff --git a/src/Filters/Rules/Person/_HasTextMatchingSubstringOf.py b/src/Filters/Rules/Person/_HasTextMatchingSubstringOf.py new file mode 100644 index 000000000..b242b81e1 --- /dev/null +++ b/src/Filters/Rules/Person/_HasTextMatchingSubstringOf.py @@ -0,0 +1,197 @@ +# +# 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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Utils import get_source_referents +from Filters.Rules._Rule import Rule + +#------------------------------------------------------------------------- +# "HasTextMatchingSubstringOf" +#------------------------------------------------------------------------- +class HasTextMatchingSubstringOf(Rule): + """Rule that checks for string matches in any textual information""" + + labels = [ _('Substring:'), + _('Case sensitive:'), + _('Regular-Expression matching:')] + name = _('People with records containing ') + description = _("Matches people whose records contain text " + "matching a substring") + category = _('General filters') + + def prepare(self,db): + self.db = db + self.person_map = {} + self.event_map = {} + self.source_map = {} + self.repo_map = {} + self.family_map = {} + self.place_map = {} + self.media_map = {} + try: + if int(self.list[1]): + self.case_sensitive = True + else: + self.case_sensitive = False + except IndexError: + self.case_sensitive = False + try: + if int(self.list[2]): + self.regexp_match = True + else: + self.regexp_match = False + except IndexError: + self.regexp_match = False + self.cache_repos() + self.cache_sources() + + def reset(self): + self.person_map = {} + self.event_map = {} + self.source_map = {} + self.repo_map = {} + self.family_map = {} + self.place_map = {} + self.media_map = {} + + def apply(self,db,person): + if person.handle in self.person_map: # Cached by matching Source? + return self.person_map[person.handle] + if self.match_object(person): # first match the person itself + return True + for event_ref in person.get_event_ref_list()+[person.get_birth_ref(), person.get_death_ref()]: + if self.search_event(event_ref.ref): # match referenced events + return True + for family_handle in person.get_family_handle_list(): # match families + if self.search_family(family_handle): + return True + for media_ref in person.get_media_list(): # match Media object + if self.search_media(media_ref.get_reference_handle()): + return True + return False + + def search_family(self,family_handle): + if not family_handle: + return False + # search inside the family and cache the result to not search a family twice + if not family_handle in self.family_map: + match = 0 + family = self.db.get_family_from_handle(family_handle) + if self.match_object(family): + match = 1 + else: + for event_ref in family.get_event_ref_list(): + if self.search_event(event_ref.ref): + match = 1 + break + for media_ref in family.get_media_list(): # match Media object + if self.search_media(media_ref.get_reference_handle()): + return True + self.family_map[family_handle] = match + return self.family_map[family_handle] + + def search_event(self,event_handle): + if not event_handle: + return False + # search inside the event and cache the result (event sharing) + if not event_handle in self.event_map: + match = 0 + event = self.db.get_event_from_handle(event_handle) + if self.match_object(event): + match = 1 + elif event: + place_handle = event.get_place_handle() + if place_handle: + if self.search_place(place_handle): + match = 1 + for media_ref in event.get_media_list(): # match Media object + if self.search_media(media_ref.get_reference_handle()): + return True + self.event_map[event_handle] = match + return self.event_map[event_handle] + + def search_place(self,place_handle): + if not place_handle: + return False + # search inside the place and cache the result + if not place_handle in self.place_map: + place = self.db.get_place_from_handle(place_handle) + self.place_map[place_handle] = self.match_object(place) + return self.place_map[place_handle] + + def search_media(self,media_handle): + if not media_handle: + return False + # search inside the place and cache the result + if not media_handle in self.media_map: + media = self.db.get_object_from_handle(media_handle) + self.media_map[media_handle] = self.match_object(media) + return self.media_map[media_handle] + + def cache_repos(self): + # search all matching repositories + for repo_handle in self.db.get_repository_handles(): + repo = self.db.get_repository_from_handle(repo_handle) + if( self.match_object(repo)): + self.repo_map[repo_handle] = 1 + + def cache_sources(self): + # search all sources and match all referents of a matching source + for source_handle in self.db.get_source_handles(): + source = self.db.get_source_from_handle(source_handle) + match = self.match_object(source) + if not match: + for reporef in source.get_reporef_list(): + if reporef.get_reference_handle() in self.repo_map: + match = 1 + if match: + (person_list,family_list,event_list, + place_list,source_list,media_list + ) = get_source_referents(source_handle,self.db) + for handle in person_list: + self.person_map[handle] = 1 + for handle in family_list: + self.family_map[handle] = 1 + for handle in event_list: + self.event_map[handle] = 1 + for handle in place_list: + self.place_map[handle] = 1 + for handle in media_list: + self.media_map[handle] = 1 + + def match_object(self,obj): + if not obj: + return False + if self.regexp_match: + return obj.matches_regexp(self.list[0],self.case_sensitive) + return obj.matches_string(self.list[0],self.case_sensitive) diff --git a/src/Filters/Rules/_HasUnknownGender.py b/src/Filters/Rules/Person/_HasUnknownGender.py similarity index 97% rename from src/Filters/Rules/_HasUnknownGender.py rename to src/Filters/Rules/Person/_HasUnknownGender.py index a276d0075..41698090e 100644 --- a/src/Filters/Rules/_HasUnknownGender.py +++ b/src/Filters/Rules/Person/_HasUnknownGender.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from RelLib import Person #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_HaveAltFamilies.py b/src/Filters/Rules/Person/_HaveAltFamilies.py similarity index 98% rename from src/Filters/Rules/_HaveAltFamilies.py rename to src/Filters/Rules/Person/_HaveAltFamilies.py index 250b1be50..2a6732f08 100644 --- a/src/Filters/Rules/_HaveAltFamilies.py +++ b/src/Filters/Rules/Person/_HaveAltFamilies.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from RelLib import ChildRefType #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_HaveChildren.py b/src/Filters/Rules/Person/_HaveChildren.py similarity index 97% rename from src/Filters/Rules/_HaveChildren.py rename to src/Filters/Rules/Person/_HaveChildren.py index ead4f3645..eb78d7e97 100644 --- a/src/Filters/Rules/_HaveChildren.py +++ b/src/Filters/Rules/Person/_HaveChildren.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People with children" diff --git a/src/Filters/Rules/_HavePhotos.py b/src/Filters/Rules/Person/_HavePhotos.py similarity index 97% rename from src/Filters/Rules/_HavePhotos.py rename to src/Filters/Rules/Person/_HavePhotos.py index 599b59690..bc0f7fdfd 100644 --- a/src/Filters/Rules/_HavePhotos.py +++ b/src/Filters/Rules/Person/_HavePhotos.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People who have images" diff --git a/src/Filters/Rules/_IncompleteNames.py b/src/Filters/Rules/Person/_IncompleteNames.py similarity index 98% rename from src/Filters/Rules/_IncompleteNames.py rename to src/Filters/Rules/Person/_IncompleteNames.py index 83739ddba..78b8aba80 100644 --- a/src/Filters/Rules/_IncompleteNames.py +++ b/src/Filters/Rules/Person/_IncompleteNames.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsAncestorOf.py b/src/Filters/Rules/Person/_IsAncestorOf.py similarity index 98% rename from src/Filters/Rules/_IsAncestorOf.py rename to src/Filters/Rules/Person/_IsAncestorOf.py index b769aa009..edcc78253 100644 --- a/src/Filters/Rules/_IsAncestorOf.py +++ b/src/Filters/Rules/Person/_IsAncestorOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsAncestorOfFilterMatch.py b/src/Filters/Rules/Person/_IsAncestorOfFilterMatch.py similarity index 100% rename from src/Filters/Rules/_IsAncestorOfFilterMatch.py rename to src/Filters/Rules/Person/_IsAncestorOfFilterMatch.py diff --git a/src/Filters/Rules/_IsBookmarked.py b/src/Filters/Rules/Person/_IsBookmarked.py similarity index 98% rename from src/Filters/Rules/_IsBookmarked.py rename to src/Filters/Rules/Person/_IsBookmarked.py index 737e7ce47..be1762c0e 100644 --- a/src/Filters/Rules/_IsBookmarked.py +++ b/src/Filters/Rules/Person/_IsBookmarked.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsChildOfFilterMatch.py b/src/Filters/Rules/Person/_IsChildOfFilterMatch.py similarity index 98% rename from src/Filters/Rules/_IsChildOfFilterMatch.py rename to src/Filters/Rules/Person/_IsChildOfFilterMatch.py index 17f8bf420..00f464559 100644 --- a/src/Filters/Rules/_IsChildOfFilterMatch.py +++ b/src/Filters/Rules/Person/_IsChildOfFilterMatch.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from _MatchesFilter import MatchesFilter #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_IsDefaultPerson.py b/src/Filters/Rules/Person/_IsDefaultPerson.py similarity index 98% rename from src/Filters/Rules/_IsDefaultPerson.py rename to src/Filters/Rules/Person/_IsDefaultPerson.py index 58a4eb975..3bbfb0f6f 100644 --- a/src/Filters/Rules/_IsDefaultPerson.py +++ b/src/Filters/Rules/Person/_IsDefaultPerson.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsDescendantFamilyOf.py b/src/Filters/Rules/Person/_IsDescendantFamilyOf.py similarity index 98% rename from src/Filters/Rules/_IsDescendantFamilyOf.py rename to src/Filters/Rules/Person/_IsDescendantFamilyOf.py index dbad21a29..7b533bb3b 100644 --- a/src/Filters/Rules/_IsDescendantFamilyOf.py +++ b/src/Filters/Rules/Person/_IsDescendantFamilyOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsDescendantOf.py b/src/Filters/Rules/Person/_IsDescendantOf.py similarity index 98% rename from src/Filters/Rules/_IsDescendantOf.py rename to src/Filters/Rules/Person/_IsDescendantOf.py index 4ae5a2910..9d27452ec 100644 --- a/src/Filters/Rules/_IsDescendantOf.py +++ b/src/Filters/Rules/Person/_IsDescendantOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsDescendantOfFilterMatch.py b/src/Filters/Rules/Person/_IsDescendantOfFilterMatch.py similarity index 100% rename from src/Filters/Rules/_IsDescendantOfFilterMatch.py rename to src/Filters/Rules/Person/_IsDescendantOfFilterMatch.py diff --git a/src/Filters/Rules/_IsFemale.py b/src/Filters/Rules/Person/_IsFemale.py similarity index 97% rename from src/Filters/Rules/_IsFemale.py rename to src/Filters/Rules/Person/_IsFemale.py index 1b6ab5143..5ba24530a 100644 --- a/src/Filters/Rules/_IsFemale.py +++ b/src/Filters/Rules/Person/_IsFemale.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from RelLib import Person #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_IsLessThanNthGenerationAncestorOf.py b/src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOf.py similarity index 98% rename from src/Filters/Rules/_IsLessThanNthGenerationAncestorOf.py rename to src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOf.py index a3ef13972..54a525870 100644 --- a/src/Filters/Rules/_IsLessThanNthGenerationAncestorOf.py +++ b/src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsLessThanNthGenerationAncestorOfBookmarked.py b/src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfBookmarked.py similarity index 98% rename from src/Filters/Rules/_IsLessThanNthGenerationAncestorOfBookmarked.py rename to src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfBookmarked.py index c7e578ce5..30c246ed8 100644 --- a/src/Filters/Rules/_IsLessThanNthGenerationAncestorOfBookmarked.py +++ b/src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfBookmarked.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsLessThanNthGenerationAncestorOfDefaultPerson.py b/src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfDefaultPerson.py similarity index 98% rename from src/Filters/Rules/_IsLessThanNthGenerationAncestorOfDefaultPerson.py rename to src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfDefaultPerson.py index 7fc8774c1..1e6214a36 100644 --- a/src/Filters/Rules/_IsLessThanNthGenerationAncestorOfDefaultPerson.py +++ b/src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfDefaultPerson.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsLessThanNthGenerationDescendantOf.py b/src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py similarity index 98% rename from src/Filters/Rules/_IsLessThanNthGenerationDescendantOf.py rename to src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py index 83b06880b..edce996fd 100644 --- a/src/Filters/Rules/_IsLessThanNthGenerationDescendantOf.py +++ b/src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsMale.py b/src/Filters/Rules/Person/_IsMale.py similarity index 97% rename from src/Filters/Rules/_IsMale.py rename to src/Filters/Rules/Person/_IsMale.py index 108b83ba4..bbd08a9ac 100644 --- a/src/Filters/Rules/_IsMale.py +++ b/src/Filters/Rules/Person/_IsMale.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from RelLib import Person #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_IsMoreThanNthGenerationAncestorOf.py b/src/Filters/Rules/Person/_IsMoreThanNthGenerationAncestorOf.py similarity index 98% rename from src/Filters/Rules/_IsMoreThanNthGenerationAncestorOf.py rename to src/Filters/Rules/Person/_IsMoreThanNthGenerationAncestorOf.py index 606a7a566..af7f17d6f 100644 --- a/src/Filters/Rules/_IsMoreThanNthGenerationAncestorOf.py +++ b/src/Filters/Rules/Person/_IsMoreThanNthGenerationAncestorOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsMoreThanNthGenerationDescendantOf.py b/src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py similarity index 98% rename from src/Filters/Rules/_IsMoreThanNthGenerationDescendantOf.py rename to src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py index 15a7196b2..999a4fd70 100644 --- a/src/Filters/Rules/_IsMoreThanNthGenerationDescendantOf.py +++ b/src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_IsParentOfFilterMatch.py b/src/Filters/Rules/Person/_IsParentOfFilterMatch.py similarity index 98% rename from src/Filters/Rules/_IsParentOfFilterMatch.py rename to src/Filters/Rules/Person/_IsParentOfFilterMatch.py index effacc578..2b72ddabe 100644 --- a/src/Filters/Rules/_IsParentOfFilterMatch.py +++ b/src/Filters/Rules/Person/_IsParentOfFilterMatch.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from _MatchesFilter import MatchesFilter #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_IsSiblingOfFilterMatch.py b/src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py similarity index 98% rename from src/Filters/Rules/_IsSiblingOfFilterMatch.py rename to src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py index 309350146..921ab8cfe 100644 --- a/src/Filters/Rules/_IsSiblingOfFilterMatch.py +++ b/src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from _MatchesFilter import MatchesFilter #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_IsSpouseOfFilterMatch.py b/src/Filters/Rules/Person/_IsSpouseOfFilterMatch.py similarity index 98% rename from src/Filters/Rules/_IsSpouseOfFilterMatch.py rename to src/Filters/Rules/Person/_IsSpouseOfFilterMatch.py index 52166fcab..b2966004f 100644 --- a/src/Filters/Rules/_IsSpouseOfFilterMatch.py +++ b/src/Filters/Rules/Person/_IsSpouseOfFilterMatch.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule from _MatchesFilter import MatchesFilter #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/_IsWitness.py b/src/Filters/Rules/Person/_IsWitness.py similarity index 98% rename from src/Filters/Rules/_IsWitness.py rename to src/Filters/Rules/Person/_IsWitness.py index f1031d55b..502cbc9cf 100644 --- a/src/Filters/Rules/_IsWitness.py +++ b/src/Filters/Rules/Person/_IsWitness.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "Witnesses" diff --git a/src/Filters/Rules/_MatchesFilter.py b/src/Filters/Rules/Person/_MatchesFilter.py similarity index 98% rename from src/Filters/Rules/_MatchesFilter.py rename to src/Filters/Rules/Person/_MatchesFilter.py index 87980ccca..1a469e39b 100644 --- a/src/Filters/Rules/_MatchesFilter.py +++ b/src/Filters/Rules/Person/_MatchesFilter.py @@ -33,7 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- from Filters import SystemFilters, CustomFilters -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_MultipleMarriages.py b/src/Filters/Rules/Person/_MultipleMarriages.py similarity index 97% rename from src/Filters/Rules/_MultipleMarriages.py rename to src/Filters/Rules/Person/_MultipleMarriages.py index 14821bd04..39b9384eb 100644 --- a/src/Filters/Rules/_MultipleMarriages.py +++ b/src/Filters/Rules/Person/_MultipleMarriages.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People with multiple marriage records" diff --git a/src/Filters/Rules/_NeverMarried.py b/src/Filters/Rules/Person/_NeverMarried.py similarity index 97% rename from src/Filters/Rules/_NeverMarried.py rename to src/Filters/Rules/Person/_NeverMarried.py index e168bf239..d7cc6d909 100644 --- a/src/Filters/Rules/_NeverMarried.py +++ b/src/Filters/Rules/Person/_NeverMarried.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People with no marriage records" diff --git a/src/Filters/Rules/_NoBirthdate.py b/src/Filters/Rules/Person/_NoBirthdate.py similarity index 98% rename from src/Filters/Rules/_NoBirthdate.py rename to src/Filters/Rules/Person/_NoBirthdate.py index 7a2f931b3..6ccc58412 100644 --- a/src/Filters/Rules/_NoBirthdate.py +++ b/src/Filters/Rules/Person/_NoBirthdate.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People without a birth date" diff --git a/src/Filters/Rules/_PeoplePrivate.py b/src/Filters/Rules/Person/_PeoplePrivate.py similarity index 92% rename from src/Filters/Rules/_PeoplePrivate.py rename to src/Filters/Rules/Person/_PeoplePrivate.py index 029151917..bf7a7fb66 100644 --- a/src/Filters/Rules/_PeoplePrivate.py +++ b/src/Filters/Rules/Person/_PeoplePrivate.py @@ -32,17 +32,14 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._IsPrivate import IsPrivate #------------------------------------------------------------------------- # "People marked private" #------------------------------------------------------------------------- -class PeoplePrivate(Rule): +class PeoplePrivate(IsPrivate): """People marked private""" name = _('People marked private') description = _("Matches people that are indicated as private") category = _('General filters') - - def apply(self,db,person): - return person.get_privacy() diff --git a/src/Filters/Rules/_PersonWithIncompleteEvent.py b/src/Filters/Rules/Person/_PersonWithIncompleteEvent.py similarity index 98% rename from src/Filters/Rules/_PersonWithIncompleteEvent.py rename to src/Filters/Rules/Person/_PersonWithIncompleteEvent.py index 221af6410..c5c6fa415 100644 --- a/src/Filters/Rules/_PersonWithIncompleteEvent.py +++ b/src/Filters/Rules/Person/_PersonWithIncompleteEvent.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People with incomplete events" diff --git a/src/Filters/Rules/_ProbablyAlive.py b/src/Filters/Rules/Person/_ProbablyAlive.py similarity index 98% rename from src/Filters/Rules/_ProbablyAlive.py rename to src/Filters/Rules/Person/_ProbablyAlive.py index bb02632a9..855dab517 100644 --- a/src/Filters/Rules/_ProbablyAlive.py +++ b/src/Filters/Rules/Person/_ProbablyAlive.py @@ -33,7 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- from Utils import probably_alive -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # "People probably alive" diff --git a/src/Filters/Rules/_RelationshipPathBetween.py b/src/Filters/Rules/Person/_RelationshipPathBetween.py similarity index 99% rename from src/Filters/Rules/_RelationshipPathBetween.py rename to src/Filters/Rules/Person/_RelationshipPathBetween.py index 21d462ba8..755d5bcc5 100644 --- a/src/Filters/Rules/_RelationshipPathBetween.py +++ b/src/Filters/Rules/Person/_RelationshipPathBetween.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule #------------------------------------------------------------------------- # diff --git a/src/Filters/Rules/_SearchName.py b/src/Filters/Rules/Person/_SearchName.py similarity index 98% rename from src/Filters/Rules/_SearchName.py rename to src/Filters/Rules/Person/_SearchName.py index 8874b6c63..035f2fe4a 100644 --- a/src/Filters/Rules/_SearchName.py +++ b/src/Filters/Rules/Person/_SearchName.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from _Rule import Rule +from Filters.Rules._Rule import Rule import NameDisplay #------------------------------------------------------------------------- diff --git a/src/Filters/Rules/Person/__init__.py b/src/Filters/Rules/Person/__init__.py new file mode 100644 index 000000000..cec0fb01a --- /dev/null +++ b/src/Filters/Rules/Person/__init__.py @@ -0,0 +1,148 @@ +# +# 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$ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" + +from _Disconnected import Disconnected +from _Everyone import Everyone +from _FamilyWithIncompleteEvent import FamilyWithIncompleteEvent +from _HasAttribute import HasAttribute +from _HasBirth import HasBirth +from _HasCommonAncestorWith import HasCommonAncestorWith +from _HasCommonAncestorWithFilterMatch import HasCommonAncestorWithFilterMatch +from _HasCompleteRecord import HasCompleteRecord +from _HasDeath import HasDeath +from _HasEvent import HasEvent +from _HasFamilyAttribute import HasFamilyAttribute +from _HasFamilyEvent import HasFamilyEvent +from _HasIdOf import HasIdOf +from _HasNameOf import HasNameOf +from _HasNote import HasNote +from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf +from _HasRelationship import HasRelationship +from _HasSourceOf import HasSourceOf +from _HasTextMatchingRegexpOf import HasTextMatchingRegexpOf +from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf +from _HasUnknownGender import HasUnknownGender +from _HaveAltFamilies import HaveAltFamilies +from _HaveChildren import HaveChildren +from _HavePhotos import HavePhotos +from _IncompleteNames import IncompleteNames +from _IsAncestorOf import IsAncestorOf +from _IsAncestorOfFilterMatch import IsAncestorOfFilterMatch +from _IsBookmarked import IsBookmarked +from _IsChildOfFilterMatch import IsChildOfFilterMatch +from _IsDefaultPerson import IsDefaultPerson +from _IsDescendantFamilyOf import IsDescendantFamilyOf +from _IsDescendantOf import IsDescendantOf +from _IsDescendantOfFilterMatch import IsDescendantOfFilterMatch +from _IsFemale import IsFemale +from _IsLessThanNthGenerationAncestorOf import \ + IsLessThanNthGenerationAncestorOf +from _IsLessThanNthGenerationAncestorOfBookmarked import \ + IsLessThanNthGenerationAncestorOfBookmarked +from _IsLessThanNthGenerationAncestorOfDefaultPerson import \ + IsLessThanNthGenerationAncestorOfDefaultPerson +from _IsLessThanNthGenerationDescendantOf import \ + IsLessThanNthGenerationDescendantOf +from _IsMale import IsMale +from _IsMoreThanNthGenerationAncestorOf import \ + IsMoreThanNthGenerationAncestorOf +from _IsMoreThanNthGenerationDescendantOf import \ + IsMoreThanNthGenerationDescendantOf +from _IsParentOfFilterMatch import IsParentOfFilterMatch +from _IsSiblingOfFilterMatch import IsSiblingOfFilterMatch +from _IsSpouseOfFilterMatch import IsSpouseOfFilterMatch +from _IsWitness import IsWitness +from _MatchesFilter import MatchesFilter +from _MultipleMarriages import MultipleMarriages +from _NeverMarried import NeverMarried +from _NoBirthdate import NoBirthdate +from _PeoplePrivate import PeoplePrivate +from _PersonWithIncompleteEvent import PersonWithIncompleteEvent +from _ProbablyAlive import ProbablyAlive +from _RelationshipPathBetween import RelationshipPathBetween +from Filters.Rules._Rule import Rule +from _SearchName import SearchName + +#------------------------------------------------------------------------- +# +# This is used by Custom Filter Editor tool +# +#------------------------------------------------------------------------- +editor_rule_list = [ + Everyone, + IsFemale, + HasUnknownGender, + IsMale, + IsDefaultPerson, + IsBookmarked, + HasIdOf, + HasNameOf, + HasRelationship, + HasDeath, + HasBirth, + HasCompleteRecord, + HasEvent, + HasFamilyEvent, + HasAttribute, + HasFamilyAttribute, + HasSourceOf, + HaveAltFamilies, + HavePhotos, + HaveChildren, + IncompleteNames, + NeverMarried, + MultipleMarriages, + NoBirthdate, + PersonWithIncompleteEvent, + FamilyWithIncompleteEvent, + ProbablyAlive, + PeoplePrivate, + IsWitness, + IsDescendantOf, + IsDescendantFamilyOf, + IsLessThanNthGenerationAncestorOfDefaultPerson, + IsDescendantOfFilterMatch, + IsLessThanNthGenerationDescendantOf, + IsMoreThanNthGenerationDescendantOf, + IsAncestorOf, + IsAncestorOfFilterMatch, + IsLessThanNthGenerationAncestorOf, + IsLessThanNthGenerationAncestorOfBookmarked, + IsMoreThanNthGenerationAncestorOf, + HasCommonAncestorWith, + HasCommonAncestorWithFilterMatch, + MatchesFilter, + IsChildOfFilterMatch, + IsParentOfFilterMatch, + IsSpouseOfFilterMatch, + IsSiblingOfFilterMatch, + RelationshipPathBetween, + HasTextMatchingSubstringOf, + HasNote, + HasNoteMatchingSubstringOf +] diff --git a/src/Filters/Rules/Place/Makefile.am b/src/Filters/Rules/Place/Makefile.am new file mode 100644 index 000000000..551818bba --- /dev/null +++ b/src/Filters/Rules/Place/Makefile.am @@ -0,0 +1,18 @@ +# This is the src/Filters/Rules/Place level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Place + +pkgdata_PYTHON = \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Place +pkgpythondir = @pkgpythondir@/Filters/Rules/Place + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Place/__init__.py b/src/Filters/Rules/Place/__init__.py new file mode 100644 index 000000000..b73e6d238 --- /dev/null +++ b/src/Filters/Rules/Place/__init__.py @@ -0,0 +1,27 @@ +# +# 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: __init__.py 6521 2006-05-03 01:02:54Z rshura $ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" diff --git a/src/Filters/Rules/Repository/Makefile.am b/src/Filters/Rules/Repository/Makefile.am new file mode 100644 index 000000000..13fa0f23a --- /dev/null +++ b/src/Filters/Rules/Repository/Makefile.am @@ -0,0 +1,18 @@ +# This is the src/Filters/Rules/Media level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Repository + +pkgdata_PYTHON = \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Repository +pkgpythondir = @pkgpythondir@/Filters/Rules/Repository + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Repository/__init__.py b/src/Filters/Rules/Repository/__init__.py new file mode 100644 index 000000000..b73e6d238 --- /dev/null +++ b/src/Filters/Rules/Repository/__init__.py @@ -0,0 +1,27 @@ +# +# 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: __init__.py 6521 2006-05-03 01:02:54Z rshura $ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" diff --git a/src/Filters/Rules/Source/Makefile.am b/src/Filters/Rules/Source/Makefile.am new file mode 100644 index 000000000..87e292b62 --- /dev/null +++ b/src/Filters/Rules/Source/Makefile.am @@ -0,0 +1,18 @@ +# This is the src/Filters/Rules/Source level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Source + +pkgdata_PYTHON = \ + __init__.py + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Source +pkgpythondir = @pkgpythondir@/Filters/Rules/Source + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Source/__init__.py b/src/Filters/Rules/Source/__init__.py new file mode 100644 index 000000000..b73e6d238 --- /dev/null +++ b/src/Filters/Rules/Source/__init__.py @@ -0,0 +1,27 @@ +# +# 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: __init__.py 6521 2006-05-03 01:02:54Z rshura $ + +""" +Package providing filter rules for GRAMPS. +""" + +__author__ = "Don Allingham" diff --git a/src/Filters/Rules/_Everything.py b/src/Filters/Rules/_Everything.py new file mode 100644 index 000000000..ac809936b --- /dev/null +++ b/src/Filters/Rules/_Everything.py @@ -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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from _Rule import Rule + +#------------------------------------------------------------------------- +# +# Everyone +# +#------------------------------------------------------------------------- +class Everything(Rule): + """Matches Everyone""" + + name = _('Every object') + category = _('General filters') + description = _('Matches every object in the database') + + def is_empty(self): + return True + + def apply(self,db,obj): + return True diff --git a/src/Filters/Rules/_HasTextMatchingRegexpOf.py b/src/Filters/Rules/_HasTextMatchingRegexpOf.py index 9d097b1cd..fac655eb1 100644 --- a/src/Filters/Rules/_HasTextMatchingRegexpOf.py +++ b/src/Filters/Rules/_HasTextMatchingRegexpOf.py @@ -42,15 +42,5 @@ class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf): def __init__(self,list): HasTextMatchingSubstringOf.__init__(self,list) - def prepare(self,db): - self.db = db - self.person_map = {} - self.event_map = {} - self.source_map = {} - self.repo_map = {} - self.family_map = {} - self.place_map = {} - self.media_map = {} - self.case_sensitive = False - self.regexp_match = True - self.cache_sources() + # FIXME: This needs to be written for an arbitrary object + # if possible diff --git a/src/Filters/Rules/_HasTextMatchingSubstringOf.py b/src/Filters/Rules/_HasTextMatchingSubstringOf.py index a31695c28..68a3c3888 100644 --- a/src/Filters/Rules/_HasTextMatchingSubstringOf.py +++ b/src/Filters/Rules/_HasTextMatchingSubstringOf.py @@ -49,149 +49,5 @@ class HasTextMatchingSubstringOf(Rule): "matching a substring") category = _('General filters') - def prepare(self,db): - self.db = db - self.person_map = {} - self.event_map = {} - self.source_map = {} - self.repo_map = {} - self.family_map = {} - self.place_map = {} - self.media_map = {} - try: - if int(self.list[1]): - self.case_sensitive = True - else: - self.case_sensitive = False - except IndexError: - self.case_sensitive = False - try: - if int(self.list[2]): - self.regexp_match = True - else: - self.regexp_match = False - except IndexError: - self.regexp_match = False - self.cache_repos() - self.cache_sources() - - def reset(self): - self.person_map = {} - self.event_map = {} - self.source_map = {} - self.repo_map = {} - self.family_map = {} - self.place_map = {} - self.media_map = {} - - def apply(self,db,person): - if person.handle in self.person_map: # Cached by matching Source? - return self.person_map[person.handle] - if self.match_object(person): # first match the person itself - return True - for event_ref in person.get_event_ref_list()+[person.get_birth_ref(), person.get_death_ref()]: - if self.search_event(event_ref.ref): # match referenced events - return True - for family_handle in person.get_family_handle_list(): # match families - if self.search_family(family_handle): - return True - for media_ref in person.get_media_list(): # match Media object - if self.search_media(media_ref.get_reference_handle()): - return True - return False - - def search_family(self,family_handle): - if not family_handle: - return False - # search inside the family and cache the result to not search a family twice - if not family_handle in self.family_map: - match = 0 - family = self.db.get_family_from_handle(family_handle) - if self.match_object(family): - match = 1 - else: - for event_ref in family.get_event_ref_list(): - if self.search_event(event_ref.ref): - match = 1 - break - for media_ref in family.get_media_list(): # match Media object - if self.search_media(media_ref.get_reference_handle()): - return True - self.family_map[family_handle] = match - return self.family_map[family_handle] - - def search_event(self,event_handle): - if not event_handle: - return False - # search inside the event and cache the result (event sharing) - if not event_handle in self.event_map: - match = 0 - event = self.db.get_event_from_handle(event_handle) - if self.match_object(event): - match = 1 - elif event: - place_handle = event.get_place_handle() - if place_handle: - if self.search_place(place_handle): - match = 1 - for media_ref in event.get_media_list(): # match Media object - if self.search_media(media_ref.get_reference_handle()): - return True - self.event_map[event_handle] = match - return self.event_map[event_handle] - - def search_place(self,place_handle): - if not place_handle: - return False - # search inside the place and cache the result - if not place_handle in self.place_map: - place = self.db.get_place_from_handle(place_handle) - self.place_map[place_handle] = self.match_object(place) - return self.place_map[place_handle] - - def search_media(self,media_handle): - if not media_handle: - return False - # search inside the place and cache the result - if not media_handle in self.media_map: - media = self.db.get_object_from_handle(media_handle) - self.media_map[media_handle] = self.match_object(media) - return self.media_map[media_handle] - - def cache_repos(self): - # search all matching repositories - for repo_handle in self.db.get_repository_handles(): - repo = self.db.get_repository_from_handle(repo_handle) - if( self.match_object(repo)): - self.repo_map[repo_handle] = 1 - - def cache_sources(self): - # search all sources and match all referents of a matching source - for source_handle in self.db.get_source_handles(): - source = self.db.get_source_from_handle(source_handle) - match = self.match_object(source) - if not match: - for reporef in source.get_reporef_list(): - if reporef.get_reference_handle() in self.repo_map: - match = 1 - if match: - (person_list,family_list,event_list, - place_list,source_list,media_list - ) = get_source_referents(source_handle,self.db) - for handle in person_list: - self.person_map[handle] = 1 - for handle in family_list: - self.family_map[handle] = 1 - for handle in event_list: - self.event_map[handle] = 1 - for handle in place_list: - self.place_map[handle] = 1 - for handle in media_list: - self.media_map[handle] = 1 - - def match_object(self,obj): - if not obj: - return False - if self.regexp_match: - return obj.matches_regexp(self.list[0],self.case_sensitive) - return obj.matches_string(self.list[0],self.case_sensitive) + # FIXME: This needs to be written for an arbitrary object + # if possible diff --git a/src/Filters/Rules/_IsPrivate.py b/src/Filters/Rules/_IsPrivate.py new file mode 100644 index 000000000..38d9789f9 --- /dev/null +++ b/src/Filters/Rules/_IsPrivate.py @@ -0,0 +1,48 @@ +# +# 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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from _Rule import Rule + +#------------------------------------------------------------------------- +# "People marked private" +#------------------------------------------------------------------------- +class IsPrivate(Rule): + """Objects marked private""" + + name = _('Objects marked private') + description = _("Matches objects that are indicated as private") + category = _('General filters') + + def apply(self,db,obj): + return obj.get_privacy() diff --git a/src/Filters/Rules/__init__.py b/src/Filters/Rules/__init__.py index b548d1168..ad7ed8f01 100644 --- a/src/Filters/Rules/__init__.py +++ b/src/Filters/Rules/__init__.py @@ -26,121 +26,15 @@ Package providing filter rules for GRAMPS. __author__ = "Don Allingham" -from _Disconnected import Disconnected -from _Everyone import Everyone -from _FamilyWithIncompleteEvent import FamilyWithIncompleteEvent -from _HasAttribute import HasAttribute -from _HasBirth import HasBirth -from _HasCommonAncestorWith import HasCommonAncestorWith -from _HasCommonAncestorWithFilterMatch import HasCommonAncestorWithFilterMatch -from _HasCompleteRecord import HasCompleteRecord -from _HasDeath import HasDeath -from _HasEvent import HasEvent -from _HasFamilyAttribute import HasFamilyAttribute -from _HasFamilyEvent import HasFamilyEvent -from _HasIdOf import HasIdOf -from _HasNameOf import HasNameOf -from _HasNote import HasNote -from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf -from _HasRelationship import HasRelationship -from _HasSourceOf import HasSourceOf -from _HasTextMatchingRegexpOf import HasTextMatchingRegexpOf +from _Everything import Everything +from _IsPrivate import IsPrivate from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf -from _HasUnknownGender import HasUnknownGender -from _HaveAltFamilies import HaveAltFamilies -from _HaveChildren import HaveChildren -from _HavePhotos import HavePhotos -from _IncompleteNames import IncompleteNames -from _IsAncestorOf import IsAncestorOf -from _IsAncestorOfFilterMatch import IsAncestorOfFilterMatch -from _IsBookmarked import IsBookmarked -from _IsChildOfFilterMatch import IsChildOfFilterMatch -from _IsDefaultPerson import IsDefaultPerson -from _IsDescendantFamilyOf import IsDescendantFamilyOf -from _IsDescendantOf import IsDescendantOf -from _IsDescendantOfFilterMatch import IsDescendantOfFilterMatch -from _IsFemale import IsFemale -from _IsLessThanNthGenerationAncestorOf import IsLessThanNthGenerationAncestorOf -from _IsLessThanNthGenerationAncestorOfBookmarked import \ - IsLessThanNthGenerationAncestorOfBookmarked -from _IsLessThanNthGenerationAncestorOfDefaultPerson import \ - IsLessThanNthGenerationAncestorOfDefaultPerson -from _IsLessThanNthGenerationDescendantOf import \ - IsLessThanNthGenerationDescendantOf -from _IsMale import IsMale -from _IsMoreThanNthGenerationAncestorOf import IsMoreThanNthGenerationAncestorOf -from _IsMoreThanNthGenerationDescendantOf import \ - IsMoreThanNthGenerationDescendantOf -from _IsParentOfFilterMatch import IsParentOfFilterMatch -from _IsSiblingOfFilterMatch import IsSiblingOfFilterMatch -from _IsSpouseOfFilterMatch import IsSpouseOfFilterMatch -from _IsWitness import IsWitness -from _MatchesFilter import MatchesFilter -from _MultipleMarriages import MultipleMarriages -from _NeverMarried import NeverMarried -from _NoBirthdate import NoBirthdate -from _PeoplePrivate import PeoplePrivate -from _PersonWithIncompleteEvent import PersonWithIncompleteEvent -from _ProbablyAlive import ProbablyAlive -from _RelationshipPathBetween import RelationshipPathBetween -from _Rule import Rule -from _SearchName import SearchName +from _HasTextMatchingRegexpOf import HasTextMatchingRegexpOf -#------------------------------------------------------------------------- -# -# This is used by Custom Filter Editor tool -# -#------------------------------------------------------------------------- -editor_rule_list = [ - Everyone, - IsFemale, - HasUnknownGender, - IsMale, - IsDefaultPerson, - IsBookmarked, - HasIdOf, - HasNameOf, - HasRelationship, - HasDeath, - HasBirth, - HasCompleteRecord, - HasEvent, - HasFamilyEvent, - HasAttribute, - HasFamilyAttribute, - HasSourceOf, - HaveAltFamilies, - HavePhotos, - HaveChildren, - IncompleteNames, - NeverMarried, - MultipleMarriages, - NoBirthdate, - PersonWithIncompleteEvent, - FamilyWithIncompleteEvent, - ProbablyAlive, - PeoplePrivate, - IsWitness, - IsDescendantOf, - IsDescendantFamilyOf, - IsLessThanNthGenerationAncestorOfDefaultPerson, - IsDescendantOfFilterMatch, - IsLessThanNthGenerationDescendantOf, - IsMoreThanNthGenerationDescendantOf, - IsAncestorOf, - IsAncestorOfFilterMatch, - IsLessThanNthGenerationAncestorOf, - IsLessThanNthGenerationAncestorOfBookmarked, - IsMoreThanNthGenerationAncestorOf, - HasCommonAncestorWith, - HasCommonAncestorWithFilterMatch, - MatchesFilter, - IsChildOfFilterMatch, - IsParentOfFilterMatch, - IsSpouseOfFilterMatch, - IsSiblingOfFilterMatch, - RelationshipPathBetween, - HasTextMatchingSubstringOf, - HasNote, - HasNoteMatchingSubstringOf -] +import Person +import Family +import Event +import Source +import Place +import Media +import Repository diff --git a/src/Filters/_FilterList.py b/src/Filters/_FilterList.py index dfcce1126..297634bb2 100644 --- a/src/Filters/_FilterList.py +++ b/src/Filters/_FilterList.py @@ -88,16 +88,15 @@ class FilterList: f.write('\n' % namespace) filter_list = self.filter_namespaces[namespace] for the_filter in filter_list: - f.write(' \n') for rule in the_filter.get_rules(): - rule_class_name = rule.__class__.__name__ - rule_save_name = "Filters.Rules.%s" % rule_class_name - f.write(' \n' % rule_save_name) + f.write(' \n' + % rule.__class__.__name__) for v in rule.values(): f.write(' \n' % self.fix(v)) f.write(' \n') diff --git a/src/Filters/_FilterParser.py b/src/Filters/_FilterParser.py index 747690b7b..99ce4a874 100644 --- a/src/Filters/_FilterParser.py +++ b/src/Filters/_FilterParser.py @@ -50,7 +50,7 @@ class FilterParser(handler.ContentHandler): self.r = None self.a = [] self.cname = None - self.namespace = "person" + self.namespace = "Person" def setDocumentLocator(self,locator): self.locator = locator @@ -84,13 +84,15 @@ class FilterParser(handler.ContentHandler): try: # First try to use fully qualified name exec 'self.r = %s' % save_name - except (ImportError,NameError,AttributeError): - # Now try to use name from Rules + except (ImportError, NameError, AttributeError ): + # Now try to use name from Rules.Namespace mc_match = save_name.split('.') try: - exec 'self.r = Rules.%s' % mc_match[-1] - except (ImportError,NameError): - print "ERROR: Filter rule '%s' in filter '%s' not found!"\ + exec 'self.r = Rules.%s.%s' % ( + self.namespace,mc_match[-1]) + except (ImportError, NameError ): + print "ERROR: Filter rule '%s' in "\ + "filter '%s' not found!"\ % (save_name,self.f.get_name()) self.r = None return @@ -124,56 +126,58 @@ class FilterParser(handler.ContentHandler): # This dict is mapping from old names to new names, so that the existing # custom_filters.xml will continue working old_names_2_class = { - "Everyone" : Rules.Everyone, - "Is default person" : Rules.IsDefaultPerson, - "Is bookmarked person" : Rules.IsBookmarked, - "Has the Id" : Rules.HasIdOf, - "Has a name" : Rules.HasNameOf, - "Has the relationships" : Rules.HasRelationship, - "Has the death" : Rules.HasDeath, - "Has the birth" : Rules.HasBirth, - "Is a descendant of" : Rules.IsDescendantOf, - "Is a descendant family member of" : Rules.IsDescendantFamilyOf, - "Is a descendant of filter match": Rules.IsDescendantOfFilterMatch, + "Everyone" : Rules.Person.Everyone, + "Is default person" : Rules.Person.IsDefaultPerson, + "Is bookmarked person" : Rules.Person.IsBookmarked, + "Has the Id" : Rules.Person.HasIdOf, + "Has a name" : Rules.Person.HasNameOf, + "Has the relationships" : Rules.Person.HasRelationship, + "Has the death" : Rules.Person.HasDeath, + "Has the birth" : Rules.Person.HasBirth, + "Is a descendant of" : Rules.Person.IsDescendantOf, + "Is a descendant family member of" : Rules.Person.IsDescendantFamilyOf, + "Is a descendant of filter match": Rules.Person.IsDescendantOfFilterMatch, "Is a descendant of person not more than N generations away": - Rules.IsLessThanNthGenerationDescendantOf, + Rules.Person.IsLessThanNthGenerationDescendantOf, "Is a descendant of person at least N generations away": - Rules.IsMoreThanNthGenerationDescendantOf, + Rules.Person.IsMoreThanNthGenerationDescendantOf, "Is an descendant of person at least N generations away" : - Rules.IsMoreThanNthGenerationDescendantOf, - "Is a child of filter match" : Rules.IsChildOfFilterMatch, - "Is an ancestor of" : Rules.IsAncestorOf, - "Is an ancestor of filter match": Rules.IsAncestorOfFilterMatch, + Rules.Person.IsMoreThanNthGenerationDescendantOf, + "Is a child of filter match" : Rules.Person.IsChildOfFilterMatch, + "Is an ancestor of" : Rules.Person.IsAncestorOf, + "Is an ancestor of filter match": Rules.Person.IsAncestorOfFilterMatch, "Is an ancestor of person not more than N generations away" : - Rules.IsLessThanNthGenerationAncestorOf, + Rules.Person.IsLessThanNthGenerationAncestorOf, "Is an ancestor of person at least N generations away": - Rules.IsMoreThanNthGenerationAncestorOf, - "Is a parent of filter match" : Rules.IsParentOfFilterMatch, - "Has a common ancestor with" : Rules.HasCommonAncestorWith, - "Has a common ancestor with filter match" :Rules.HasCommonAncestorWithFilterMatch, - "Is a female" : Rules.IsFemale, - "Is a male" : Rules.IsMale, - "Has complete record" : Rules.HasCompleteRecord, - "Has the personal event" : Rules.HasEvent, - "Has the family event" : Rules.HasFamilyEvent, - "Has the personal attribute" : Rules.HasAttribute, - "Has the family attribute" : Rules.HasFamilyAttribute, - "Has source of" : Rules.HasSourceOf, - "Matches the filter named" : Rules.HasSourceOf, - "Is spouse of filter match" : Rules.IsSpouseOfFilterMatch, - "Is a sibling of filter match" : Rules.IsSiblingOfFilterMatch, - "Relationship path between two people" : Rules.RelationshipPathBetween, - "People who were adopted" : Rules.HaveAltFamilies, - "People who have images" : Rules.HavePhotos, - "People with children" : Rules.HaveChildren, - "People with incomplete names" : Rules.IncompleteNames, - "People with no marriage records" : Rules.NeverMarried, - "People with multiple marriage records": Rules.MultipleMarriages, - "People without a birth date" : Rules.NoBirthdate, - "People with incomplete events" : Rules.PersonWithIncompleteEvent, - "Families with incomplete events" :Rules.FamilyWithIncompleteEvent, - "People probably alive" : Rules.ProbablyAlive, - "People marked private" : Rules.PeoplePrivate, - "Witnesses" : Rules.IsWitness, - "Has text matching substring of": Rules.HasTextMatchingSubstringOf, + Rules.Person.IsMoreThanNthGenerationAncestorOf, + "Is a parent of filter match" : Rules.Person.IsParentOfFilterMatch, + "Has a common ancestor with" : Rules.Person.HasCommonAncestorWith, + "Has a common ancestor with filter match" : + Rules.Person.HasCommonAncestorWithFilterMatch, + "Is a female" : Rules.Person.IsFemale, + "Is a male" : Rules.Person.IsMale, + "Has complete record" : Rules.Person.HasCompleteRecord, + "Has the personal event" : Rules.Person.HasEvent, + "Has the family event" : Rules.Person.HasFamilyEvent, + "Has the personal attribute" : Rules.Person.HasAttribute, + "Has the family attribute" : Rules.Person.HasFamilyAttribute, + "Has source of" : Rules.Person.HasSourceOf, + "Matches the filter named" : Rules.Person.HasSourceOf, + "Is spouse of filter match" : Rules.Person.IsSpouseOfFilterMatch, + "Is a sibling of filter match" : Rules.Person.IsSiblingOfFilterMatch, + "Relationship path between two people" : + Rules.Person.RelationshipPathBetween, + "People who were adopted" : Rules.Person.HaveAltFamilies, + "People who have images" : Rules.Person.HavePhotos, + "People with children" : Rules.Person.HaveChildren, + "People with incomplete names" : Rules.Person.IncompleteNames, + "People with no marriage records" : Rules.Person.NeverMarried, + "People with multiple marriage records": Rules.Person.MultipleMarriages, + "People without a birth date" : Rules.Person.NoBirthdate, + "People with incomplete events" : Rules.Person.PersonWithIncompleteEvent, + "Families with incomplete events" :Rules.Person.FamilyWithIncompleteEvent, + "People probably alive" : Rules.Person.ProbablyAlive, + "People marked private" : Rules.Person.PeoplePrivate, + "Witnesses" : Rules.Person.IsWitness, + "Has text matching substring of": Rules.Person.HasTextMatchingSubstringOf, } diff --git a/src/GrampsDb/_WriteGedcom.py b/src/GrampsDb/_WriteGedcom.py index f6daa8e42..46a38f3a8 100644 --- a/src/GrampsDb/_WriteGedcom.py +++ b/src/GrampsDb/_WriteGedcom.py @@ -372,25 +372,25 @@ class GedcomWriterOptionBox: all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) if self.person: des = GenericFilter() des.set_name(_("Descendants of %s") % NameDisplay.displayer.display(self.person)) - des.add_rule(Rules.IsDescendantOf( + des.add_rule(Rules.Person.IsDescendantOf( [self.person.get_gramps_id(),1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % NameDisplay.displayer.display(self.person)) - ans.add_rule(Rules.IsAncestorOf( + ans.add_rule(Rules.Person.IsAncestorOf( [self.person.get_gramps_id(),1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % NameDisplay.displayer.display(self.person)) - com.add_rule(Rules.HasCommonAncestorWith( + com.add_rule(Rules.Person.HasCommonAncestorWith( [self.person.get_gramps_id()])) self.filter_menu = build_filter_menu([all,des,ans,com]) diff --git a/src/ObjectSelector/_PersonFilterFrame.py b/src/ObjectSelector/_PersonFilterFrame.py index 88d40e3ec..4bfae3c05 100644 --- a/src/ObjectSelector/_PersonFilterFrame.py +++ b/src/ObjectSelector/_PersonFilterFrame.py @@ -157,29 +157,29 @@ class PersonFilterFrame(FilterFrameBase): filter_label.set_alignment(xalign=0,yalign=0.5) default_filters = [ - Rules.Everyone, - Rules.IsFemale, - Rules.IsMale, - Rules.HasUnknownGender, - Rules.Disconnected, - Rules.SearchName, - Rules.HaveAltFamilies, - Rules.HavePhotos, - Rules.IncompleteNames, - Rules.HaveChildren, - Rules.NeverMarried, - Rules.MultipleMarriages, - Rules.NoBirthdate, - Rules.PersonWithIncompleteEvent, - Rules.FamilyWithIncompleteEvent, - Rules.ProbablyAlive, - Rules.PeoplePrivate, - Rules.IsWitness, - Rules.HasTextMatchingSubstringOf, - Rules.HasTextMatchingRegexpOf, - Rules.HasNote, - Rules.HasNoteMatchingSubstringOf, - Rules.IsFemale, + Rules.Person.Everyone, + Rules.Person.IsFemale, + Rules.Person.IsMale, + Rules.Person.HasUnknownGender, + Rules.Person.Disconnected, + Rules.Person.SearchName, + Rules.Person.HaveAltFamilies, + Rules.Person.HavePhotos, + Rules.Person.IncompleteNames, + Rules.Person.HaveChildren, + Rules.Person.NeverMarried, + Rules.Person.MultipleMarriages, + Rules.Person.NoBirthdate, + Rules.Person.PersonWithIncompleteEvent, + Rules.Person.FamilyWithIncompleteEvent, + Rules.Person.ProbablyAlive, + Rules.Person.PeoplePrivate, + Rules.Person.IsWitness, + Rules.Person.HasTextMatchingSubstringOf, + Rules.Person.HasTextMatchingRegexpOf, + Rules.Person.HasNote, + Rules.Person.HasNoteMatchingSubstringOf, + Rules.Person.IsFemale, ] self._filter_list = gtk.ListStore(object,str) @@ -365,19 +365,19 @@ class PersonFilterFrame(FilterFrameBase): filter = GenericFilter() if self._id_check.get_active(): - filter.add_rule(Rules.HasIdOf([self._id_edit.get_text()])) + filter.add_rule(Rules.Person.HasIdOf([self._id_edit.get_text()])) if self._name_check.get_active(): - filter.add_rule(Rules.SearchName([self._name_edit.get_text()])) + filter.add_rule(Rules.Person.SearchName([self._name_edit.get_text()])) if self._gender_check.get_active(): gender = self._gender_list.get_value(self._gender_combo.get_active_iter(),1) if gender == RelLib.Person.MALE: - filter.add_rule(Rules.IsMale([])) + filter.add_rule(Rules.Person.IsMale([])) elif gender == RelLib.Person.FEMALE: - filter.add_rule(Rules.IsFemale([])) + filter.add_rule(Rules.Person.IsFemale([])) elif gender == RelLib.Person.UNKNOWN: - filter.add_rule(Rules.HasUnknownGender([])) + filter.add_rule(Rules.Person.HasUnknownGender([])) else: log.warn("Received unknown gender from filter widget") @@ -389,7 +389,7 @@ class PersonFilterFrame(FilterFrameBase): date = "after " + self._b_edit.get_text() else: log.warn("neither before or after is selected, this should not happen") - filter.add_rule(Rules.HasBirth([date,'',''])) + filter.add_rule(Rules.Person.HasBirth([date,'',''])) if self._death_check.get_active(): date = "" @@ -399,7 +399,7 @@ class PersonFilterFrame(FilterFrameBase): date = "after " + self._d_edit.get_text() else: log.warn("neither before or after is selected, this should not happen") - filter.add_rule(Rules.HasDeath([date,'',''])) + filter.add_rule(Rules.Person.HasDeath([date,'',''])) if self._filter_check.get_active(): diff --git a/src/PageView.py b/src/PageView.py index 6d2332940..c0167b99f 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -527,10 +527,10 @@ class ListView(BookMarkView): Builds the default filters and add them to the filter menu. """ default_filters = [ - [Rules.Everyone, []], + [Rules.Everything, []], [Rules.HasTextMatchingSubstringOf, ['',0,0]], [Rules.HasTextMatchingRegexpOf, ['',0,1]], - [Rules.PeoplePrivate, []], + [Rules.IsPrivate, []], ] self.generic_filter_widget.setup_filter( default_filters) diff --git a/src/PluginUtils/_Report.py b/src/PluginUtils/_Report.py index 8219e5e42..20e243ff5 100644 --- a/src/PluginUtils/_Report.py +++ b/src/PluginUtils/_Report.py @@ -912,7 +912,7 @@ class BareReportDialog: self.options.handler.set_filter_number(active) except: print "Error setting filter. Proceeding with 'Everyone'" - self.filter = Rules.Everyone([]) + self.filter = Rules.Person.Everyone([]) else: self.filter = None diff --git a/src/plugins/Calendar.py b/src/plugins/Calendar.py index 7c9edbfee..9f043bc8b 100644 --- a/src/plugins/Calendar.py +++ b/src/plugins/Calendar.py @@ -1,4 +1,3 @@ -# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2006 Donald N. Allingham @@ -528,32 +527,32 @@ class FilterWidget(Widget): if filter in ["everyone", "all filters"]: f = GenericFilter() f.set_name(_("Entire Database")) - f.add_rule(Rules.Everyone([])) + f.add_rule(Rules.Person.Everyone([])) retval.append(f) if filter in ["descendants", "all filters"]: f = GenericFilter() f.set_name(_("Descendants of %s") % name) - f.add_rule(Rules.IsDescendantOf([gramps_id,1])) + f.add_rule(Rules.Person.IsDescendantOf([gramps_id,1])) retval.append(f) if filter in ["descendant families", "all filters"]: f = GenericFilter() f.set_name(_("Descendant Families of %s") % name) - f.add_rule(Rules.IsDescendantFamilyOf([gramps_id])) + f.add_rule(Rules.Person.IsDescendantFamilyOf([gramps_id])) retval.append(f) if filter in ["ancestors", "all filters"]: f = GenericFilter() f.set_name(_("Ancestors of %s") % name) - f.add_rule(Rules.IsAncestorOf([gramps_id,1])) + f.add_rule(Rules.Person.IsAncestorOf([gramps_id,1])) retval.append(f) if filter in ["common ancestors", "all filters"]: f = GenericFilter() f.set_name(_("People with common ancestor with %s") % name) - f.add_rule(Rules.HasCommonAncestorWith([gramps_id])) + f.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) retval.append(f) if filter in ["calendar attribute", "all filters"]: f = ParamFilter() f.set_name(_("People with a Calendar attribute")) - f.add_rule(Rules.HasTextMatchingSubstringOf(['Calendar',0,0])) + f.add_rule(Rules.Person.HasTextMatchingSubstringOf(['Calendar',0,0])) retval.append(f) return retval diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index a1abd609d..2b8ff878c 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -154,7 +154,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow): self.all = GenericFilter() self.all.set_name(_("Entire Database")) - self.all.add_rule(Rules.Everyone([])) + self.all.add_rule(Rules.Person.Everyone([])) self.filter_menu = build_filter_menu([self.all]) filter_num = self.options.handler.get_filter_number() diff --git a/src/plugins/ExportVCalendar.py b/src/plugins/ExportVCalendar.py index 2b1f23877..8a5d8cdd1 100644 --- a/src/plugins/ExportVCalendar.py +++ b/src/plugins/ExportVCalendar.py @@ -86,25 +86,25 @@ class CalendarWriterOptionBox: all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) if self.person: des = GenericFilter() des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) - des.add_rule(Rules.IsDescendantOf( + des.add_rule(Rules.Person.IsDescendantOf( [self.person.get_gramps_id(),1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) - ans.add_rule(Rules.IsAncestorOf( + ans.add_rule(Rules.Person.IsAncestorOf( [self.person.get_gramps_id(),1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % self.person.get_primary_name().get_name()) - com.add_rule(Rules.HasCommonAncestorWith( + com.add_rule(Rules.Person.HasCommonAncestorWith( [self.person.get_gramps_id()])) self.filter_menu = build_filter_menu( diff --git a/src/plugins/ExportVCard.py b/src/plugins/ExportVCard.py index 3dae47b75..747b3cebc 100644 --- a/src/plugins/ExportVCard.py +++ b/src/plugins/ExportVCard.py @@ -84,25 +84,25 @@ class CardWriterOptionBox: all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) if self.person: des = GenericFilter() des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) - des.add_rule(Rules.IsDescendantOf( + des.add_rule(Rules.Person.IsDescendantOf( [self.person.get_gramps_id(),1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) - ans.add_rule(Rules.IsAncestorOf( + ans.add_rule(Rules.Person.IsAncestorOf( [self.person.get_gramps_id(),1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % self.person.get_primary_name().get_name()) - com.add_rule(Rules.HasCommonAncestorWith( + com.add_rule(Rules.Person.HasCommonAncestorWith( [self.person.get_gramps_id()])) self.filter_menu = build_filter_menu( diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index af684b892..ddcec304d 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -620,7 +620,7 @@ class EditRule: self.page = [] self.class2page = {} the_map = {} - for class_obj in Rules.editor_rule_list: + for class_obj in Rules.Person.editor_rule_list: arglist = class_obj.labels vallist = [] tlist = [] diff --git a/src/plugins/GraphViz.py b/src/plugins/GraphViz.py index da4191af2..44b27ca0b 100644 --- a/src/plugins/GraphViz.py +++ b/src/plugins/GraphViz.py @@ -656,19 +656,19 @@ class GraphVizOptions(ReportOptions.ReportOptions): all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) des = GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(Rule.IsDescendantOf([gramps_id,1])) + des.add_rule(Rules.Person.IsDescendantOf([gramps_id,1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(Rule.IsAncestorOf([gramps_id,1])) + ans.add_rule(Rules.Person.IsAncestorOf([gramps_id,1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(Rules.HasCommonAncestorWith([gramps_id])) + com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) return [all,des,ans,com] diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 2e74df425..463d78696 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -522,23 +522,23 @@ class IndivCompleteOptions(ReportOptions.ReportOptions): filt_id = GenericFilter() filt_id.set_name(name) - filt_id.add_rule(Rules.HasIdOf([gramps_id])) + filt_id.add_rule(Rules.Person.HasIdOf([gramps_id])) all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) des = GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(Rules.IsDescendantOf([gramps_id,1])) + des.add_rule(Rules.Person.IsDescendantOf([gramps_id,1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(Rules.IsAncestorOf([gramps_id,1])) + ans.add_rule(Rules.Person.IsAncestorOf([gramps_id,1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(Rules.HasCommonAncestorWith([gramps_id])) + com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) return [filt_id,all,des,ans,com] diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index dad8f3f17..5873b4621 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -2405,23 +2405,23 @@ class WebReportOptions(ReportOptions.ReportOptions): all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) des = GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(Rules.IsDescendantOf([gramps_id,1])) + des.add_rule(Rules.Person.IsDescendantOf([gramps_id,1])) df = GenericFilter() df.set_name(_("Descendant Families of %s") % name) - df.add_rule(Rules.IsDescendantFamilyOf([gramps_id])) + df.add_rule(Rules.Person.IsDescendantFamilyOf([gramps_id])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(Rules.IsAncestorOf([gramps_id,1])) + ans.add_rule(Rules.Person.IsAncestorOf([gramps_id,1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(Rules.HasCommonAncestorWith([gramps_id])) + com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) return [all,des,df,ans,com] diff --git a/src/plugins/StatisticsChart.py b/src/plugins/StatisticsChart.py index 538e71700..93d3da19d 100644 --- a/src/plugins/StatisticsChart.py +++ b/src/plugins/StatisticsChart.py @@ -843,19 +843,19 @@ class StatisticsChartOptions(ReportOptions.ReportOptions): all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) des = GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(Rules.IsDescendantOf([gramps_id, 1])) + des.add_rule(Rules.Person.IsDescendantOf([gramps_id, 1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(Rules.IsAncestorOf([gramps_id, 1])) + ans.add_rule(Rules.Person.IsAncestorOf([gramps_id, 1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(Rules.HasCommonAncestorWith([gramps_id])) + com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) return [all, des, ans, com] diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index 544a6bf52..ecbc7eddc 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -411,19 +411,19 @@ class TimeLineOptions(ReportOptions.ReportOptions): all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) des = GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(Rules.IsDescendantOf([gramps_id,1])) + des.add_rule(Rules.Person.IsDescendantOf([gramps_id,1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(Rules.IsAncestorOf([gramps_id,1])) + ans.add_rule(Rules.Person.IsAncestorOf([gramps_id,1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(Rules.HasCommonAncestorWith([gramps_id])) + com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) return [all,des,ans,com] diff --git a/src/plugins/WriteFtree.py b/src/plugins/WriteFtree.py index 742340735..c3fed669c 100644 --- a/src/plugins/WriteFtree.py +++ b/src/plugins/WriteFtree.py @@ -88,25 +88,25 @@ class FtreeWriterOptionBox: all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) if self.person: des = GenericFilter() des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) - des.add_rule(Rules.IsDescendantOf( + des.add_rule(Rules.Person.IsDescendantOf( [self.person.get_gramps_id(),1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) - ans.add_rule(Rules.IsAncestorOf( + ans.add_rule(Rules.Person.IsAncestorOf( [self.person.get_gramps_id(),1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % self.person.get_primary_name().get_name()) - com.add_rule(Rules.HasCommonAncestorWith( + com.add_rule(Rules.Person.HasCommonAncestorWith( [self.person.get_gramps_id()])) self.filter_menu = build_filter_menu([all,des,ans,com]) diff --git a/src/plugins/WriteGeneWeb.py b/src/plugins/WriteGeneWeb.py index 3b41de941..23e95bd82 100644 --- a/src/plugins/WriteGeneWeb.py +++ b/src/plugins/WriteGeneWeb.py @@ -90,25 +90,25 @@ class GeneWebWriterOptionBox: all = GenericFilter() all.set_name(_("Entire Database")) - all.add_rule(Rules.Everyone([])) + all.add_rule(Rules.Person.Everyone([])) if self.person: des = GenericFilter() des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) - des.add_rule(Rules.IsDescendantOf( + des.add_rule(Rules.Person.IsDescendantOf( [self.person.get_gramps_id(),1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) - ans.add_rule(Rules.IsAncestorOf( + ans.add_rule(Rules.Person.IsAncestorOf( [self.person.get_gramps_id(),1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % self.person.get_primary_name().get_name()) - com.add_rule(Rules.HasCommonAncestorWith( + com.add_rule(Rules.Person.HasCommonAncestorWith( [self.person.get_gramps_id()])) self.filter_menu = build_filter_menu([all,des,ans,com])