Skip to content

Commit

Permalink
Fix list size option in the top surnames gramplet
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

Fixes #13448
  • Loading branch information
DaveSch-gramps authored and Nick-Hall committed Dec 17, 2024
1 parent 17178c4 commit af88f33
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 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,8 @@
# ------------------------------------------------------------------------
_YIELD_INTERVAL = 350

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


# ------------------------------------------------------------------------
#
Expand All @@ -61,8 +64,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 af88f33

Please sign in to comment.