Commit 15a33b72 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Merge branch 'patch-3' into 'master'

Small refactoring of graphviz_draw.

See merge request !42
parents 860e9f86 716172b2
Pipeline #759 passed with stage
in 66 minutes and 41 seconds
...@@ -558,11 +558,11 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None, ...@@ -558,11 +558,11 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None,
output.encode("utf8")) output.encode("utf8"))
data = open(output).read() data = open(output).read()
os.remove(output) os.remove(output)
else: elif output is not None:
if output_format == "auto": if output_format == "auto":
if output == "": if output == "":
output_format = "xlib" output_format = "xlib"
elif output is not None: else:
output_format = output.split(".")[-1] output_format = output.split(".")[-1]
# if using xlib we need to fork the process, otherwise good ol' # if using xlib we need to fork the process, otherwise good ol'
...@@ -575,7 +575,7 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None, ...@@ -575,7 +575,7 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None,
os._exit(0) # since we forked, it's good to be sure os._exit(0) # since we forked, it's good to be sure
if output_format != "xlib": if output_format != "xlib":
os.wait() os.wait()
elif output is not None: else:
libgv.gvRenderFilename(gvc, gvg, output_format.encode("utf8"), libgv.gvRenderFilename(gvc, gvg, output_format.encode("utf8"),
output.encode("utf8")) output.encode("utf8"))
......
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