From 18300e28deb0ab8b4ae90dbc1a8cbf6ca77133ef Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Thu, 26 Mar 2015 22:03:35 -0700 Subject: [PATCH] slight tweak to name_format option --- gramps/gen/plug/report/stdoptions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gramps/gen/plug/report/stdoptions.py b/gramps/gen/plug/report/stdoptions.py index 434d2fb93..c093f8501 100644 --- a/gramps/gen/plug/report/stdoptions.py +++ b/gramps/gen/plug/report/stdoptions.py @@ -30,6 +30,7 @@ Commonly used report options. Call the function, don't copy the code! #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext +from gramps.gen.config import config from gramps.gen.display.name import displayer as global_name_display from gramps.gen.plug.menu import EnumeratedListOption, BooleanOption from gramps.gen.proxy import PrivateProxyDb @@ -65,15 +66,21 @@ def add_name_format_option(menu, category): for number, name, format_string, whether_active in format_list: name_format.add_item(number, name) name_format.set_help(_("Select the format to display names")) + current_format = config.get('preferences.name-format') + # if this report hasn't ever been run, start with user's current setting + name_format.set_value(current_format) + # if the report has been run, this line will get the user's old setting menu.add_option(category, "name_format", name_format) + return name_format def run_name_format_option(report, menu): """ Run the option for changing the report's name format to a report-specific format instead of the user's Edit=>Preferences choice """ + current_format = config.get('preferences.name-format') name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: + if name_format != current_format: report._name_display.set_default_format(name_format) def add_private_data_option(menu, category, default=True):