diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 1e4ae106..d604f77b 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -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) @@ -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): """ diff --git a/NodeGraphQt/widgets/properties_bin.py b/NodeGraphQt/widgets/properties_bin.py index 974116c3..4e86f7f4 100644 --- a/NodeGraphQt/widgets/properties_bin.py +++ b/NodeGraphQt/widgets/properties_bin.py @@ -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 @@ -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. diff --git a/docs/classes.rst b/docs/classes.rst new file mode 100644 index 00000000..60c72d32 --- /dev/null +++ b/docs/classes.rst @@ -0,0 +1,13 @@ +Classes +******* + +.. image:: _images/screenshot.png + :width: 95% + + +.. toctree:: + :maxdepth: 3 + + graph + nodes + connections \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 7d0d7a4c..6bf83820 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 @@ -16,10 +14,9 @@ Contents :maxdepth: 3 overview - graph - nodes - connections - menu constants + classes + widgets + menu diff --git a/docs/menu.rst b/docs/menu.rst index b800d7e0..b19d8ff0 100644 --- a/docs/menu.rst +++ b/docs/menu.rst @@ -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 @@ -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 diff --git a/docs/nodes.rst b/docs/nodes.rst index f576f5da..f1ac82a3 100644 --- a/docs/nodes.rst +++ b/docs/nodes.rst @@ -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. ---- @@ -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 @@ -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 diff --git a/docs/overview.rst b/docs/overview.rst index 9d2dc8ad..a34683a9 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -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 ======= diff --git a/docs/widgets.rst b/docs/widgets.rst new file mode 100644 index 00000000..8e558d37 --- /dev/null +++ b/docs/widgets.rst @@ -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: \ No newline at end of file diff --git a/example.py b/example.py index 1cc48c6d..7f873a57 100644 --- a/example.py +++ b/example.py @@ -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)