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.
This commit is contained in:
parent
ae35cc29f5
commit
baf644a93a
1 changed files with 16 additions and 0 deletions
|
|
@ -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 %{
|
%inline %{
|
||||||
spot::ltl::parse_error_list
|
spot::ltl::parse_error_list
|
||||||
empty_parse_error_list()
|
empty_parse_error_list()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue