diff --git a/gramps/gen/plug/docgen/graphdoc.py b/gramps/gen/plug/docgen/graphdoc.py index 694812168..562ee29b1 100644 --- a/gramps/gen/plug/docgen/graphdoc.py +++ b/gramps/gen/plug/docgen/graphdoc.py @@ -8,6 +8,7 @@ # Copyright (C) 2007 Brian G. Matherly # Copyright (C) 2009 Benny Malengier # Copyright (C) 2009 Gary Burton +# Copyright (C) 2017 Jonathan Biegert # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -71,6 +72,11 @@ _RANKDIR = [ { 'name' : _("Vertical (↓)"), 'value' : "TB" }, { 'name' : _("Horizontal (→)"), 'value' : "LR" }, { 'name' : _("Horizontal (←)"), 'value' : "RL" } ] +_NODE_PORTS = { "TB" : ("n", "s"), + "BT" : ("s", "n"), + "LR" : ("w", "e"), + "RL" : ("e", "w") } + _PAGEDIR = [ { 'name' : _("Bottom, left"), 'value' :"BL" }, { 'name' : _("Bottom, right"), 'value' :"BR" }, { 'name' : _("Top, left"), 'value' :"TL" }, @@ -185,6 +191,10 @@ class GVOptions: spline.set_help(_("How the lines between objects will be drawn.")) menu.add_option(category, "spline", spline) + node_ports = BooleanOption(_("Alternate line attachment"), False) + node_ports.set_help(_("Whether lines attach to nodes differently")) + menu.add_option(category, "node_ports", node_ports) + # the page direction option only makes sense when the # number of horizontal and/or vertical pages is > 1, # so we need to remember these 3 controls for later @@ -410,6 +420,7 @@ class GVDocBase(BaseDoc, GVDoc): self.vpages = get_value('v_pages') self.usesubgraphs = get_value('usesubgraphs') self.spline = get_value('spline') + self.node_ports = get_value('node_ports') paper_size = paper_style.get_size() @@ -458,6 +469,9 @@ class GVDocBase(BaseDoc, GVDoc): '\n' + ' edge [len=0.5 style=solid fontsize=%d];\n' % self.fontsize ) + if self.node_ports: + self.write(' edge [headport=%s tailport=%s];\n' + % _NODE_PORTS[self.rankdir]) if self.fontfamily: self.write( ' node [style=filled fontname="%s" fontsize=%d];\n' % ( self.fontfamily, self.fontsize ) )