Skip to content

Commit cef4c6f

Browse files
authored
doc strings to for node item position.
1 parent 34d2b8e commit cef4c6f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

NodeGraphQt/qgraphics/node_abstract.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,24 @@ def visible(self, visible=False):
154154

155155
@property
156156
def xy_pos(self):
157+
"""
158+
return the item scene postion.
159+
("node.pos" conflicted with "QGraphicsItem.pos()" so it was refactored to "xy_pos".)
160+
161+
Returns:
162+
list[float]: x, y scene position.
163+
"""
157164
return [float(self.scenePos().x()), float(self.scenePos().y())]
158165

159166
@xy_pos.setter
160167
def xy_pos(self, pos=None):
168+
"""
169+
set the item scene postion.
170+
("node.pos" conflicted with "QGraphicsItem.pos()" so it was refactored to "xy_pos".)
171+
172+
Args:
173+
pos (list[float]): x, y scene position.
174+
"""
161175
pos = pos or [0.0, 0.0]
162176
self.setPos(pos[0], pos[1])
163177

@@ -211,6 +225,7 @@ def from_dict(self, node_dict):
211225
node_attrs = list(self._properties.keys()) + ['width', 'height', 'pos']
212226
for name, value in node_dict.items():
213227
if name in node_attrs:
228+
# "node.pos" conflicted with "QGraphicsItem.pos()" so it's refactored to "xy_pos".
214229
if name == 'pos':
215230
name = 'xy_pos'
216231
setattr(self, name, value)

0 commit comments

Comments
 (0)