feat: improving graph generation

This commit is contained in:
Ferrari Martino Giordano
2024-03-12 12:06:59 +01:00
parent 30589b7eb1
commit 7c1158ce75
+16 -12
View File
@@ -118,7 +118,7 @@ def __doc_common_gam__(name, obj, edges, thread):
def __doc_triggered_iogam__(name, obj, edges, thread): def __doc_triggered_iogam__(name, obj, edges, thread):
node = "" signals = ""
if "InputSignals" in obj: if "InputSignals" in obj:
for i, (l, sig) in enumerate(obj["InputSignals"].items()): for i, (l, sig) in enumerate(obj["InputSignals"].items()):
alias = __sig_alias__(l, sig) alias = __sig_alias__(l, sig)
@@ -132,14 +132,14 @@ def __doc_triggered_iogam__(name, obj, edges, thread):
) )
) )
if i > 1: if i > 1:
node += " | " signals += " | "
node += f"<in_{__sig_name__(l)}> " signals += f"<in_{__sig_name__(l)}> "
if i == 0: if i == 0:
node += "Trigger | { { " signals += "Trigger | { { "
else: else:
node += f"{l}" signals += f"{l}"
node += " } | { " signals += " } | { "
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()):
alias = __sig_alias__(l, sig) alias = __sig_alias__(l, sig)
@@ -153,9 +153,10 @@ def __doc_triggered_iogam__(name, obj, edges, thread):
) )
) )
if i != 0: if i != 0:
node += " | " signals += " | "
node += f"<out_{__sig_name__(l)}> {l} " signals += f"<out_{__sig_name__(l)}> {l} "
node += " } }" signals += " } }"
node = f'{name} [tooltip=" TriggeredIOGAM::{name} ", label="{name}&#92;nTriggeredIOGAM | {signals}", style=filled, fillcolor="#eee"];\n'
return node, edges return node, edges
@@ -218,12 +219,14 @@ def __doc_iogam__(id, obj, edges, thread):
) )
) )
orelcount += 1 orelcount += 1
fill = "#999" fill = "#fff"
fsize = 14.0 fsize = 14.0
if bold or irelcount > 1 or orelcount > 1: if bold or irelcount > 1 or orelcount > 1:
fill = "#333" fill = "#333"
else: else:
fsize = 8.0 irow = f"<in_{irelcount-1}>"
orow = f"<out_{orelcount-1}>"
fsize = 2.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,'
@@ -267,7 +270,7 @@ def __doc_gam__(label, 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":
sigs, datasources = __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 sigs: if sigs:
@@ -282,6 +285,7 @@ def __process_gamds__(name, signals, edges):
outputs = {} outputs = {}
inputs = {} inputs = {}
done = False done = False
to_keep = []
while not done: while not done:
signals = {} signals = {}
for edge in edges: for edge in edges: