Skip to content

Commit

Permalink
New filter rule 'familieswitheventfiltermatch' (gramps-project#274)
Browse files Browse the repository at this point in the history
* New filter rule 'familieswitheventfiltermatch'

Matches families that are matched by an event filter.
  • Loading branch information
Mattkmmr authored Jan 31, 2020
1 parent 2d0e15c commit bcab602
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
34 changes: 34 additions & 0 deletions FilterRules/familieswitheventfiltermatch.gpr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2020 Matthias Kemmer
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

"""Filter rule which matches families that are matched by an event filter."""
register(RULE,
id = 'familieswitheventfiltermatch',
name = _("Families matching <event filter>"),
description = _("Matches families that are matched by an event filter"),
version = '1.0.0',
authors = ["Matthias Kemmer"],
authors_email = ["[email protected]"],
gramps_target_version = '5.1',
status = STABLE,
fname = "familieswitheventfiltermatch.py",
ruleclass = 'FamiliesWithEventFilterMatch', # must be rule class name
namespace = 'Family', # one of the primary object classes
)
48 changes: 48 additions & 0 deletions FilterRules/familieswitheventfiltermatch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2020 Matthias Kemmer
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
"""Filter rule for families matching an event filter."""

# -------------------------------------------------------------------------
#
# Gramps modules
#
# -------------------------------------------------------------------------
from gramps.gen.filters.rules._matcheseventfilterbase import MatchesEventFilterBase
from gramps.gen.const import GRAMPS_LOCALE as glocale
try:
_trans = glocale.get_addon_translator(__file__)
except ValueError:
_trans = glocale.translation
_ = _trans.gettext


# -------------------------------------------------------------------------
#
# IsRelatedWithFilterMatch
#
# -------------------------------------------------------------------------
class FamiliesWithEventFilterMatch(MatchesEventFilterBase):
"""Rule that checks against an event filter."""

labels = [_('Event filter name:')]
name = _('Families matching <event filter>')
category = _("Event filters")
description = _("Matches families matched by an event filter")
namespace = 'Event'

0 comments on commit bcab602

Please sign in to comment.