Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions NodeGraphQt/base/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, parent=None, tab_search_key='tab'):
self._undo_stack = QtWidgets.QUndoStack(self)

self._properties_bin = None
self._nodes_list = None
self._nodes_tree = None

tab = QtWidgets.QAction('Search Nodes', self)
tab.setShortcut(tab_search_key)
Expand Down Expand Up @@ -252,17 +252,17 @@ def properties_bin(self):
)
return self._properties_bin

def nodes_list(self):
def nodes_tree(self):
"""
Initializes the nodes list widget when first called.

Returns:
NodeTreeWidget: the initialized widget.
"""
if self._nodes_list is None:
self._nodes_list = NodeTreeWidget()
self._nodes_list.set_node_factory(self._node_factory)
return self._nodes_list
if self._nodes_tree is None:
self._nodes_tree = NodeTreeWidget()
self._nodes_tree.set_node_factory(self._node_factory)
return self._nodes_tree

def undo_stack(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions NodeGraphQt/widgets/properties_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def add_node(self, node):
Add node to the properties bin.

Args:
node (NodeGraphQt.BaseNode): node object.
node (NodeGraphQt.NodeObject): node object.
"""
if self.limit() == 0:
return
Expand Down Expand Up @@ -157,7 +157,7 @@ def prop_widget(self, node):
Returns the node property widget.

Args:
node (NodeGraphQt.BaseNode): node object.
node (NodeGraphQt.NodeObject): node object.

Returns:
NodePropWidget: node property widget.
Expand Down
13 changes: 13 additions & 0 deletions docs/classes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Classes
*******

.. image:: _images/screenshot.png
:width: 95%


.. toctree::
:maxdepth: 3

graph
nodes
connections
15 changes: 6 additions & 9 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
NodeGraphQt API
***************
NodeGraphQt
***********

Welcome to the ``NodeGraphQt`` api documentation and just like the project on GitHub this is also a work in progress.
Welcome to the ``NodeGraphQt`` documentation.

.. image:: _images/screenshot.png
:width: 95%

Project: https://github.com/jchanvfx/NodeGraphQt

Expand All @@ -16,10 +14,9 @@ Contents
:maxdepth: 3

overview
graph
nodes
connections
menu
constants
classes
widgets
menu


31 changes: 14 additions & 17 deletions docs/menu.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Menus
*****

.. image:: _images/menu_hotkeys.png
:width: 50%

The ``NodeGraphQt.setup_context_menu`` has a built in function that'll populate the node graphs context menu a few
default menus and commands.

.. code-block:: python
:linenos:

from NodeGraphQt import NodeGraph, setup_context_menu

graph = NodeGraph()
setup_context_menu(graph)

example adding "Foo" menu to the node graphs context menu.

.. code-block:: python
Expand Down Expand Up @@ -30,23 +44,6 @@ add "Bar" command to the "Foo" menu.
# add "Bar" command to the "Foo" menu.
foo_menu.add_command('Bar', my_test, 'Shift+t')

Default Setup
=============

.. image:: _images/menu_hotkeys.png
:width: 50%

The ``NodeGraphQt.setup_context_menu`` has a built in function that'll populate the node graphs context menu a few
default menus and commands.

.. code-block:: python
:linenos:

from NodeGraphQt import NodeGraph, setup_context_menu

graph = NodeGraph()
setup_context_menu(graph)

----

.. autofunction:: NodeGraphQt.setup_context_menu
Expand Down
19 changes: 10 additions & 9 deletions docs/nodes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Nodes
*****


Object
======
NodeObject
==========

**Inherited by:** :class:`NodeGraphQt.BaseNode`, :class:`NodeGraphQt.BackdropNode`

The ``NodeObject`` class is the main base class that all nodes inherit from.
The ``NodeGraphQt.NodeObject`` class is the main base class that all nodes inherit from.

----

Expand All @@ -20,12 +20,13 @@ Attributes
.. autoattribute:: NodeGraphQt.NodeObject.__identifier__
.. autoattribute:: NodeGraphQt.NodeObject.NODE_NAME

Node
====

BaseNode
========

**Inherited from:** :class:`NodeGraphQt.NodeObject`

The ``BaseNode`` class is the base class for nodes that allows port connections from one node to another.
The ``NodeGraphQt.BaseNode`` class is the base class for nodes that allows port connections from one node to another.


.. image:: _images/node.png
Expand All @@ -38,12 +39,12 @@ The ``BaseNode`` class is the base class for nodes that allows port connections
:exclude-members: update_model


Backdrop
========
BackdropNode
============

**Inherited from:** :class:`NodeGraphQt.NodeObject`

The ``BackdropNode`` class allows other node object to be nested inside, it's mainly good for grouping nodes together.
The ``NodeGraphQt.BackdropNode`` class allows other node object to be nested inside, it's mainly good for grouping nodes together.

.. image:: _images/backdrop.png
:width: 250px
Expand Down
27 changes: 0 additions & 27 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,6 @@ Node can be created with the tab node search widget.
+-------------------+--------+


Properties Bin
==============

.. image:: _images/prop_bin.png
:width: 950px

.. code-block:: python
:linenos:

from NodeGraphQt import NodeGraph

graph = NodeGraph()

properties_bin = graph.properties_bin()
properties_bin.show()


Menu Setup
==========

The NodeGraphQt has a ``setup_context_menu`` method that'll setup the node graphs with basic menus and commands.

`(see line:32 in the example code below)`

see also: :ref:`Menus`


Example
=======

Expand Down
47 changes: 47 additions & 0 deletions docs/widgets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Widgets
*******


PropertiesBinWidget
===================

.. image:: _images/prop_bin.png
:width: 950px

.. code-block:: python
:linenos:

from NodeGraphQt import NodeGraph

graph = NodeGraph()

# create properties bin widget.
properties_bin = graph.properties_bin()
properties_bin.show()

----

.. autoclass:: NodeGraphQt.widgets.properties_bin.PropertiesBinWidget
:members:

NodeTreeWidget
==============

.. image:: _images/nodes_tree.png
:width: 300px

.. code-block:: python
:linenos:

from NodeGraphQt import NodeGraph

graph = NodeGraph()

# create node tree widget.
nodes_tree = graph.nodes_tree()
nodes_tree.show()

----

.. autoclass:: NodeGraphQt.widgets.node_tree.NodeTreeWidget
:members:
8 changes: 4 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def show_prop_bin(node):


# show the nodes list when a node is "double clicked" in the graph.
node_list = graph.nodes_list()
node_tree = graph.nodes_tree()
def show_nodes_list(node):
if not node_list.isVisible():
node_list.update()
node_list.show()
if not node_tree.isVisible():
node_tree.update()
node_tree.show()
graph.node_double_clicked.connect(show_nodes_list)


Expand Down