Skip to content

Commit

Permalink
Add new HasEvent and HasSource rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Hall committed May 14, 2024
1 parent 7eed306 commit b80d971
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 6 deletions.
4 changes: 1 addition & 3 deletions gramps/gen/filters/rules/event/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
Package providing filter rules for Gramps.
"""

from .._haseventbase import HasEventBase as HasEvent
from .._haseventbase import HasEventBase

from ._hastype import HasType
from ._allevents import AllEvents
from ._hasgallery import HasGallery
from ._hasidof import HasIdOf
from ._regexpidof import RegExpIdOf
from ._hascitation import HasCitation
from ._hasevent import HasEvent
from ._hasnote import HasNote
from ._hasnoteregexp import HasNoteRegexp
from ._hasnotematchingsubstringof import HasNoteMatchingSubstringOf
Expand Down
57 changes: 57 additions & 0 deletions gramps/gen/filters/rules/event/_hasevent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

"""
Filter rule to match events with a particular value.
"""
# -------------------------------------------------------------------------
#
# Standard Python modules
#
# -------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale

_ = glocale.translation.gettext

# -------------------------------------------------------------------------
#
# Gramps modules
#
# -------------------------------------------------------------------------
from .._haseventbase import HasEventBase


# -------------------------------------------------------------------------
#
# HasEvent
#
# -------------------------------------------------------------------------
class HasEvent(HasEventBase):
"""Rule that checks for an event with a particular value"""

labels = [
_("Event type:"),
_("Date:"),
_("Place:"),
_("Description:"),
_("Main Participants:"),
]
name = _("Events matching parameters")
description = _("Matches events with particular parameters")
4 changes: 1 addition & 3 deletions gramps/gen/filters/rules/source/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
Package providing filter rules for Gramps.
"""

from .._hassourcebase import HasSourceBase as HasSource
from .._hassourcebase import HasSourceBase

from ._allsources import AllSources
from ._hasattribute import HasAttribute
from ._hasgallery import HasGallery
Expand All @@ -36,6 +33,7 @@
from ._hasnoteregexp import HasNoteRegexp
from ._hasnotematchingsubstringof import HasNoteMatchingSubstringOf
from ._hasreferencecountof import HasReferenceCountOf
from ._hassource import HasSource
from ._sourceprivate import SourcePrivate
from ._matchesfilter import MatchesFilter
from ._changedsince import ChangedSince
Expand Down
51 changes: 51 additions & 0 deletions gramps/gen/filters/rules/source/_hassource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

"""
Filter rule to match sources with a particular value.
"""
# -------------------------------------------------------------------------
#
# Standard Python modules
#
# -------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale

_ = glocale.translation.gettext

# -------------------------------------------------------------------------
#
# Gramps modules
#
# -------------------------------------------------------------------------
from .._hassourcebase import HasSourceBase


# -------------------------------------------------------------------------
#
# HasSource
#
# -------------------------------------------------------------------------
class HasSource(HasSourceBase):
"""Rule that checks for a source with a particular value"""

labels = [_("Title:"), _("Author:"), _("Abbreviation:"), _("Publication:")]
name = _("Sources matching parameters")
description = _("Matches sources with particular parameters")
2 changes: 2 additions & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ gramps/gen/filters/rules/event/_hasattribute.py
gramps/gen/filters/rules/event/_hascitation.py
gramps/gen/filters/rules/event/_hasdata.py
gramps/gen/filters/rules/event/_hasdayofweek.py
gramps/gen/filters/rules/event/_hasevent.py
gramps/gen/filters/rules/event/_hasgallery.py
gramps/gen/filters/rules/event/_hasidof.py
gramps/gen/filters/rules/event/_hasnote.py
Expand Down Expand Up @@ -281,6 +282,7 @@ gramps/gen/filters/rules/source/_hasnoteregexp.py
gramps/gen/filters/rules/source/_hasreferencecountof.py
gramps/gen/filters/rules/source/_hasrepository.py
gramps/gen/filters/rules/source/_hasrepositorycallnumberref.py
gramps/gen/filters/rules/source/_hassource.py
gramps/gen/filters/rules/source/_hastag.py
gramps/gen/filters/rules/source/_matchesfilter.py
gramps/gen/filters/rules/source/_matchesrepositoryfilter.py
Expand Down

0 comments on commit b80d971

Please sign in to comment.