mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Compatibility for old node templates (those with default_symbol and hover_symbol properties).
This commit is contained in:
parent
8b1c68a0b7
commit
ab6fe6da1d
@ -86,8 +86,7 @@ class Node:
|
|||||||
self._first_port_name = None
|
self._first_port_name = None
|
||||||
|
|
||||||
# This properties will be recompute
|
# This properties will be recompute
|
||||||
ignore_properties = ("width", "height")
|
ignore_properties = ("width", "height", "hover_symbol")
|
||||||
|
|
||||||
self.properties = kwargs.pop('properties', {})
|
self.properties = kwargs.pop('properties', {})
|
||||||
|
|
||||||
# Update node properties with additional elements
|
# Update node properties with additional elements
|
||||||
@ -104,7 +103,15 @@ class Node:
|
|||||||
self.properties[prop] = kwargs[prop]
|
self.properties[prop] = kwargs[prop]
|
||||||
|
|
||||||
if self._symbol is None:
|
if self._symbol is None:
|
||||||
self.symbol = ":/symbols/computer.svg"
|
# compatibility with old node templates
|
||||||
|
if "default_symbol" in self.properties:
|
||||||
|
default_symbol = self.properties.pop("default_symbol")
|
||||||
|
if default_symbol.endswith("normal.svg"):
|
||||||
|
self.symbol = default_symbol[:-11] + ".svg"
|
||||||
|
else:
|
||||||
|
self.symbol = default_symbol
|
||||||
|
else:
|
||||||
|
self.symbol = ":/symbols/router.svg"
|
||||||
|
|
||||||
def is_always_running(self):
|
def is_always_running(self):
|
||||||
"""
|
"""
|
||||||
|
@ -434,11 +434,11 @@ class Project:
|
|||||||
:param dump: Dump topology to disk
|
:param dump: Dump topology to disk
|
||||||
:param kwargs: See the documentation of node
|
:param kwargs: See the documentation of node
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if node_id in self._nodes:
|
if node_id in self._nodes:
|
||||||
return self._nodes[node_id]
|
return self._nodes[node_id]
|
||||||
|
|
||||||
if node_type == "iou" and 'application_id' not in kwargs.keys():
|
if node_type == "iou" and 'application_id' not in kwargs.keys():
|
||||||
|
|
||||||
kwargs['application_id'] = get_next_application_id(self._nodes.values())
|
kwargs['application_id'] = get_next_application_id(self._nodes.values())
|
||||||
|
|
||||||
node = Node(self, compute, name, node_id=node_id, node_type=node_type, **kwargs)
|
node = Node(self, compute, name, node_id=node_id, node_type=node_type, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user