diff --git a/nutils/_graph.py b/nutils/_graph.py index 939308c58..f11964fc7 100644 --- a/nutils/_graph.py +++ b/nutils/_graph.py @@ -5,6 +5,7 @@ import subprocess import abc import html +import re Metadata = TypeVar('Metadata') GraphvizColorCallback = Callable[['Node'], Optional[str]] @@ -68,7 +69,33 @@ def export_graphviz(self, *, fill_color: Optional[GraphvizColorCallback] = None, for i, line in enumerate(src.split('\n'), 1): print('{:04d} {}'.format(i, line)) treelog.warning('graphviz failed for error code', status.returncode) - img.write(status.stdout) + graph = status.stdout + if image_type == 'svg': + i = graph.rindex(b'') + graph = graph[:i] + clickHandler + graph[i:] + img.write(graph) + +clickHandler = rb''' + +''' class RegularNode(Node[Metadata]):