Commit baf644a9 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

python: add an SVG printer for automata

* wrap/python/spot.i (tgba._repr_svg_): Call dot to
output SVG using the same logic as in Vaucanson 2.
parent ae35cc29
......@@ -326,6 +326,22 @@ namespace std {
};
}
%pythoncode %{
import subprocess
def render_automaton_as_svg(a):
dotsrc = ostringstream()
dotty_reachable(dotsrc, a)
dotty = subprocess.Popen(['dot', '-Tsvg'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
dotty.stdin.write(dotsrc.str().encode('utf-8'))
res = dotty.communicate()
return res[0].decode('utf-8')
tgba._repr_svg_ = render_automaton_as_svg
%}
%inline %{
spot::ltl::parse_error_list
empty_parse_error_list()
......
Markdown is supported
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