A custom filter rule for Gramps that matches people who have an event whose place lies within a named place — including everything enclosed by it, all the way down the place hierarchy.
Filtering people by jurisdiction (parish / county / province / state / country) normally needs a three-filter chain across namespaces in Gramps:
This rule collapses that chain into one person rule: the place enclosure is done inside the rule, so you don't have to build a place filter and an event filter first. Pick it in the People view (or in FilterWorkbench) and you are done.
It matches by place name, not by Gramps ID. IDs change on backend upgrade, backup import and version switches, which makes ID-based filters brittle; names are self-documenting. If several places share a name (e.g. two "Skåne"), all of them are used as targets, so the filter simply works.
It solves the simple case: "people with an (optionally typed) event inside a jurisdiction." It does not do event-quality composition — e.g. "events with a missing date or source within a jurisdiction." That is genuine event-filter territory and still needs Gramps' Events view.
Close Gramps.
Extract the downloaded ZIP archive.
Copy or extract the project folder into your Gramps user plugin folder.
Keep the complete folder structure unchanged, including any locale folder
included with the project.
The user plugin folder is normally located here:
%AppData%\gramps\gramps<version>\plugins\~/.gramps/gramps<version>/plugins/~/Library/Application Support/gramps/gramps<version>/plugins/Replace <version> with the Gramps version folder used on your system.
Start Gramps again.
Check that the installed filter, rule, gramplet or tool is available where described in the project documentation.
If the project does not appear or fails to load, check Help → Plugin Manager for an error message.
Because the project was installed only in the user plugin folder, removing that folder removes the test installation without changing the original Gramps program files.
København.
All places with that name are matched, and the place itself as well as
everything below it counts.Bagen.* (starts with),
^Skåne$ (exactly Skåne), or Skåne|Fyn (either).By default the place name is matched exactly (ignoring upper/lower case). Ticking Use regular expressions switches the place-name field to a regular expression, searched anywhere in the name/title:
Bagenkop (unticked) — matches only places named exactly Bagenkop.Bagen.* (ticked) — matches Bagenkop, Bagenkobbel, …^Bagenkop$ (ticked) — exactly Bagenkop, same as unticked.Skåne|Fyn (ticked) — places named Skåne or Fyn.Note: in regex mode the pattern is also tested against each place's full title
(e.g. "Bagenkop, Langeland, …"), so an unanchored pattern like Bagenkop can
match via the title too; anchor with ^…$ if you want the name field only.
This differs from the usual Gramps behaviour. Gramps' standard rules that offer a "Use regular expressions" checkbox treat the unticked field as a substring (contains) match. This rule instead treats the unticked field as an exact, whole-name (case-insensitive) match. In both, ticked = a regular expression — so the only difference from the usual behaviour is the unticked default: exact here, contains elsewhere.
The rule can be combined with other rules exactly like a built-in one, and the resulting filter can be used for reports, exports and tags. It also appears in FilterWorkbench's rule picker automatically.
For each of the person's events, the rule looks at the event's place and matches
when that place is the named place or lies within it (transitively up the
place hierarchy). The named place itself always counts, so a person with an event
recorded directly at the named place matches. The enclosure test is Gramps' own
located_in, so the "enclosed by" semantics are identical to the built-in place
rule. Place hierarchies are shallow (a few levels), so this is cheap even on large
trees.
GNU General Public License, version 2 or later — same as Gramps.
This addon ships with a Danish translation and is ready for more languages. Layout:
<addon folder>/
*.py *.gpr.py
po/
template.pot # all translatable strings (source)
da.po # Danish translation (source)
locale/
da/LC_MESSAGES/addon.mo # compiled Danish catalog (used at runtime)
Gramps loads locale/<lang>/LC_MESSAGES/addon.mo automatically when the
interface is set to that language, and falls back to English otherwise. The
.mo filename must be exactly addon.mo.
To add another language, e.g. German:
po/template.pot to po/de.po and translate each msgstr.locale/de/LC_MESSAGES/addon.mo. With GNU gettext:
msgfmt po/de.po -o locale/de/LC_MESSAGES/addon.mo
(or use the Python polib package: pofile('po/de.po').save_as_mofile(...)).Only strings unique to this addon are translated here. Standard Gramps terms — the Event type drop-down and the Event filters category name — come from Gramps' own translations automatically, so the rule editor renders the correct widgets in every language.