Skip to content

Commit

Permalink
Update topsurnamesgramplet.py
Browse files Browse the repository at this point in the history
Allow users to specify how many surnames appear in the list from 10 to 1000
  • Loading branch information
DaveSch-gramps committed Sep 30, 2024
1 parent fb91938 commit dd675ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gramps/plugins/gramplet/topsurnamesgramplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from gramps.gen.plug import Gramplet
from gramps.gen.config import config
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.plug.menu import NumberOption

_ = glocale.translation.sgettext

Expand All @@ -41,6 +42,7 @@
# ------------------------------------------------------------------------
_YIELD_INTERVAL = 350

NUM_SURNAMES = _("Number of Surnames to display")

# ------------------------------------------------------------------------
#
Expand All @@ -61,8 +63,14 @@ def db_changed(self):
self.connect(self.dbstate.db, "family-rebuild", self.update)
self.set_text(_("No Family Tree loaded."))

def build_options(self):
self.add_option(NumberOption(NUM_SURNAMES, self.top_size, 10, 1000))

def save_options(self):
self.top_size = int(self.get_option(NUM_SURNAMES).get_value())

def on_load(self):
if len(self.gui.data) > 0:
if len(self.gui.data) == 1:
self.top_size = int(self.gui.data[0])

def on_save(self):
Expand Down

0 comments on commit dd675ec

Please sign in to comment.