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

Clear old custom name formats when database loaded #509

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions gramps/cli/grampscli.py
Expand Up @@ -318,6 +318,7 @@ def _post_load_newdb_nongui(self, filename, title=None):
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)
Expand Down
5 changes: 5 additions & 0 deletions gramps/gen/display/name.py
Expand Up @@ -418,6 +418,11 @@ def _raw_fn(self, raw_data):
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 = {
Expand Down