improve doc graphs display

pull/194/head
Terrtia 2018-04-06 14:56:25 +02:00
parent 312366434d
commit 7fd66987f5
2 changed files with 25 additions and 8 deletions

View File

@ -28,6 +28,10 @@ def main():
1: data graph''', 1: data graph''',
choices=[0, 1], action='store') choices=[0, 1], action='store')
parser.add_argument('spline', type=str, default="ortho",
help='''The graph splines type, spline:default , ortho: orthogonal''',
choices=["ortho", "spline"], action='store')
args = parser.parse_args() args = parser.parse_args()
with open(path, 'r') as f: with open(path, 'r') as f:
@ -63,6 +67,8 @@ def main():
for e in all_modules: for e in all_modules:
f2.write(e+"\n") f2.write(e+"\n")
output_text_graph = ""
# flow between modules # flow between modules
if args.type == 0: if args.type == 0:
@ -81,7 +87,15 @@ def main():
else: else:
output_set_graph.add("\"" + module + "\"" + "->" + streamingSub[stream_out] + ";\n") output_set_graph.add("\"" + module + "\"" + "->" + streamingSub[stream_out] + ";\n")
output_text_graph = "" # graph head
output_text_graph += "digraph unix {\n"
output_text_graph += "graph [pad=\"0.5\"];\n"
output_text_graph += "size=\"25,25\";\n"
output_text_graph += "splines="
output_text_graph += args.spline
output_text_graph += ";\n"
output_text_graph += "node [color=lightblue2, style=filled];\n"
# flow between data # flow between data
if args.type == 1: if args.type == 1:
@ -95,13 +109,16 @@ def main():
output_set_graph.add("\"" + stream_in + "\"" + "->" + stream_out + ";\n") output_set_graph.add("\"" + stream_in + "\"" + "->" + stream_out + ";\n")
# graph head # graph head
output_text_graph += "digraph unix {\n"\ output_text_graph += "digraph unix {\n"
"graph [pad=\"0.5\"];\n"\ output_text_graph += "graph [pad=\"0.5\"];\n"
"size=\"25,25\";\n"\ output_text_graph += "size=\"25,25\";\n"
"node [color=lightblue2, style=filled];\n" output_text_graph += "splines="
output_text_graph += args.spline
output_text_graph += ";\n"
output_text_graph += "node [color=tan, style=filled];\n"
# create final txt graph # create final txt graph
for elem in output_set_graph: for elem in output_set_graph:

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
python3 $AIL_HOME/doc/generate_graph_data.py 0 | dot -T png -o $AIL_HOME/doc/module-data-flow.png python3 $AIL_HOME/doc/generate_graph_data.py 0 ortho | dot -T png -o $AIL_HOME/doc/module-data-flow.png
python3 $AIL_HOME/doc/generate_graph_data.py 1 | dot -T png -o $AIL_HOME/doc/data-flow.png python3 $AIL_HOME/doc/generate_graph_data.py 1 ortho | dot -T png -o $AIL_HOME/doc/data-flow.png