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
This commit is contained in:
Doug Blank 2011-12-11 04:04:28 +00:00
parent 676af3bcc8
commit 2f0b86f076
4 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,46 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2011 Doug Blank <doug.blank@gmail.com>
#
# 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')

View File

@ -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 <doug.blank@gmail.com>
#
# 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,

View File

@ -0,0 +1,49 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2011 Doug Blank <doug.blank@gmail.com>
#
# 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()

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
# Copyright (C) 2011 Doug Blank <doug.blank@gmail.com>
#
# 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