Compatibility for old node templates (those with default_symbol and hover_symbol properties).

pull/1263/head
grossmj 7 years ago
parent 8b1c68a0b7
commit ab6fe6da1d

@ -86,8 +86,7 @@ class Node:
self._first_port_name = None
# This properties will be recompute
ignore_properties = ("width", "height")
ignore_properties = ("width", "height", "hover_symbol")
self.properties = kwargs.pop('properties', {})
# Update node properties with additional elements
@ -104,7 +103,15 @@ class Node:
self.properties[prop] = kwargs[prop]
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):
"""

@ -434,11 +434,11 @@ class Project:
:param dump: Dump topology to disk
:param kwargs: See the documentation of node
"""
if node_id in self._nodes:
return self._nodes[node_id]
if node_type == "iou" and 'application_id' not in kwargs.keys():
kwargs['application_id'] = get_next_application_id(self._nodes.values())
node = Node(self, compute, name, node_id=node_id, node_type=node_type, **kwargs)

Loading…
Cancel
Save