From 7e5c7214832ee7b210cd28ebe5b8d7d1da416e07 Mon Sep 17 00:00:00 2001 From: jchan Date: Tue, 4 Apr 2023 21:25:41 +1200 Subject: [PATCH] updated docs with inheritance diagram. --- NodeGraphQt/base/graph.py | 6 ++++-- NodeGraphQt/base/node.py | 4 +--- NodeGraphQt/base/port.py | 2 ++ NodeGraphQt/custom_widgets/nodes_palette.py | 3 +++ NodeGraphQt/custom_widgets/nodes_tree.py | 4 ++++ .../properties_bin/node_property_widgets.py | 3 +++ NodeGraphQt/nodes/backdrop_node.py | 2 +- NodeGraphQt/nodes/base_node.py | 2 +- NodeGraphQt/nodes/base_node_circle.py | 2 +- NodeGraphQt/nodes/group_node.py | 2 +- NodeGraphQt/nodes/port_node.py | 6 ++++-- NodeGraphQt/widgets/node_widgets.py | 12 +++++++++--- docs/conf.py | 13 +++++++++++++ docs/examples/ex_overview.rst | 4 ++++ docs/examples/ex_port.rst | 4 ++-- docs/host_apps/ex_app_nuke.rst | 4 ++-- docs/host_apps/ex_app_silhouette.rst | 4 ++-- docs/nodes/PortNode.rst | 1 + 18 files changed, 58 insertions(+), 20 deletions(-) diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 21015e2b..39fee2f4 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -39,7 +39,8 @@ class NodeGraph(QtCore.QObject): The ``NodeGraph`` class is the main controller for managing all nodes and the node graph. - Inherited from: :class:`PySide2.QtCore.QObject` + .. inheritance-diagram:: NodeGraphQt.NodeGraph + :top-classes: PySide2.QtCore.QObject .. image:: _images/graph.png :width: 60% @@ -2226,7 +2227,8 @@ class SubGraph(NodeGraph): The ``SubGraph`` class is just like the ``NodeGraph`` but is the main controller for managing the expanded node graph for a group node. - Inherited from: :class:`NodeGraphQt.NodeGraph` + .. inheritance-diagram:: NodeGraphQt.SubGraph + :top-classes: PySide2.QtCore.QObject .. image:: _images/sub_graph.png :width: 70% diff --git a/NodeGraphQt/base/node.py b/NodeGraphQt/base/node.py index 452595bc..10faa97f 100644 --- a/NodeGraphQt/base/node.py +++ b/NodeGraphQt/base/node.py @@ -18,9 +18,7 @@ class NodeObject(object): The ``NodeGraphQt.NodeObject`` class is the main base class that all nodes inherit from. - **Inherited by:** - :class:`NodeGraphQt.BaseNode`, - :class:`NodeGraphQt.BackdropNode` + .. inheritance-diagram:: NodeGraphQt.NodeObject Args: qgraphics_item (AbstractNodeItem): QGraphicsItem item used for drawing. diff --git a/NodeGraphQt/base/port.py b/NodeGraphQt/base/port.py index 1623ab8e..70a6d978 100644 --- a/NodeGraphQt/base/port.py +++ b/NodeGraphQt/base/port.py @@ -17,6 +17,8 @@ class Port(object): """ The ``Port`` class is used for connecting one node to another. + .. inheritance-diagram:: NodeGraphQt.Port + .. image:: ../_images/port.png :width: 50% diff --git a/NodeGraphQt/custom_widgets/nodes_palette.py b/NodeGraphQt/custom_widgets/nodes_palette.py index 141ba692..91a94f28 100644 --- a/NodeGraphQt/custom_widgets/nodes_palette.py +++ b/NodeGraphQt/custom_widgets/nodes_palette.py @@ -168,6 +168,9 @@ class NodesPaletteWidget(QtWidgets.QWidget): | *Implemented on NodeGraphQt:* ``v0.1.7`` + .. inheritance-diagram:: NodeGraphQt.NodesPaletteWidget + :parts: 1 + .. image:: _images/nodes_palette.png :width: 400px diff --git a/NodeGraphQt/custom_widgets/nodes_tree.py b/NodeGraphQt/custom_widgets/nodes_tree.py index 742daded..709e90a7 100644 --- a/NodeGraphQt/custom_widgets/nodes_tree.py +++ b/NodeGraphQt/custom_widgets/nodes_tree.py @@ -24,6 +24,10 @@ class NodesTreeWidget(QtWidgets.QTreeWidget): registered nodes from the node graph with this widget a user can create nodes by dragging and dropping. + .. inheritance-diagram:: NodeGraphQt.NodesTreeWidget + :parts: 1 + :top-classes: PySide2.QtWidgets.QWidget + .. image:: _images/nodes_tree.png :width: 300px diff --git a/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py b/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py index a8d5036f..2923e26b 100644 --- a/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py +++ b/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py @@ -331,6 +331,9 @@ class PropertiesBinWidget(QtWidgets.QWidget): The :class:`NodeGraphQt.PropertiesBinWidget` is a list widget for displaying and editing a nodes properties. + .. inheritance-diagram:: NodeGraphQt.PropertiesBinWidget + :parts: 1 + .. image:: _images/prop_bin.png :width: 950px diff --git a/NodeGraphQt/nodes/backdrop_node.py b/NodeGraphQt/nodes/backdrop_node.py index 2ccd23c5..47e8c914 100644 --- a/NodeGraphQt/nodes/backdrop_node.py +++ b/NodeGraphQt/nodes/backdrop_node.py @@ -9,7 +9,7 @@ class BackdropNode(NodeObject): The ``NodeGraphQt.BackdropNode`` class allows other node object to be nested inside, it's mainly good for grouping nodes together. - **Inherited from:** :class:`NodeGraphQt.NodeObject` + .. inheritance-diagram:: NodeGraphQt.BackdropNode .. image:: ../_images/backdrop.png :width: 250px diff --git a/NodeGraphQt/nodes/base_node.py b/NodeGraphQt/nodes/base_node.py index 06d43822..6031d590 100644 --- a/NodeGraphQt/nodes/base_node.py +++ b/NodeGraphQt/nodes/base_node.py @@ -20,7 +20,7 @@ class BaseNode(NodeObject): The ``NodeGraphQt.BaseNode`` class is the base class for nodes that allows port connections from one node to another. - **Inherited from:** :class:`NodeGraphQt.NodeObject` + .. inheritance-diagram:: NodeGraphQt.BaseNode .. image:: ../_images/node.png :width: 250px diff --git a/NodeGraphQt/nodes/base_node_circle.py b/NodeGraphQt/nodes/base_node_circle.py index 1e6a9d8f..6aeb6e0d 100644 --- a/NodeGraphQt/nodes/base_node_circle.py +++ b/NodeGraphQt/nodes/base_node_circle.py @@ -10,7 +10,7 @@ class BaseNodeCircle(BaseNode): The ``NodeGraphQt.BaseNodeCircle`` is pretty much the same class as the :class:`NodeGraphQt.BaseNode` except with a different design. - **Inherited from:** :class:`NodeGraphQt.BaseNode` + .. inheritance-diagram:: NodeGraphQt.BaseNodeCircle .. image:: ../_images/node_circle.png :width: 250px diff --git a/NodeGraphQt/nodes/group_node.py b/NodeGraphQt/nodes/group_node.py index 3086f96c..4f808cbb 100644 --- a/NodeGraphQt/nodes/group_node.py +++ b/NodeGraphQt/nodes/group_node.py @@ -11,7 +11,7 @@ class GroupNode(BaseNode): The ``NodeGraphQt.GroupNode`` class extends from the :class:``NodeGraphQt.BaseNode`` class with the ability to nest other nodes inside of it. - **Inherited from:** :class:`NodeGraphQt.BaseNode` + .. inheritance-diagram:: NodeGraphQt.GroupNode .. image:: ../_images/group_node.png :width: 250px diff --git a/NodeGraphQt/nodes/port_node.py b/NodeGraphQt/nodes/port_node.py index fed4d3bc..00ae2f1d 100644 --- a/NodeGraphQt/nodes/port_node.py +++ b/NodeGraphQt/nodes/port_node.py @@ -11,7 +11,8 @@ class PortInputNode(BaseNode): :class:`NodeGraphQt.GroupNode` when expanded in a :class:`NodeGraphQt.SubGraph`. - **Inherited from:** :class:`NodeGraphQt.BaseNode` + .. inheritance-diagram:: NodeGraphQt.nodes.port_node.PortInputNode + :parts: 1 .. image:: ../_images/port_in_node.png :width: 150px @@ -68,7 +69,8 @@ class PortOutputNode(BaseNode): from a :class:`NodeGraphQt.GroupNode` when expanded in a :class:`NodeGraphQt.SubGraph`. - **Inherited from:** :class:`NodeGraphQt.BaseNode` + .. inheritance-diagram:: NodeGraphQt.nodes.port_node.PortOutputNode + :parts: 1 .. image:: ../_images/port_out_node.png :width: 150px diff --git a/NodeGraphQt/widgets/node_widgets.py b/NodeGraphQt/widgets/node_widgets.py index e9c4d34a..a494bfaa 100644 --- a/NodeGraphQt/widgets/node_widgets.py +++ b/NodeGraphQt/widgets/node_widgets.py @@ -72,6 +72,9 @@ class NodeBaseWidget(QtWidgets.QGraphicsProxyWidget): This is the main wrapper class that allows a ``QtWidgets.QWidget`` to be added in a :class:`NodeGraphQt.BaseNode` object. + .. inheritance-diagram:: NodeGraphQt.NodeBaseWidget + :parts: 1 + Args: parent (NodeGraphQt.BaseNode.view): parent node view. name (str): property name for the parent node. @@ -245,7 +248,8 @@ class NodeComboBox(NodeBaseWidget): """ Displays as a ``QComboBox`` in a node. - **Inherited from:** :class:`NodeBaseWidget` + .. inheritance-diagram:: NodeGraphQt.widgets.node_widgets.NodeComboBox + :parts: 1 .. note:: `To embed a` ``QComboBox`` `in a node see func:` @@ -314,7 +318,8 @@ class NodeLineEdit(NodeBaseWidget): """ Displays as a ``QLineEdit`` in a node. - **Inherited from:** :class:`NodeBaseWidget` + .. inheritance-diagram:: NodeGraphQt.widgets.node_widgets.NodeLineEdit + :parts: 1 .. note:: `To embed a` ``QLineEdit`` `in a node see func:` @@ -383,7 +388,8 @@ class NodeCheckBox(NodeBaseWidget): """ Displays as a ``QCheckBox`` in a node. - **Inherited from:** :class:`NodeBaseWidget` + .. inheritance-diagram:: NodeGraphQt.widgets.node_widgets.NodeCheckBox + :parts: 1 .. note:: `To embed a` ``QCheckBox`` `in a node see func:` diff --git a/docs/conf.py b/docs/conf.py index 2888160a..a40e37c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,6 +47,7 @@ 'sphinx.ext.autosectionlabel', 'sphinx.ext.autosummary', 'sphinx.ext.coverage', + 'sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx', 'sphinx.ext.napoleon', ] @@ -56,6 +57,18 @@ 'PySide2': ('https://doc.qt.io/qtforpython/', None), } +# inheritance diagram remapping. +inheritance_alias = { + 'NodeGraphQt.base.graph.NodeGraph': 'NodeGraphQt.NodeGraph', + 'NodeGraphQt.base.graph.SubGraph': 'NodeGraphQt.SubGraph', + 'NodeGraphQt.base.node.NodeObject': 'NodeGraphQt.NodeObject', + 'NodeGraphQt.base.port.Port': 'NodeGraphQt.Port', + 'NodeGraphQt.nodes.backdrop_node.BackdropNode': 'NodeGraphQt.BackdropNode', + 'NodeGraphQt.nodes.base_node.BaseNode': 'NodeGraphQt.BaseNode', + 'NodeGraphQt.nodes.base_node_circle.BaseNodeCircle': 'NodeGraphQt.BaseNodeCircle', + 'NodeGraphQt.nodes.group_node.GroupNode': 'NodeGraphQt.GroupNode', +} + # order of members. autodoc_member_order = 'groupwise' diff --git a/docs/examples/ex_overview.rst b/docs/examples/ex_overview.rst index 14bc269c..7724634d 100644 --- a/docs/examples/ex_overview.rst +++ b/docs/examples/ex_overview.rst @@ -53,6 +53,10 @@ Connection pipes can be disconnected easily with the built in slice tool. | Slice connections | *Alt + Shift + LMB + Drag* | +---------------------+----------------------------+ +Additional Info: + To disable or enable the pipe slicer see + :meth:`NodeGraphQt.NodeGraph.set_pipe_slicing` + Getting Started *************** diff --git a/docs/examples/ex_port.rst b/docs/examples/ex_port.rst index 16f6bbab..36560bb2 100644 --- a/docs/examples/ex_port.rst +++ b/docs/examples/ex_port.rst @@ -6,8 +6,8 @@ Creating Custom Shapes (*Implemented on* ``v0.1.1``) -To have custom port shapes the :meth:`BaseNode.add_input` and -:meth:`BaseNode.add_output` functions now have a ``painter_func`` +To have custom port shapes the :meth:`NodeGraphQt.BaseNode.add_input` and +:meth:`NodeGraphQt.BaseNode.add_output` functions now have a ``painter_func`` argument where you specify you custom port painter function. .. image:: ../_images/custom_ports.png diff --git a/docs/host_apps/ex_app_nuke.rst b/docs/host_apps/ex_app_nuke.rst index 3f1d550c..15dcd7ae 100644 --- a/docs/host_apps/ex_app_nuke.rst +++ b/docs/host_apps/ex_app_nuke.rst @@ -6,8 +6,8 @@ Creating a node graph widget in Nuke. .. image:: ../_images/app_nuke_example.png :width: 800px -| Here is an example where the :attr:`NodeGraph.widget` can be registered as a - panel in the compositing application NUKE. +| Here is an example where the :attr:`NodeGraphQt.NodeGraph.widget` can be +registered as a panel in the compositing application NUKE. .. code-block:: python :linenos: diff --git a/docs/host_apps/ex_app_silhouette.rst b/docs/host_apps/ex_app_silhouette.rst index 7ff25a14..e650bb1f 100644 --- a/docs/host_apps/ex_app_silhouette.rst +++ b/docs/host_apps/ex_app_silhouette.rst @@ -11,8 +11,8 @@ Creating a node graph widget in Silhouette FX. .. image:: ../_images/app_silhouette_example.png :width: 800px -| Here is an example where the :attr:`NodeGraph.widget` can be registered as a - dockable panel in the application . +| Here is an example where the :attr:`NodeGraphQt.NodeGraph.widget` can be +registered as a dockable panel in the application . .. code-block:: python :linenos: diff --git a/docs/nodes/PortNode.rst b/docs/nodes/PortNode.rst index 25f8e3c6..d9ec45ba 100644 --- a/docs/nodes/PortNode.rst +++ b/docs/nodes/PortNode.rst @@ -4,6 +4,7 @@ PortNode Port node are the nodes in a expanded :class:`NodeGraphQt.SubGraph` that represent the ports from the parent :class:`NodeGraphQt.GroupNode` object. + PortInputNode =============