Skip to content

Commit fbca253

Browse files
hahnjosam-m888
authored andcommitted
Minor enhancements and fixes for GenealogyTree[gramps50] (#184)
* GenealogyTree: Correctly handle max_up If there is more data than the user wants to export (specified by the 'max_up' parameter), correctly emit a termination node instead of omitting the last level. The check is analogous to the case in subgraph_down. * GenealogyTree: Add option to exclude siblings of ancestors This reduces some space problems for sandclock reports. * GenealogyTree: Allow no generations up or down This makes sense for Sandclock reports to end immediately above / below the center person / family.
1 parent 741a94c commit fbca253

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

GenealogyTree/gt_sandclock.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def __init__(self, database, options, user):
7777
self._pid = get_value('pid')
7878
self.max_up = menu.get_option_by_name('genup').get_value()
7979
self.max_down = menu.get_option_by_name('gendown').get_value()
80+
self.include_siblings = menu.get_option_by_name('siblings').get_value()
8081
self.include_images = menu.get_option_by_name('images').get_value()
8182

8283
def write_report(self):
@@ -137,7 +138,7 @@ def subgraph_up_parents(self, level, family):
137138
if handle:
138139
parent = self._db.get_person_from_handle(handle)
139140
family_handle = parent.get_main_parents_family_handle()
140-
if family_handle:
141+
if family_handle and level < self.max_up:
141142
self.subgraph_up(level+1, 'parent', family_handle,
142143
handle)
143144
else:
@@ -154,7 +155,7 @@ def subgraph_up(self, level, subgraph_type, family_handle, ghandle):
154155
if childref.ref == ghandle:
155156
if subgraph_type != 'sandclock':
156157
self.doc.write_node(self._db, level+1, 'g', child, True)
157-
else:
158+
elif self.include_siblings:
158159
self.doc.write_node(self._db, level+1, 'c', child, False)
159160

160161
if self._person_report and subgraph_type == 'sandclock':
@@ -222,14 +223,18 @@ def add_menu_options(self, menu):
222223
self.__pid.set_help(_("The center family for the report"))
223224
menu.add_option(category_name, "pid", self.__pid)
224225

225-
genup = NumberOption(_("Generations up"), 10, 1, 100)
226+
genup = NumberOption(_("Generations up"), 10, 0, 100)
226227
genup.set_help(_("The number of generations to include in the tree"))
227228
menu.add_option(category_name, "genup", genup)
228229

229-
gendown = NumberOption(_("Generations down"), 10, 1, 100)
230+
gendown = NumberOption(_("Generations down"), 10, 0, 100)
230231
gendown.set_help(_("The number of generations to include in the tree"))
231232
menu.add_option(category_name, "gendown", gendown)
232233

234+
siblings = BooleanOption(_("Include siblings"), True)
235+
siblings.set_help(_("Include siblings of ancestors."))
236+
menu.add_option(category_name, "siblings", siblings)
237+
233238
images = BooleanOption(_("Include images"), False)
234239
images.set_help(_("Include images of people in the nodes."))
235240
menu.add_option(category_name, "images", images)

0 commit comments

Comments
 (0)