Relationship Graph: Add option for 'offset parents'

Replaces 'use subgraph' option
Fix extra node appearing when a spouse is filtered out

Fixes #11550, #11494
This commit is contained in:
prculley 2020-04-11 10:21:33 -05:00 committed by Nick Hall
parent 7bfbec139f
commit ba0c222c4e
3 changed files with 25 additions and 9 deletions

View File

@ -258,13 +258,6 @@ class GVOptions:
"between columns."))
menu.add_option(category, "ranksep", ranksep)
use_subgraphs = BooleanOption(_('Use subgraphs'), True)
use_subgraphs.set_help(_("Subgraphs can help Graphviz position "
"spouses together, but with non-trivial "
"graphs will result in longer lines and "
"larger graphs."))
menu.add_option(category, "usesubgraphs", use_subgraphs)
################################
category = _("Note")
################################
@ -450,7 +443,6 @@ class GVDocBase(BaseDoc, GVDoc):
self.ranksep = get_option('ranksep').get_value()
self.ratio = get_option('ratio').get_value()
self.vpages = get_option('v_pages').get_value()
self.usesubgraphs = get_option('usesubgraphs').get_value()
self.spline = get_option('spline').get_value()
self.node_ports = get_option('node_ports').get_value()

View File

@ -181,6 +181,13 @@ class FamilyLinesOptions(MenuReportOptions):
stdoptions.add_date_format_option(menu, category_name, locale_opt)
use_subgraphs = BooleanOption(_('Use subgraphs'), True)
use_subgraphs.set_help(_("Subgraphs can help Graphviz position "
"spouses together, but with non-trivial "
"graphs will result in longer lines and "
"larger graphs."))
add_option("usesubgraphs", use_subgraphs)
# --------------------------------
add_option = partial(menu.add_option, _('People of Interest'))
# --------------------------------

View File

@ -497,7 +497,8 @@ class RelGraphReport(Report):
self.doc.start_subgraph(fam_id)
f_handle = fam.get_father_handle()
m_handle = fam.get_mother_handle()
if f_handle and m_handle:
if(self.use_subgraphs == 2 and f_handle in self.persons and
m_handle in self.persons):
father = self._db.get_person_from_handle(f_handle)
mother = self._db.get_person_from_handle(m_handle)
fcount = 0
@ -969,6 +970,22 @@ class RelGraphOptions(MenuReportOptions):
"to parents and children."))
add_option("showfamily", showfamily)
use_subgraphs = EnumeratedListOption(_('Parent grouping'), 0)
use_subgraphs.add_item(0, _('Normal'))
use_subgraphs.add_item(1, _('Parents together'))
use_subgraphs.add_item(2, _('Parents offset'))
use_subgraphs.set_help(_(
"In the 'Normal' setting parents will be located to keep most "
"lines short.\n"
"The 'Parents together' setting can help position "
"spouses next to each other, but with non-trivial graphs will "
"result in longer lines and larger graphs.\n"
"The Parents offset setting will also try to put spouses near "
"each other, however they will be offset from each other. This "
"will tend to make graphs with many people in a generation more "
"square."))
add_option("usesubgraphs", use_subgraphs)
def __update_filters(self):
"""
Update the filter list based on the selected person