Skip to content

Commit 9940627

Browse files
committed
api doc updates.
1 parent 03da4db commit 9940627

File tree

12 files changed

+119
-111
lines changed

12 files changed

+119
-111
lines changed

NodeGraphQt/base/actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def setup_context_menu(graph):
99
Sets up the node graphs context menu with some basic menus and commands.
1010
1111
Args:
12-
graph (NodeGraphQt.NodeGraph): node graph controller class.
12+
graph (NodeGraphQt.NodeGraph): node graph.
1313
"""
1414
root_menu = graph.context_menu()
1515

NodeGraphQt/base/menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def get_menu(self, name):
4040
name (str): name of the menu.
4141
4242
Returns:
43-
NodeGraphQt.base.menu.ContextMenu: menu item.
43+
NodeGraphQt.ContextMenu: menu item.
4444
"""
4545
for action in self.qmenu.actions():
4646
if action.menu() and action.menu().title() == name:
@@ -100,7 +100,7 @@ def add_command(self, name, func=None, shortcut=None):
100100
101101
Args:
102102
name (str): command name.
103-
func (): command function.
103+
func (function): command function.
104104
shortcut (str): shotcut key.
105105
106106
Returns:

NodeGraphQt/base/node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __ne__(self, other):
6060
def type(cls):
6161
"""
6262
Node type identifier followed by the class name.
63-
eg. com.chantasticvfx.FooNode
63+
eg. com.chantasticvfx.MyNode
6464
6565
Returns:
6666
str: node type.
@@ -229,7 +229,7 @@ def create_property(self, name, value, items=None, range=None, widget_type=NODE_
229229
value (object): data.
230230
items (list[str]): items used by widget type NODE_PROP_QCOMBO
231231
range (tuple)): min, max values used by NODE_PROP_SLIDER
232-
widget_type (int): widget type flag.
232+
widget_type (int): widget type flag (not implemented yet).
233233
"""
234234
self.model.add_property(name, value, items, range, widget_type)
235235

NodeGraphQt/base/port.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class Port(object):
99
"""
10-
base class for a :ref:`NodeGraphQt.Node` port.
10+
base class for a :class:`NodeGraphQt.Node` port.
1111
1212
Args:
1313
node (NodeGraphQt.NodeObject): parent node.

NodeGraphQt/base/vendor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class NodeVendor(object):
55
"""
6-
Node manager that stores all the node types.
6+
Node factory that stores all the node types.
77
"""
88

99
def __init__(self):

docs/port.rst renamed to docs/connections.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
Port
22
****
33

4-
The ``NodeGraphQt.Port`` class is used for connecting one node to another.
4+
The ``Port`` class is used for connecting one node to another.
55

66
.. image:: _images/port.png
77
:width: 50%
88

9-
NodeGraphQt.Port
10-
================
9+
----
1110

1211
.. autoclass:: NodeGraphQt.Port
1312
:members:

docs/graph.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
Graph
2-
*****
1+
Node Graph
2+
**********
3+
4+
**Inherited from:** :class:`PySide2.QtCore.QObject`
35

46
The NodeGraph class is the main controller for managing all nodes.
57

68
.. image:: _images/graph.png
79
:width: 60%
810

9-
10-
NodeGraphQt.NodeGraph
11-
=====================
12-
13-
14-
**Inherited from:** `QtCore.QObject <https://doc.qt.io/qtforpython/PySide2/QtCore/QObject.html?highlight=qobject>`_
15-
16-
1711
----
1812

1913
.. autoclass:: NodeGraphQt.NodeGraph

docs/index.rst

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
NodeGraphQt API
22
***************
33

4+
Welcome to the ``NodeGraphQt`` api documentation and just like the project on GitHub this is also a work in progress.
5+
46
.. image:: _images/screenshot.png
57
:width: 95%
68

@@ -14,68 +16,10 @@ Contents
1416
:maxdepth: 3
1517

1618
overview
17-
constants
1819
graph
1920
nodes
20-
port
21+
connections
2122
menu
22-
23-
24-
Example
25-
=======
26-
27-
A basic example snippet.
28-
29-
.. code-block:: python
30-
:linenos:
31-
32-
import sys
33-
from PySide2 import QtWidgets
34-
35-
from NodeGraphQt import NodeGraph, Node, setup_context_menu
36-
37-
38-
class FooNode(Node):
39-
40-
# unique node identifier domain.
41-
__identifier__ = 'com.chantasticvfx'
42-
43-
# initial default node name.
44-
NODE_NAME = 'Foo Node'
45-
46-
def __init__(self):
47-
super(FooNode, self).__init__()
48-
49-
# create an input port.
50-
self.add_input('in')
51-
52-
# create an output port.
53-
self.add_output('out')
54-
55-
56-
if __name__ == '__main__':
57-
app = QtWidgets.QApplication(sys.argv)
58-
59-
# create node graph controller.
60-
graph = NodeGraph()
61-
62-
# set up default menu and commands.
63-
setup_context_menu(graph)
64-
65-
# register the FooNode node class.
66-
graph.register_node(FooNode)
67-
68-
# show the node graph widget.
69-
viewer = graph.viewer()
70-
viewer.show()
71-
72-
# create two nodes.
73-
node_a = graph.create_node('com.chantasticvfx.FooNode', name='node A')
74-
node_b = graph.create_node('com.chantasticvfx.FooNode', name='node B')
75-
76-
# connect node_a to node_b
77-
node_a.set_output(0, node_b.input(2))
78-
79-
app.exec_()
23+
constants
8024

8125

docs/menu.rst

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
Menu & Commands
22
***************
33

4-
example to adding a menu and command.
4+
Default Setup
5+
=============
6+
7+
The ``NodeGraphQt`` module has a built in ``setup_context_menu`` function that'll populate the node graphs
8+
context menu some default menus and commands.
9+
10+
.. image:: _images/menu_hotkeys.png
11+
:width: 50%
12+
13+
----
14+
15+
.. autofunction:: NodeGraphQt.setup_context_menu
16+
:noindex:
17+
18+
Example
19+
=======
20+
21+
Here's a example to adding a menu and command.
522

623
.. code-block:: python
724
:linenos:
@@ -25,19 +42,8 @@ example to adding a menu and command.
2542
foo_menu.add_command('Bar', my_test_func, 'Shift+t')
2643
2744
28-
Default Setup
29-
=============
30-
31-
The ``NodeGraphQt`` module has a built in ``setup_context_menu`` function that'll populate the node graphs
32-
context menu some default menus and commands.
33-
34-
----
35-
36-
.. autofunction:: NodeGraphQt.setup_context_menu
37-
38-
39-
ContextMenu
40-
===========
45+
Menu
46+
====
4147

4248
Node graph context menu.
4349

@@ -48,8 +54,8 @@ Node graph context menu.
4854
:members:
4955

5056

51-
ContextMenuCommand
52-
==================
57+
Command
58+
=======
5359

5460
Node graph context menu command.
5561

docs/nodes.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ Nodes
22
*****
33

44

5-
NodeGraphQt.NodeObject
6-
======================
5+
Node Object
6+
===========
77

8-
**Inherited by:** :ref:`NodeGraphQt.Node`, :ref:`NodeGraphQt.Backdrop`
8+
**Inherited by:** :class:`NodeGraphQt.Node`, :class:`NodeGraphQt.Backdrop`
9+
10+
The ``NodeObject`` class is the main base class that all nodes inherit from.
911

1012
----
1113

14+
.. note::
15+
These two attributes require reimplementing when subclassing any node object.
1216

1317
.. autoattribute:: NodeGraphQt.NodeObject.__identifier__
1418
.. autoattribute:: NodeGraphQt.NodeObject.NODE_NAME
@@ -21,11 +25,12 @@ NodeGraphQt.NodeObject
2125
:exclude-members: model, NODE_NAME
2226

2327

28+
Node
29+
====
2430

25-
NodeGraphQt.Node
26-
================
31+
**Inherited from:** :class:`NodeGraphQt.NodeObject`
2732

28-
**Inherited from:** :ref:`NodeGraphQt.NodeObject`
33+
The ``Node`` class is the base class for nodes that allows port connections from one node to another.
2934

3035

3136
.. image:: _images/node.png
@@ -38,10 +43,12 @@ NodeGraphQt.Node
3843
:exclude-members: update_model
3944

4045

41-
NodeGraphQt.Backdrop
42-
====================
46+
Backdrop
47+
========
48+
49+
**Inherited from:** :class:`NodeGraphQt.NodeObject`
4350

44-
**Inherited from:** :ref:`NodeGraphQt.NodeObject`
51+
The ``Backdrop`` class allows other node object to be nested inside, it's mainly good for grouping nodes together.
4552

4653
.. image:: _images/backdrop.png
4754
:width: 250px

0 commit comments

Comments
 (0)