From a216441029159b0cebb0f34f31029b4929c25bc0 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 22 Dec 2017 18:31:25 +0000 Subject: [PATCH] Clear old custom name formats when database loaded --- gramps/cli/grampscli.py | 1 + gramps/gen/display/name.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/gramps/cli/grampscli.py b/gramps/cli/grampscli.py index 49c656c7f..8514d394c 100644 --- a/gramps/cli/grampscli.py +++ b/gramps/cli/grampscli.py @@ -318,6 +318,7 @@ class CLIManager: and self.dbstate.db.get_total() == 0): self.dbstate.db.set_researcher(owner) + name_displayer.clear_custom_formats() name_displayer.set_name_format(self.dbstate.db.name_formats) fmt_default = config.get('preferences.name-format') name_displayer.set_default_format(fmt_default) diff --git a/gramps/gen/display/name.py b/gramps/gen/display/name.py index ffa4b94a1..6ab47682f 100644 --- a/gramps/gen/display/name.py +++ b/gramps/gen/display/name.py @@ -418,6 +418,11 @@ class NameDisplay: result = raw_data[_FIRSTNAME] return ' '.join(result.split()) + def clear_custom_formats(self): + self.name_formats = {num: value + for num, value in self.name_formats.items() + if num >= 0} + def set_name_format(self, formats): raw_func_dict = {