Skip to content

Commit 1bd4cc7

Browse files
committed
menu doc updates.
1 parent 6dd7114 commit 1bd4cc7

File tree

4 files changed

+90
-7
lines changed

4 files changed

+90
-7
lines changed

NodeGraphQt/base/menu.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def add_command(self, name, func=None, shortcut=None):
122122
shortcut (str): shotcut key.
123123
124124
Returns:
125-
NodeGraphQt.MenuCommand: the appended command.
125+
NodeGraphQt.NodeGraphCommand: the appended command.
126126
"""
127127
action = GraphAction(name, self._graph.viewer())
128128
action.graph = self._graph
@@ -171,7 +171,7 @@ def add_command(self, name, func=None, node_type=None):
171171
node_type (str): specified node type for the command.
172172
173173
Returns:
174-
NodeGraphQt.MenuCommand: the appended command.
174+
NodeGraphQt.NodeGraphCommand: the appended command.
175175
"""
176176
if not node_type:
177177
raise NodeMenuError('Node type not specified!')
@@ -213,7 +213,7 @@ def qaction(self):
213213
The underlying qaction.
214214
215215
Returns:
216-
BaseAction: qaction object.
216+
GraphAction: qaction object.
217217
"""
218218
return self._qaction
219219

docs/examples/ex_node.rst

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,83 @@
11
Node Examples
22
#############
3+
4+
Creating Nodes
5+
**************
6+
7+
| Creating is done simply by calling the :func:`NodeGraphQt.NodeGraph.create_node` function.
8+
| (`see example below` ``line22``)
9+
10+
.. code-block:: python
11+
:linenos:
12+
13+
from NodeGraphQt import BaseNode, NodeGraph, QtWidgets
14+
15+
class MyNode(BaseNode):
16+
17+
__identifier__ = 'com.chantasticvfx'
18+
NODE_NAME = 'my node'
19+
20+
def __init__(self):
21+
super(MyNode, self).__init__()
22+
self.add_input('foo')
23+
self.add_input('hello')
24+
self.add_output('bar')
25+
self.add_output('world')
26+
27+
if __name__ == '__main__':
28+
app = QtWidgets.QApplication([])
29+
30+
node_graph = NodeGraph()
31+
node_graph.register_node(MyNode)
32+
node_graph.widget.show()
33+
34+
# here we create a couple nodes in the node graph.
35+
node_a = node_graph.create_node('com.chantasticvfx.MyNode', name='node a')
36+
node_b = node_graph.create_node('com.chantasticvfx.MyNode', name='node b', pos=[300, 100])
37+
38+
app.exec_()
39+
40+
41+
Connecting Nodes
42+
****************
43+
44+
There a multiple ways for connecting node ports here are a few examples below.
45+
46+
connecting nodes by the port index:
47+
48+
.. code-block:: python
49+
50+
node_b.set_input(0, node_a.output(0))
51+
52+
connect nodes by the port name:
53+
54+
.. code-block:: python
55+
56+
node_a.outputs()['bar'].connect_to(node_b.inputs()['foo'])
57+
58+
connecting nodes with the port objects:
59+
60+
.. code-block:: python
61+
62+
# node_a "bar" output port.
63+
port_a = node_a.output(0)
64+
# node_b "foo" input port.
65+
port_b = node_b.inputs()['foo']
66+
# make the connection.
67+
port_a.connect_to(port_b)
68+
69+
70+
See functions:
71+
- :func:`NodeGraphQt.BaseNode.input`,
72+
- :func:`NodeGraphQt.BaseNode.output`
73+
- :func:`NodeGraphQt.BaseNode.set_input`,
74+
- :func:`NodeGraphQt.BaseNode.set_output`,
75+
- :func:`NodeGraphQt.BaseNode.inputs`,
76+
- :func:`NodeGraphQt.BaseNode.outputs`
77+
- :func:`NodeGraphQt.Port.connect_to`,
78+
- :func:`NodeGraphQt.Port.disconnect_from`
79+
80+
81+
Properties Bin Setup
82+
********************
83+

docs/menu.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The context menu triggered from the node graph.
1818

1919
.. autoclass:: NodeGraphMenu
2020
:members:
21+
:exclude-members: qmenu
2122

2223

2324
Nodes Menu
@@ -34,3 +35,4 @@ Command
3435

3536
.. autoclass:: NodeGraphCommand
3637
:members:
38+
:exclude-members: qaction

docs/widgets.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Widgets
22
#######
33

44

5-
PropertiesBinWidget
6-
*******************
5+
Properties Bin
6+
**************
77

88
The ``PropertiesBinWidget`` is a list widget for displaying and editing a
99
nodes properties.
@@ -31,8 +31,8 @@ example
3131
:members:
3232
:exclude-members: property_changed
3333

34-
NodeTreeWidget
35-
**************
34+
Nodes Tree
35+
**********
3636

3737
The ``NodeTreeWidget`` is a widget for displaying all registered nodes from the
3838
node graph with this widget a user can create nodes by dragging and dropping.

0 commit comments

Comments
 (0)