Breaking change for 2.X topologies! Store width and height for nodes & a

style properties
This commit is contained in:
Julien Duponchelle committed 2016-07-01 14:38:42 +02:00
1 parent fe7bcae6a1
commit 818174824b
4 files changed
+55 -24

No files matched your search

+31 -10
View File
@@ -59,16 +59,17 @@ class Node:
self._command_line = None
self._node_directory = None
self._status = "stopped"
self._width = 70
self._height = 70
self._x = 0
self._y = 0
self._z = 0
self._symbol = ":/symbols/computer.svg"
self._label = {
"color": "#ff000000",
"y": -25.0,
"y": -25,
"text": "",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"x": -17.0234375
"style": "",
"x": -17
}
# Update node properties with additional elements
for prop in kwargs:
@@ -164,6 +165,22 @@ class Node:
def z(self, val):
self._z = val
@property
def width(self):
return self._width
@width.setter
def width(self, val):
self._width = val
@property
def height(self):
return self._height
@height.setter
def height(self, val):
self._height = val
@property
def symbol(self):
return self._symbol
@@ -396,9 +413,11 @@ class Node:
"console_type": self._console_type,
"properties": self._properties,
"label": self._label,
"x": int(self._x),
"y": int(self._y),
"z": int(self._z),
"x": self._x,
"y": self._y,
"z": self._z,
"width": self._width,
"height": self._height,
"symbol": self._symbol
}
return {
@@ -415,8 +434,10 @@ class Node:
"properties": self._properties,
"status": self._status,
"label": self._label,
"x": int(self._x),
"y": int(self._y),
"z": int(self._z),
"x": self._x,
"y": self._y,
"z": self._z,
"width": self._width,
"height": self._height,
"symbol": self._symbol
}
+12 -12
View File
@@ -18,19 +18,19 @@
LABEL_OBJECT_SCHEMA = {
"type": "object",
"properties": {
"color": {
"type": "string",
"pattern": "^#[0-9a-f]{6,8}$"
},
"font": {
"type": "string",
"minLength": 1
},
"text": {"type": "string"},
"x": {"type": "number"},
"y": {"type": "number"},
"z": {"type": "number"},
"rotation": {"type": "number"}
"style": {
"description": "SVG style attribute",
"type": "string"
},
"x": {
"description": "Relative X position of the label",
"type": "integer"
},
"y": {
"description": "Relative Y position of the label",
"type": "integer"
},
},
"required": [
"text",
+8
View File
@@ -144,6 +144,14 @@ NODE_OBJECT_SCHEMA = {
"type": "string",
"minLength": 1
},
"width": {
"description": "Width of the node",
"type": "integer"
},
"height": {
"description": "Height of the node",
"type": "integer"
},
"x": {
"description": "X position of the node",
"type": "integer"