|
|
@ -260,6 +260,8 @@ class Node:
|
|
|
|
_icon_dir = None
|
|
|
|
_icon_dir = None
|
|
|
|
_icon = None
|
|
|
|
_icon = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_height = 1.9
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, label: str = ""):
|
|
|
|
def __init__(self, label: str = ""):
|
|
|
|
"""Node represents a system component.
|
|
|
|
"""Node represents a system component.
|
|
|
|
|
|
|
|
|
|
|
@ -272,9 +274,11 @@ class Node:
|
|
|
|
# fmt: off
|
|
|
|
# fmt: off
|
|
|
|
# If a node has an icon, increase the height slightly to avoid
|
|
|
|
# If a node has an icon, increase the height slightly to avoid
|
|
|
|
# that label being spanned between icon image and white space.
|
|
|
|
# that label being spanned between icon image and white space.
|
|
|
|
|
|
|
|
# Increase the height by the number of new lines included in the label.
|
|
|
|
|
|
|
|
padding = 0.4 * (label.count('\n'))
|
|
|
|
self.attrs = {
|
|
|
|
self.attrs = {
|
|
|
|
"shape": "none",
|
|
|
|
"shape": "none",
|
|
|
|
"height": "1.9",
|
|
|
|
"height": str(self._height + padding),
|
|
|
|
"image": self._load_icon(),
|
|
|
|
"image": self._load_icon(),
|
|
|
|
} if self._icon else {}
|
|
|
|
} if self._icon else {}
|
|
|
|
# fmt: on
|
|
|
|
# fmt: on
|
|
|
|