Fix an error when importing old topology without color for label

Fix #736
pull/774/head
Julien Duponchelle 8 years ago
parent ac1eef256f
commit 10e7b32409
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -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…
Cancel
Save