parent
de3648df39
commit
1a94c7868a
@ -64,6 +64,9 @@ _DETAIL = [{'name': _("Full"), 'value': "full"},
|
||||
{'name': _("Medium"), 'value': "medium"},
|
||||
{'name': _("Short"), 'value': "short"}]
|
||||
|
||||
_NAME_FORMAT = [{'name': _("Given Nickname Surname"), 'value': "1"},
|
||||
{'name': _("Surname Given Nickname"), 'value': "2"}]
|
||||
|
||||
_MARRIAGE = [{'name': _("Default"), 'value': ""},
|
||||
{'name': _("Above"), 'value': "marriage above"},
|
||||
{'name': _("Below"), 'value': "marriage below"},
|
||||
@ -147,6 +150,12 @@ class TreeOptions:
|
||||
detail.set_help(_("Detail of information to be shown in a node."))
|
||||
menu.add_option(category, "detail", detail)
|
||||
|
||||
name_format = EnumeratedListOption(_("Name Format"), "1")
|
||||
for item in _NAME_FORMAT:
|
||||
name_format.add_item(item["value"], item["name"])
|
||||
name_format.set_help(_("Select the format to display names"))
|
||||
menu.add_option(category, "name_format", name_format)
|
||||
|
||||
marriage = EnumeratedListOption(_("Marriage"), "")
|
||||
for item in _MARRIAGE:
|
||||
marriage.add_item(item["value"], item["name"])
|
||||
@ -281,6 +290,7 @@ class TreeDocBase(BaseDoc, TreeDoc):
|
||||
get_option = options.menu.get_option_by_name
|
||||
|
||||
self.detail = get_option('detail').get_value()
|
||||
self.name_format = get_option('name_format').get_value()
|
||||
self.marriage = get_option('marriage').get_value()
|
||||
self.nodesize = get_option('nodesize').get_value()
|
||||
self.levelsize = get_option('levelsize').get_value()
|
||||
@ -429,9 +439,14 @@ class TreeDocBase(BaseDoc, TreeDoc):
|
||||
name = person.get_primary_name()
|
||||
nick = name.get_nick_name()
|
||||
surn = name.get_surname()
|
||||
name_parts = [self.format_given_names(name),
|
||||
'\\nick{{{}}}'.format(escape(nick)) if nick else '',
|
||||
'\\surn{{{}}}'.format(escape(surn)) if surn else '']
|
||||
if self.name_format == "1":
|
||||
name_parts = [self.format_given_names(name),
|
||||
'\\nick{{{}}}'.format(escape(nick)) if nick else '',
|
||||
'\\surn{{{}}}'.format(escape(surn)) if surn else '']
|
||||
elif self.name_format == "2":
|
||||
name_parts = ['\\surn{{{}}}'.format(escape(surn)) if surn else '',
|
||||
self.format_given_names(name),
|
||||
'\\nick{{{}}}'.format(escape(nick)) if nick else '']
|
||||
self.write(level+1, 'name = {{{}}},\n'.format(
|
||||
' '.join([e for e in name_parts if e])))
|
||||
for eventref in person.get_event_ref_list():
|
||||
|
Loading…
Reference in New Issue
Block a user