diff --git a/nutils/_graph.py b/nutils/_graph.py index 939308c58..b39b00a67 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': + graph = re.sub(b'', insert_clickHandler, graph, count=1, flags=re.DOTALL) + img.write(graph) + +insert_clickHandler = rb''' + +''' class RegularNode(Node[Metadata]):