From ba0c222c4eea936e9f202f8a30d1bb5144545478 Mon Sep 17 00:00:00 2001 From: prculley Date: Sat, 11 Apr 2020 10:21:33 -0500 Subject: [PATCH] Relationship Graph: Add option for 'offset parents' Replaces 'use subgraph' option Fix extra node appearing when a spouse is filtered out Fixes #11550, #11494 --- gramps/gen/plug/docgen/graphdoc.py | 8 -------- gramps/plugins/graph/gvfamilylines.py | 7 +++++++ gramps/plugins/graph/gvrelgraph.py | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gramps/gen/plug/docgen/graphdoc.py b/gramps/gen/plug/docgen/graphdoc.py index 670e88128..a311592d2 100644 --- a/gramps/gen/plug/docgen/graphdoc.py +++ b/gramps/gen/plug/docgen/graphdoc.py @@ -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() diff --git a/gramps/plugins/graph/gvfamilylines.py b/gramps/plugins/graph/gvfamilylines.py index 05c7081ef..9215135a4 100644 --- a/gramps/plugins/graph/gvfamilylines.py +++ b/gramps/plugins/graph/gvfamilylines.py @@ -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')) # -------------------------------- diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py index cacbc3f82..71457a33a 100644 --- a/gramps/plugins/graph/gvrelgraph.py +++ b/gramps/plugins/graph/gvrelgraph.py @@ -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