gui: fixed issue updating preferences, resulting in nodes changing to a default icon

This commit is contained in:
Blake Harnden 2022-09-10 10:06:40 -07:00
parent d045fc0d51
commit 88ccd1f194
3 changed files with 11 additions and 11 deletions

View file

@ -776,7 +776,7 @@ class Node:
id=proto.id,
name=proto.name,
type=NodeType(proto.type),
model=proto.model,
model=proto.model or None,
position=Position.from_proto(proto.position),
services=set(proto.services),
config_services=set(proto.config_services),

View file

@ -93,15 +93,15 @@ TYPE_MAP: Dict[Tuple[NodeType, str], ImageEnum] = {
(NodeType.DEFAULT, "host"): ImageEnum.HOST,
(NodeType.DEFAULT, "mdr"): ImageEnum.MDR,
(NodeType.DEFAULT, "prouter"): ImageEnum.PROUTER,
(NodeType.HUB, ""): ImageEnum.HUB,
(NodeType.SWITCH, ""): ImageEnum.SWITCH,
(NodeType.WIRELESS_LAN, ""): ImageEnum.WLAN,
(NodeType.WIRELESS, ""): ImageEnum.WIRELESS,
(NodeType.EMANE, ""): ImageEnum.EMANE,
(NodeType.RJ45, ""): ImageEnum.RJ45,
(NodeType.TUNNEL, ""): ImageEnum.TUNNEL,
(NodeType.DOCKER, ""): ImageEnum.DOCKER,
(NodeType.LXC, ""): ImageEnum.LXC,
(NodeType.HUB, None): ImageEnum.HUB,
(NodeType.SWITCH, None): ImageEnum.SWITCH,
(NodeType.WIRELESS_LAN, None): ImageEnum.WLAN,
(NodeType.WIRELESS, None): ImageEnum.WIRELESS,
(NodeType.EMANE, None): ImageEnum.EMANE,
(NodeType.RJ45, None): ImageEnum.RJ45,
(NodeType.TUNNEL, None): ImageEnum.TUNNEL,
(NodeType.DOCKER, None): ImageEnum.DOCKER,
(NodeType.LXC, None): ImageEnum.LXC,
}

View file

@ -123,7 +123,7 @@ def _get_custom_file(config: GuiConfig, name: str) -> Optional[str]:
def get_icon(node: Node, app: "Application") -> PhotoImage:
scale = app.app_scale
image = None
# node icon was overriden with a specific value
# node icon was overridden with a specific value
if node.icon:
try:
image = images.from_file(node.icon, width=images.NODE_SIZE, scale=scale)