Commit 4bb7fc38 authored by Flavio TARSETTI's avatar Flavio TARSETTI

[widgets][toolchaineditor] add default color channel if none found

parent 60209994
......@@ -389,7 +389,7 @@ class Connection(QGraphicsPathItem):
self.end_pin_name = connection_details["to"].split(".")[1]
self.channel = connection_details["channel"]
if self.channel is None or self.channel not in channel_colors:
if self.channel is None:
warning = QMessageBox()
warning.setIcon(QMessageBox.Warning)
warning.setWindowTitle(toolchain.tr("Connection creation"))
......@@ -400,6 +400,21 @@ class Connection(QGraphicsPathItem):
warning.exec_()
else:
if self.channel not in channel_colors:
toolchain.web_representation["channel_colors"][self.channel] = "#000000"
channel_colors = toolchain.web_representation["channel_colors"]
warning = QMessageBox()
warning.setIcon(QMessageBox.Warning)
warning.setWindowTitle(toolchain.tr("Channel color"))
warning.setInformativeText(
toolchain.tr(
"No channel color found. Assigning default black color"
)
)
warning.setStandardButtons(QMessageBox.Ok)
warning.exec_()
hexadecimal = channel_colors[self.channel].lstrip("#")
hlen = len(hexadecimal)
self.connection_color = list(
......
Markdown is supported
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