Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update topsurnamesgramplet.py #1780

Open
wants to merge 2 commits into
base: maintenance/gramps52
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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