feat: better iogam
This commit is contained in:
+22
-14
@@ -224,13 +224,14 @@ def __doc_iogam__(id, obj, edges, thread):
|
|||||||
if bold or irelcount > 1 or orelcount > 1:
|
if bold or irelcount > 1 or orelcount > 1:
|
||||||
fill = "#333"
|
fill = "#333"
|
||||||
else:
|
else:
|
||||||
irow = f"<in_{irelcount-1}>"
|
irow = f"<in_{irelcount-1}> "
|
||||||
orow = f"<out_{orelcount-1}>"
|
orow = f"<out_{orelcount-1}>"
|
||||||
fsize = 2.0
|
fill = "#666"
|
||||||
|
fsize = 0.0
|
||||||
node += f'{id}_{counter} [tooltip=" IOGAM::{id} " label="'
|
node += f'{id}_{counter} [tooltip=" IOGAM::{id} " label="'
|
||||||
node += "{ {" + irow + "} | {" + orow + "} }"
|
node += "{ {" + irow + "} | {" + orow + "} }"
|
||||||
node += f'", fillcolor="{fill}", color="#666", style=filled,'
|
node += f'", fillcolor="{fill}", color="#666", style=filled,'
|
||||||
node += f' fontcolor="#fff", fontsize={fsize}, height=0];\n'
|
node += f' fontcolor="#fff", fontsize={fsize}, height=0, width=0];\n'
|
||||||
irow = ""
|
irow = ""
|
||||||
orow = ""
|
orow = ""
|
||||||
counter += 1
|
counter += 1
|
||||||
@@ -238,7 +239,10 @@ def __doc_iogam__(id, obj, edges, thread):
|
|||||||
|
|
||||||
|
|
||||||
def __doc_constgam__(id, obj, edges, thread):
|
def __doc_constgam__(id, obj, edges, thread):
|
||||||
node = ""
|
node = f' {id} [label="{id[2:]}\n{obj["Class"]} | '
|
||||||
|
values = ""
|
||||||
|
types = ""
|
||||||
|
|
||||||
if "OutputSignals" in obj:
|
if "OutputSignals" in obj:
|
||||||
for i, (l, sig) in enumerate(obj["OutputSignals"].items()):
|
for i, (l, sig) in enumerate(obj["OutputSignals"].items()):
|
||||||
datasrc = sig["DataSource"]
|
datasrc = sig["DataSource"]
|
||||||
@@ -252,12 +256,12 @@ def __doc_constgam__(id, obj, edges, thread):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
if i != 0:
|
if i != 0:
|
||||||
node += " | "
|
values += " | "
|
||||||
node += (
|
types += " | "
|
||||||
f'<out_{__sig_name__(l)}> {__type_to_str__(mtype)}: {sig["Default"]}'
|
values += f'<out_{__sig_name__(l)}> {sig["Default"]}'
|
||||||
)
|
types += __type_to_str__(mtype)
|
||||||
|
node += "{{ " + types + " } | {" + values + "}}"
|
||||||
node += ""
|
node += '", style=filled, fillcolor="#dff"];'
|
||||||
return node, edges
|
return node, edges
|
||||||
|
|
||||||
|
|
||||||
@@ -266,13 +270,17 @@ def __doc_gam__(label, obj, edges, thread):
|
|||||||
cls = obj["Class"]
|
cls = obj["Class"]
|
||||||
node = f' {id} [label="{label}\n{obj["Class"]} | '
|
node = f' {id} [label="{label}\n{obj["Class"]} | '
|
||||||
if cls == "ConstantGAM":
|
if cls == "ConstantGAM":
|
||||||
sigs, datasources = __doc_constgam__(id, obj, edges, thread)
|
return __doc_constgam__(id, obj, edges, thread)
|
||||||
elif cls == "IOGAM":
|
elif cls == "IOGAM":
|
||||||
return __doc_iogam__(id, obj, edges, thread)
|
return __doc_iogam__(id, obj, edges, thread)
|
||||||
elif cls == "TriggeredIOGAM":
|
elif cls == "TriggeredIOGAM":
|
||||||
return __doc_triggered_iogam__(id, obj, edges, thread)
|
return __doc_triggered_iogam__(id, obj, edges, thread)
|
||||||
else:
|
else:
|
||||||
sigs, datasources = __doc_common_gam__(id, obj, edges, thread)
|
sigs, datasources = __doc_common_gam__(id, obj, edges, thread)
|
||||||
|
if cls == "MessageGAM":
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
pprint.pprint(obj["+Events"])
|
||||||
if sigs:
|
if sigs:
|
||||||
node += sigs + '"];'
|
node += sigs + '"];'
|
||||||
else:
|
else:
|
||||||
@@ -428,16 +436,16 @@ def __process_edges__(edges, datasources):
|
|||||||
in_type = __type_to_str__(source[2])
|
in_type = __type_to_str__(source[2])
|
||||||
out_type = __type_to_str__(target[2])
|
out_type = __type_to_str__(target[2])
|
||||||
mtype = in_type if in_type == out_type else f"{in_type} -> {out_type}"
|
mtype = in_type if in_type == out_type else f"{in_type} -> {out_type}"
|
||||||
arrows += f'{a} -> {b} [tooltip="{mtype}", labelfloat=false];\n'
|
arrows += f'{a} -> {b} [tooltip=" {mtype} ", labelfloat=false];\n'
|
||||||
return arrows
|
return arrows
|
||||||
|
|
||||||
|
|
||||||
def __doc_state__(label, state, app):
|
def __doc_state__(label, state, app):
|
||||||
mdstate = ""
|
mdstate = ""
|
||||||
graph = f"digraph {label[1:]}" + "{\n"
|
graph = f"digraph {label[1:]}" + "{\n"
|
||||||
graph += "graph [ranksep=2];\n"
|
graph += "ranksep = 1;\n"
|
||||||
|
graph += "nodesep = 0.5;\n"
|
||||||
graph += "rankdir = LR;\n"
|
graph += "rankdir = LR;\n"
|
||||||
graph += "beautify = true;\n"
|
|
||||||
graph += "node [shape=Mrecord];\n"
|
graph += "node [shape=Mrecord];\n"
|
||||||
graph += "\n"
|
graph += "\n"
|
||||||
arrows = ""
|
arrows = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user