mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-16 22:38:18 +00:00
@ -26,6 +26,8 @@ import jsonschema
|
||||
|
||||
from ..version import __version__
|
||||
from ..schemas.topology import TOPOLOGY_SCHEMA
|
||||
from ..utils.qt import qt_font_to_style
|
||||
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
@ -403,20 +405,7 @@ def _convert_label(label):
|
||||
"""
|
||||
Convert a label from 1.X to the new format
|
||||
"""
|
||||
font_info = label["font"].split(",")
|
||||
style = "font-family: {};font-size: {};".format(font_info[0], font_info[1])
|
||||
if font_info[4] == "75":
|
||||
style += "font-weight: bold;"
|
||||
if font_info[5] == "1":
|
||||
style += "font-style: italic;"
|
||||
color = label["color"]
|
||||
|
||||
if len(color) == 9:
|
||||
style += "fill: #" + color[-6:] + ";"
|
||||
style += "fill-opacity: {};".format(round(1.0 / 255 * int(color[:3][-2:], base=16), 2))
|
||||
else:
|
||||
style += "fill: #" + color[-6:] + ";"
|
||||
style += "fill-opacity: {};".format(1.0)
|
||||
style = qt_font_to_style(label["font"], label["color"])
|
||||
return {
|
||||
"text": label["text"],
|
||||
"rotation": 0,
|
||||
|
Reference in New Issue
Block a user