mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
Fix an error when importing old topology without color for label
Fix #736
This commit is contained in:
parent
ac1eef256f
commit
10e7b32409
@ -431,7 +431,7 @@ def _convert_label(label):
|
||||
"""
|
||||
Convert a label from 1.X to the new format
|
||||
"""
|
||||
style = qt_font_to_style(label.get("font"), label["color"])
|
||||
style = qt_font_to_style(label.get("font"), label.get("color"))
|
||||
return {
|
||||
"text": label["text"],
|
||||
"rotation": 0,
|
||||
|
@ -33,6 +33,8 @@ def qt_font_to_style(font, color):
|
||||
if font_info[5] == "1":
|
||||
style += "font-style: italic;"
|
||||
|
||||
if color is None:
|
||||
color = "000000"
|
||||
if len(color) == 9:
|
||||
style += "fill: #" + color[-6:] + ";"
|
||||
style += "fill-opacity: {};".format(round(1.0 / 255 * int(color[:3][-2:], base=16), 2))
|
||||
|
Loading…
Reference in New Issue
Block a user