Skip to content

Commit f8ee642

Browse files
committed
add commit for SubGraph class
1 parent dd9f561 commit f8ee642

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

NodeGraphQt/base/node.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,25 +1177,56 @@ def size(self):
11771177

11781178

11791179
class SubGraph(object):
1180+
"""
1181+
The ``NodeGraphQt.SubGraph`` class is the base class that all
1182+
Sub Graph Node inherit from.
1183+
"""
1184+
11801185
def __init__(self):
11811186
self._children = []
11821187

11831188
def children(self):
1189+
"""
1190+
Returns the children of the sub graph.
1191+
"""
11841192
return self._children
11851193

11861194
def create_from_nodes(self, nodes):
1195+
"""
1196+
Create sub graph from the nodes.
1197+
Args:
1198+
nodes(list): nodes to create the sub graph.
1199+
"""
1200+
if self in nodes:
1201+
nodes.remove(self)
11871202
[n.set_parent(self) for n in nodes]
11881203

11891204
def add_child(self, node):
1205+
"""
1206+
Add a node to the sub graph.
1207+
Args:
1208+
node(NodeGraphQt.BaseNode).
1209+
"""
11901210
if node not in self._children:
11911211
self._children.append(node)
11921212

11931213
def remove_child(self, node):
1214+
"""
1215+
Remove a node from the sub graph.
1216+
Args:
1217+
node(NodeGraphQt.BaseNode).
1218+
"""
11941219
if node in self._children:
11951220
self._children.remove(node)
11961221

11971222
def enter(self):
1223+
"""
1224+
Action when enter the sub graph.
1225+
"""
11981226
pass
11991227

12001228
def exit(self):
1229+
"""
1230+
Action when exit the sub graph.
1231+
"""
12011232
pass

0 commit comments

Comments
 (0)