Commit aa75f39a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][toolchaineditor] Add support for connection colors

parent 560ac695
...@@ -154,11 +154,18 @@ class SimpleToolchainPreview(QWidget): ...@@ -154,11 +154,18 @@ class SimpleToolchainPreview(QWidget):
name, label = build_block_table(block, ANALYZER_COLOR) name, label = build_block_table(block, ANALYZER_COLOR)
ag.node(name=name, label=label) ag.node(name=name, label=label)
channel_colors = json_object["representation"]["channel_colors"]
for connection in json_object["connections"]: for connection in json_object["connections"]:
from_block, output = connection["from"].split(".") from_block, output = connection["from"].split(".")
to_block, input_ = connection["to"].split(".") to_block, input_ = connection["to"].split(".")
channel_color = channel_colors.get(connection["channel"], "black")
graph.edge(f"{from_block}:out_{output}:e", f"{to_block}:in_{input_}:w") graph.edge(
f"{from_block}:out_{output}:e",
f"{to_block}:in_{input_}:w",
color=channel_color,
)
self.label.setPixmap(QPixmap.fromImage(QImage.fromData(graph.pipe()))) self.label.setPixmap(QPixmap.fromImage(QImage.fromData(graph.pipe())))
self.label.adjustSize() self.label.adjustSize()
......
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