From 2f0b86f076c2e4ed8ae91f5d41d80fed38e8b396 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 11 Dec 2011 04:04:28 +0000 Subject: [PATCH] Added Generic Public and Public People filters (convenience, as you need to make a private filter, and then invert it for this common use) svn: r18571 --- src/Filters/Rules/Person/_PeoplePublic.py | 46 +++++++++++++++++++++ src/Filters/Rules/Person/__init__.py | 3 ++ src/Filters/Rules/_IsPublic.py | 49 +++++++++++++++++++++++ src/Filters/Rules/__init__.py | 3 ++ 4 files changed, 101 insertions(+) create mode 100644 src/Filters/Rules/Person/_PeoplePublic.py create mode 100644 src/Filters/Rules/_IsPublic.py diff --git a/src/Filters/Rules/Person/_PeoplePublic.py b/src/Filters/Rules/Person/_PeoplePublic.py new file mode 100644 index 000000000..2d1695978 --- /dev/null +++ b/src/Filters/Rules/Person/_PeoplePublic.py @@ -0,0 +1,46 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Doug Blank +# +# 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: _PeoplePrivate.py 14091 2010-01-18 04:42:17Z pez4brian $ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._IsPublic import IsPublic + +#------------------------------------------------------------------------- +# "People marked private" +#------------------------------------------------------------------------- +class PeoplePublic(IsPublic): + """People not marked private""" + + name = _('People not marked private') + description = _("Matches people that are not indicated as private") + category = _('General filters') diff --git a/src/Filters/Rules/Person/__init__.py b/src/Filters/Rules/Person/__init__.py index bb2c734d5..40261fdb8 100644 --- a/src/Filters/Rules/Person/__init__.py +++ b/src/Filters/Rules/Person/__init__.py @@ -4,6 +4,7 @@ # Copyright (C) 2002-2007 Donald N. Allingham # Copyright (C) 2007-2008 Brian G. Matherly # Copyright (C) 2011 Tim G L Lyons +# Copyright (C) 2011 Doug Blank # # 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 @@ -97,6 +98,7 @@ from _NeverMarried import NeverMarried from _NoBirthdate import NoBirthdate from _NoDeathdate import NoDeathdate from _PeoplePrivate import PeoplePrivate +from _PeoplePublic import PeoplePublic from _PersonWithIncompleteEvent import PersonWithIncompleteEvent from _ProbablyAlive import ProbablyAlive from _RelationshipPathBetween import RelationshipPathBetween @@ -154,6 +156,7 @@ editor_rule_list = [ FamilyWithIncompleteEvent, ProbablyAlive, PeoplePrivate, + PeoplePublic, IsWitness, IsDescendantOf, IsDescendantFamilyOf, diff --git a/src/Filters/Rules/_IsPublic.py b/src/Filters/Rules/_IsPublic.py new file mode 100644 index 000000000..fb9eb7941 --- /dev/null +++ b/src/Filters/Rules/_IsPublic.py @@ -0,0 +1,49 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Doug Blank +# +# 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: _IsPublic.py 14091 2010-01-18 04:42:17Z pez4brian $ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules import Rule + +#------------------------------------------------------------------------- +# "People marked public" +#------------------------------------------------------------------------- +class IsPublic(Rule): + """Objects not marked private.""" + + name = _('Objects not marked private') + description = _("Matches objects that are not indicated as private") + category = _('General filters') + + def apply(self, db, obj): + return not obj.get_privacy() diff --git a/src/Filters/Rules/__init__.py b/src/Filters/Rules/__init__.py index 06d07c15d..7eddf2f68 100644 --- a/src/Filters/Rules/__init__.py +++ b/src/Filters/Rules/__init__.py @@ -3,6 +3,7 @@ # # Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2011 Tim G L Lyons +# Copyright (C) 2011 Doug Blank # # 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 @@ -46,6 +47,7 @@ _HasTagBase Object has a particular tag _HasTextMatchingRegexpOf Object has text matching regular expression _HasTextMatchingSubstringOf Object has text containing substring _IsPrivate Object is marked as private +_IsPublic Object is not marked as private _MatchesFilterBase Object matches another filter _RegExpldBase Object has Gramps Id matching regular expression @@ -72,6 +74,7 @@ from Filters.Rules._Rule import Rule from Filters.Rules._Everything import Everything from Filters.Rules._HasGrampsId import HasGrampsId from Filters.Rules._IsPrivate import IsPrivate +from Filters.Rules._IsPublic import IsPublic from Filters.Rules._HasTextMatchingSubstringOf import HasTextMatchingSubstringOf from Filters.Rules._HasTextMatchingRegexpOf import HasTextMatchingRegexpOf from Filters.Rules._MatchesFilterBase import MatchesFilterBase