doc strings to for node item position.
@@ -154,10 +154,24 @@ class AbstractNodeItem(QtWidgets.QGraphicsItem):
@property
def xy_pos(self):
+ """
+ return the item scene postion.
+ ("node.pos" conflicted with "QGraphicsItem.pos()" so it was refactored to "xy_pos".)
+
+ Returns:
+ list[float]: x, y scene position.
+ """
return [float(self.scenePos().x()), float(self.scenePos().y())]
@xy_pos.setter
def xy_pos(self, pos=None):
+ """
+ set the item scene postion.
+ ("node.pos" conflicted with "QGraphicsItem.pos()" so it was refactored to "xy_pos".)
+
+ Args:
+ pos (list[float]): x, y scene position.
+ """
pos = pos or [0.0, 0.0]
self.setPos(pos[0], pos[1])
@@ -211,6 +225,7 @@ class AbstractNodeItem(QtWidgets.QGraphicsItem):
node_attrs = list(self._properties.keys()) + ['width', 'height', 'pos']
for name, value in node_dict.items():
if name in node_attrs:
+ # "node.pos" conflicted with "QGraphicsItem.pos()" so it's refactored to "xy_pos".
if name == 'pos':
name = 'xy_pos'
setattr(self, name, value)
