feat: better iogam

This commit is contained in:
Martino Ferrari
2024-03-12 23:30:58 +01:00
parent 7c1158ce75
commit 67e57d5372
+20 -12
View File
@@ -226,11 +226,12 @@ def __doc_iogam__(id, obj, edges, thread):
else:
irow = f"<in_{irelcount-1}> "
orow = f"<out_{orelcount-1}>"
fsize = 2.0
fill = "#666"
fsize = 0.0
node += f'{id}_{counter} [tooltip=" IOGAM::{id} " label="'
node += "{ {" + irow + "} | {" + orow + "} }"
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 = ""
orow = ""
counter += 1
@@ -238,7 +239,10 @@ def __doc_iogam__(id, obj, edges, thread):
def __doc_constgam__(id, obj, edges, thread):
node = ""
node = f' {id} [label="{id[2:]}&#92;n{obj["Class"]} | '
values = ""
types = ""
if "OutputSignals" in obj:
for i, (l, sig) in enumerate(obj["OutputSignals"].items()):
datasrc = sig["DataSource"]
@@ -252,12 +256,12 @@ def __doc_constgam__(id, obj, edges, thread):
)
)
if i != 0:
node += " | "
node += (
f'<out_{__sig_name__(l)}> {__type_to_str__(mtype)}: {sig["Default"]}'
)
node += ""
values += " | "
types += " | "
values += f'<out_{__sig_name__(l)}> {sig["Default"]}'
types += __type_to_str__(mtype)
node += "{{ " + types + " } | {" + values + "}}"
node += '", style=filled, fillcolor="#dff"];'
return node, edges
@@ -266,13 +270,17 @@ def __doc_gam__(label, obj, edges, thread):
cls = obj["Class"]
node = f' {id} [label="{label}&#92;n{obj["Class"]} | '
if cls == "ConstantGAM":
sigs, datasources = __doc_constgam__(id, obj, edges, thread)
return __doc_constgam__(id, obj, edges, thread)
elif cls == "IOGAM":
return __doc_iogam__(id, obj, edges, thread)
elif cls == "TriggeredIOGAM":
return __doc_triggered_iogam__(id, obj, edges, thread)
else:
sigs, datasources = __doc_common_gam__(id, obj, edges, thread)
if cls == "MessageGAM":
import pprint
pprint.pprint(obj["+Events"])
if sigs:
node += sigs + '"];'
else:
@@ -435,9 +443,9 @@ def __process_edges__(edges, datasources):
def __doc_state__(label, state, app):
mdstate = ""
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 += "beautify = true;\n"
graph += "node [shape=Mrecord];\n"
graph += "\n"
arrows = ""