Compare commits

...

4 Commits

Author SHA1 Message Date
romjerome
96e715df2b
fix trailing whitespace
https://github.com/gramps-project/gramps/pull/966#issuecomment-569182132
thanks!
2019-12-29 14:59:57 +01:00
romjerome
0120572a7a
Wrong continued indentation 2019-12-14 18:48:56 +01:00
romjerome
ea58544530
Trailing whitespace 2019-12-14 18:47:46 +01:00
romjerome
c36b6c20c1
options for including occupation data 2019-12-10 16:18:01 +01:00

View File

@ -69,6 +69,12 @@ _MARRIAGE = [{'name': _("Default"), 'value': ""},
{'name': _("Below"), 'value': "marriage below"}, {'name': _("Below"), 'value': "marriage below"},
{'name': _("Not shown"), 'value': "no marriage"}] {'name': _("Not shown"), 'value': "no marriage"}]
_OCCUPATION = [{'name': _("Do not include"), 'value': "no"},
{'name': _("Only description"), 'value': "basic"},
{'name': _("Use date"), 'value': "date"},
{'name': _("Use place"), 'value': "place"},
{'name': _("Use date and place"), 'value': "date place"}]
_COLOR = [{'name': _("None"), 'value': "none"}, _COLOR = [{'name': _("None"), 'value': "none"},
{'name': _("Default"), 'value': "default"}, {'name': _("Default"), 'value': "default"},
{'name': _("Preferences"), 'value': "preferences"}] {'name': _("Preferences"), 'value': "preferences"}]
@ -153,6 +159,12 @@ class TreeOptions:
marriage.set_help(_("Position of marriage information.")) marriage.set_help(_("Position of marriage information."))
menu.add_option(category, "marriage", marriage) menu.add_option(category, "marriage", marriage)
occupation = EnumeratedListOption(_("Occupation"), "")
for item in _OCCUPATION:
occupation.add_item(item["value"], item["name"])
occupation.set_help(_("Details of occupation information."))
menu.add_option(category, "occupation", occupation)
nodesize = NumberOption(_("Node size"), 25, 5, 100, 5) nodesize = NumberOption(_("Node size"), 25, 5, 100, 5)
nodesize.set_help(_("One dimension of a node, in mm. If the timeflow " nodesize.set_help(_("One dimension of a node, in mm. If the timeflow "
"is up or down then this is the width, otherwise " "is up or down then this is the width, otherwise "
@ -282,6 +294,7 @@ class TreeDocBase(BaseDoc, TreeDoc):
self.detail = get_option('detail').get_value() self.detail = get_option('detail').get_value()
self.marriage = get_option('marriage').get_value() self.marriage = get_option('marriage').get_value()
self.occupation = get_option('occupation').get_value()
self.nodesize = get_option('nodesize').get_value() self.nodesize = get_option('nodesize').get_value()
self.levelsize = get_option('levelsize').get_value() self.levelsize = get_option('levelsize').get_value()
self.nodecolor = get_option('nodecolor').get_value() self.nodecolor = get_option('nodecolor').get_value()
@ -449,6 +462,7 @@ class TreeDocBase(BaseDoc, TreeDoc):
# Comparison with 'Occupation' for backwards compatibility with Gramps 5.0 # Comparison with 'Occupation' for backwards compatibility with Gramps 5.0
attr_type = str(attr.get_type()) attr_type = str(attr.get_type())
if attr_type in ('Occupation', _('Occupation')): if attr_type in ('Occupation', _('Occupation')):
if self.occupation != "no":
self.write(level+1, 'profession = {%s},\n' % self.write(level+1, 'profession = {%s},\n' %
escape(attr.get_value())) escape(attr.get_value()))
if attr_type == 'Comment': if attr_type == 'Comment':
@ -494,6 +508,8 @@ class TreeDocBase(BaseDoc, TreeDoc):
elif event.type == EventType.CREMATION: elif event.type == EventType.CREMATION:
event_type = 'burial' event_type = 'burial'
modifier = 'cremated' modifier = 'cremated'
elif event.type == EventType.OCCUPATION:
event_type = 'occupation'
else: else:
return return
@ -520,6 +536,17 @@ class TreeDocBase(BaseDoc, TreeDoc):
place = escape(_pd.display_event(db, event)) place = escape(_pd.display_event(db, event))
if event_type == 'occupation' and self.occupation != "no":
description = escape(event.description)
self.write(level, 'profession = {%s}' % description)
if self.occupation == "date":
self.write(level+1, '{%s}' % date_str)
if self.occupation == "place":
self.write(level+1, '{%s}' % place)
if self.occupation == "date place":
self.write(level+1, '{%s}\, {%s}' % (date_str, place))
self.write(level, ',\n')
if modifier: if modifier:
event_type += '+' event_type += '+'
self.write(level, '%s = {%s}{%s}{%s},\n' % self.write(level, '%s = {%s}{%s}{%s},\n' %