Commit 560ac695 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][toolchaineditor] Separate datasets, analyzers and algorithm blocks in subgraph

parent 080c1469
......@@ -115,33 +115,44 @@ class SimpleToolchainPreview(QWidget):
BLOCK_COLOR = "#d4d4cd"
ANALYZER_COLOR = "#8cecf5"
for block in json_object["datasets"]:
name, label = build_block_table(block, DATASET_COLOR)
graph.node(name=name, label=label)
for block in json_object["blocks"]:
name, label = build_block_table(block, BLOCK_COLOR)
graph.node(name=name, label=label)
for block in json_object.get("loops", []):
block_name = block["name"]
label = f"<<table border='1' cellborder='1' bgcolor='{BLOCK_COLOR}'>"
label += f"<tr><td colspan='2' border='0'>{block_name}</td></tr>"
for prefix in ["processor", "evaluator"]:
label += "<tr><td><table border='0' cellborder='1' bgcolor='#def2a7'>"
label += f"<tr><td colspan='2' border='0'>{prefix}</td></tr>"
label += build_rows(
block.get(f"{prefix}_inputs", {}),
block.get(f"{prefix}_outputs", {}),
)
label += "</table></td></tr>"
label += "</table>>"
graph.node(block_name, label=label)
for block in json_object["analyzers"]:
name, label = build_block_table(block, ANALYZER_COLOR)
graph.node(name=name, label=label)
with graph.subgraph(name="cluster_datasets") as dg:
dg.attr(color="white")
for block in json_object["datasets"]:
name, label = build_block_table(block, DATASET_COLOR)
dg.node(name=name, label=label)
with graph.subgraph(name="cluster_blocks") as bg:
bg.attr(color="white")
for block in json_object["blocks"]:
name, label = build_block_table(block, BLOCK_COLOR)
bg.node(name=name, label=label)
for block in json_object.get("loops", []):
block_name = block["name"]
label = f"<<table border='1' cellborder='1' bgcolor='{BLOCK_COLOR}'>"
label += f"<tr><td colspan='2' border='0'>{block_name}</td></tr>"
for prefix in ["processor", "evaluator"]:
label += (
"<tr><td><table border='0' cellborder='1' bgcolor='#def2a7'>"
)
label += f"<tr><td colspan='2' border='0'>{prefix}</td></tr>"
label += build_rows(
block.get(f"{prefix}_inputs", {}),
block.get(f"{prefix}_outputs", {}),
)
label += "</table></td></tr>"
label += "</table>>"
bg.node(block_name, label=label)
with graph.subgraph(name="cluster_analyzers") as ag:
ag.attr(color="white")
for block in json_object["analyzers"]:
name, label = build_block_table(block, ANALYZER_COLOR)
ag.node(name=name, label=label)
for connection in json_object["connections"]:
from_block, output = connection["from"].split(".")
......
Supports Markdown
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