enable Graphviz node port selection, optionable (p.r. 456)
This enables the headport and tailport attributes for all edges in the Graphviz file. The default (off) value makes the arrows between persons and/or family nodes attach their ends to the respective node at any position. When this option is selected, the position facing the node on the other side of the arrow is always chosen.
This commit is contained in:
parent
8ebb4d35fa
commit
f31caf1ea4
@ -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 <azrdev@qrdn.de>
|
||||
#
|
||||
# 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 ) )
|
||||
|
Loading…
Reference in New Issue
Block a user