Commit 19c26f51 authored by Rosen Matev's avatar Rosen Matev
Browse files

Cut long property values in data flow graph

parent 7d78f684
......@@ -550,9 +550,18 @@ class Algorithm(object):
----------
graph -- pydot.Graph
"""
# TODO deduplicate graphing?
# in all diamond structures, the subgraph is built multiple times
def format_prop(name, value, max_len=100):
assert max_len > 15, 'max_len should be at least 15'
value = str(value)
if len(value) > max_len:
value = (value[:max_len // 2] + '[...]' +
value[max_len // 2 + 5:max_len])
return '{} = {}'.format(name, value)
#inner part ########
own_name = html_escape(self.fullname)
sg = pydot.Subgraph(graph_name='cluster_' + own_name)
......@@ -565,7 +574,7 @@ class Algorithm(object):
output_props = {k: v.location for k, v in self._outputs.items()}
props = dict(props.items() + output_props.items())
props_str = '<BR/>'.join(
html_escape('{} = {}'.format(k, v)) for k, v in props.items())
html_escape(format_prop(k, v)) for k, v in props.items())
label = ('<<B>{}</B><BR/>{}>'.format(own_name, props_str
or 'defaults-only'))
gnode = pydot.Node(own_name, label=label, shape='plaintext')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment