Looking for an example of a Gramplet with a Custom Filter Configuration option

Thanks for the sample code and sorry for delay. It took 3 days to make progress with this because I couldn’t get a Gramps Plugin Registration (.gpr.py) to work.

I needed the extra feedback launching Gramps from the terminal to isolate the problem. (Which was: other addons were freaking out the Registration and causing it to stop processing. Resolving those other problems allowed this registration to complete.)

But that meant discovering how to get Gramps to start launching from the terminal again. (I had removed a developmental version of Gramps and it fell back to a Flatpak instance. Launching the Flatpak instance is very different then launching from the development instance.)

Saved your sample into a new file called SampleGramplet.py in a SampleGramplet folder in my gramps52/plugins folder of my Gramps User Directory.

The corresponding Gramps Plugin Registration file is called SampleGramplet.gpr.py with the content:

# encoding:utf-8
#
# Gramps plugin- an addon gramplet for
# the Gramps GTK+/GNOME based genealogy program
#
# Copyright (C) 2024     Kari Kujansuu
#
# 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.
#

# ------------------------------------------------------------------------
#
# Gramps Plugin Registration (metadata and configuration information)
#    a sidecar to the file idendified below as the fname (filename)
#    see https://gramps-project.org/wiki/index.php/Gramps_Glossary#addon
#
# ------------------------------------------------------------------------

# See https://www.gramps-project.org/wiki/index.php/Gramplets

from gramps.version import major_version, VERSION_TUPLE

if VERSION_TUPLE < (5, 2, 0):
    additional_args = {
        "status": UNSTABLE, # Status attribute required
        "help_url": "Gramplets",#secure http not supported in these versions
    }
else:
    additional_args = {
        "status": EXPERIMENTAL, # Status attribute required
        "audience": EXPERT,
        "maintainers": ["Kari Kujansuu",
            "Gramps Bugtracker"],
        "maintainers_email": ["kari.kujansuu@gmail.com",
            "https://gramps-project.org/bugs"],
        "help_url": "https://www.gramps-project.org/wiki/index.php/Gramplets",
#        "requires_mod": ['svgwrite'],
#        "requires_gi": [('GooCanvas', '2.0,3.0')],
#        "requires_exe": ['dot'],
    }

# ------------------------------------------------------------------------
#
# Register Gramplet
#
# ------------------------------------------------------------------------

register(GRAMPLET, # uppercase
         id="SampleGramplet", # required to be unique
         name=_("Sample Gramplet"), # uniqueness helpful
         description=_("sample Gramplet with "
             "filter Configuration options"
         ), # optional attribute, uniqueness helpful
         navtypes=["Person","Families"], # optional attribute
         authors=["Kari Kujansuu"], # optional attribute
         authors_email=["kari.kujansuu@gmail.com"], # optional attribute
         fname="SampleGramplet.py",
         height=300,
         detached_width=250, # optional attribute
         detached_height=400, # optional attribute
         expand=True, # optional attribute
         gramplet='SampleGramplet',
         gramplet_title=_("Sample Gramplet"), # uniqueness helpful
         version = '0.0.0',
         gramps_target_version=major_version,
         **additional_args,
         )