Skip to content

Commit 6a0c10c

Browse files
committed
updated docs and renamed class Node to BaseNode
1 parent f1ae002 commit 6a0c10c

File tree

14 files changed

+66
-50
lines changed

14 files changed

+66
-50
lines changed

NodeGraphQt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@
5151

5252
from .base.actions import setup_context_menu
5353
from .base.graph import NodeGraph
54-
from .base.node import NodeObject, Node, Backdrop
54+
from .base.node import NodeObject, BaseNode, Backdrop
5555
from .base.port import Port
5656
from .base.menu import Menu, MenuCommand

NodeGraphQt/base/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def create_node_instance(self, node_type=None, alias=None):
3333
alias (str): alias name (optional).
3434
3535
Returns:
36-
NodeGraphQt.Node: new node class object.
36+
NodeGraphQt.BaseNode: new node class object.
3737
"""
3838
if alias and self.aliases.get(alias):
3939
node_type = self.aliases[alias]

NodeGraphQt/base/graph.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def center_on(self, nodes=None):
371371
Center the node graph on the given nodes or all nodes by default.
372372
373373
Args:
374-
nodes (list[NodeGraphQt.Node]): a list of nodes.
374+
nodes (list[NodeGraphQt.BaseNode]): a list of nodes.
375375
"""
376376
self._viewer.center_selection(nodes)
377377

@@ -419,7 +419,7 @@ def create_node(self, node_type, name=None, selected=True, color=None,
419419
pos (list[int, int]): initial x, y position for the node (default: (0, 0)).
420420
421421
Returns:
422-
NodeGraphQt.Node: the created instance of the node.
422+
NodeGraphQt.BaseNode: the created instance of the node.
423423
"""
424424
NodeCls = self._node_factory.create_node_instance(node_type)
425425
if NodeCls:
@@ -470,7 +470,7 @@ def add_node(self, node, pos=None):
470470
Add a node into the node graph.
471471
472472
Args:
473-
node (NodeGraphQt.Node): node object.
473+
node (NodeGraphQt.BaseNode): node object.
474474
pos (list[float]): node x,y position. (optional)
475475
"""
476476
assert isinstance(node, NodeObject), 'node must be a Node instance.'
@@ -498,7 +498,7 @@ def delete_node(self, node):
498498
Remove the node from the node graph.
499499
500500
Args:
501-
node (NodeGraphQt.Node): node object.
501+
node (NodeGraphQt.BaseNode): node object.
502502
"""
503503
assert isinstance(node, NodeObject), \
504504
'node must be a instance of a NodeObject.'
@@ -509,7 +509,7 @@ def delete_nodes(self, nodes):
509509
Remove a list of specified nodes from the node graph.
510510
511511
Args:
512-
nodes (list[NodeGraphQt.Node]): list of node instances.
512+
nodes (list[NodeGraphQt.BaseNode]): list of node instances.
513513
"""
514514
self._undo_stack.beginMacro('delete nodes')
515515
[self.delete_node(n) for n in nodes]
@@ -520,7 +520,7 @@ def all_nodes(self):
520520
Return all nodes in the node graph.
521521
522522
Returns:
523-
list[NodeGraphQt.Node]: list of nodes.
523+
list[NodeGraphQt.BaseNode]: list of nodes.
524524
"""
525525
return list(self._model.nodes.values())
526526

@@ -529,7 +529,7 @@ def selected_nodes(self):
529529
Return all selected nodes that are in the node graph.
530530
531531
Returns:
532-
list[NodeGraphQt.Node]: list of nodes.
532+
list[NodeGraphQt.BaseNode]: list of nodes.
533533
"""
534534
nodes = []
535535
for item in self._viewer.selected_nodes():
@@ -785,7 +785,7 @@ def copy_nodes(self, nodes=None):
785785
Copy nodes to the clipboard.
786786
787787
Args:
788-
nodes (list[NodeGraphQt.Node]): list of nodes (default: selected nodes).
788+
nodes (list[NodeGraphQt.BaseNode]): list of nodes (default: selected nodes).
789789
"""
790790
nodes = nodes or self.selected_nodes()
791791
if not nodes:
@@ -819,9 +819,9 @@ def duplicate_nodes(self, nodes):
819819
Create duplicate copy from the list of nodes.
820820
821821
Args:
822-
nodes (list[NodeGraphQt.Node]): list of nodes.
822+
nodes (list[NodeGraphQt.BaseNode]): list of nodes.
823823
Returns:
824-
list[NodeGraphQt.Node]: list of duplicated node instances.
824+
list[NodeGraphQt.BaseNode]: list of duplicated node instances.
825825
"""
826826
if not nodes:
827827
return
@@ -847,7 +847,7 @@ def disable_nodes(self, nodes, mode=None):
847847
see: :meth:`NodeObject.set_disabled`
848848
849849
Args:
850-
nodes (list[NodeGraphQt.Node]): list of node instances.
850+
nodes (list[NodeGraphQt.BaseNode]): list of node instances.
851851
mode (bool): (optional) disable state of the nodes.
852852
"""
853853
if not nodes:

NodeGraphQt/base/node.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class NodeObject(object):
3232
node (AbstractNodeItem): graphic item used for drawing.
3333
"""
3434

35-
#: unique node identifier domain.
35+
#: (str) unique node identifier domain.
3636
__identifier__ = 'nodeGraphQt.nodes'
3737

38-
#: initial default node name.
38+
#: (str) base node name.
3939
NODE_NAME = None
4040

4141
def __init__(self, node=None):
@@ -351,15 +351,15 @@ def pos(self):
351351
return self.model.pos
352352

353353

354-
class Node(NodeObject):
354+
class BaseNode(NodeObject):
355355
"""
356356
base class of a typical Node with input and output ports.
357357
"""
358358

359359
NODE_NAME = 'Base Node'
360360

361361
def __init__(self):
362-
super(Node, self).__init__(NodeItem())
362+
super(BaseNode, self).__init__(NodeItem())
363363
self._inputs = []
364364
self._outputs = []
365365

@@ -586,7 +586,7 @@ def nodes(self):
586586
Returns nodes wrapped within the backdrop node.
587587
588588
Returns:
589-
list[NodeGraphQt.Node]: list of node under the backdrop.
589+
list[NodeGraphQt.BaseNode]: list of node under the backdrop.
590590
"""
591591
node_ids = [n.id for n in self.view.get_nodes()]
592592
return [self.graph.get_node_by_id(nid) for nid in node_ids]

NodeGraphQt/widgets/properties.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class NodePropWidget(QtWidgets.QWidget):
329329
330330
Args:
331331
parent:
332-
node (NodeGraphQt.Node): node.
332+
node (NodeGraphQt.BaseNode): node.
333333
"""
334334

335335
#: signal (node_id, prop_name, prop_value)
@@ -394,7 +394,7 @@ def _read_node(self, node):
394394
Populate widget from a node.
395395
396396
Args:
397-
node (NodeGraphQt.Node): node class.
397+
node (NodeGraphQt.BaseNode): node class.
398398
"""
399399
model = node.model
400400
graph_model = node.graph.model
@@ -508,10 +508,10 @@ def get_widget(self, name):
508508

509509
if __name__ == '__main__':
510510
import sys
511-
from NodeGraphQt import Node, NodeGraph
511+
from NodeGraphQt import BaseNode, NodeGraph
512512

513513

514-
class TestNode(Node):
514+
class TestNode(BaseNode):
515515

516516
NODE_NAME = 'test node'
517517

NodeGraphQt/widgets/properties_bin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class PropertiesBinWidget(QtWidgets.QWidget):
5454
#: Signal emitted (node_id, prop_name, prop_value)
5555
property_changed = QtCore.Signal(str, str, object)
5656

57-
def __init__(self, parent=None):
57+
def __init__(self, parent=None,):
5858
super(PropertiesBinWidget, self).__init__(parent)
5959
self.setWindowTitle('Properties Bin')
6060
self._prop_list = PropertiesList()
@@ -102,7 +102,7 @@ def add_node(self, node):
102102
Add node to the properties bin.
103103
104104
Args:
105-
node (NodeGraphQt.Node): node object.
105+
node (NodeGraphQt.BaseNode): node object.
106106
"""
107107
if self.limit() == 0:
108108
return
@@ -130,7 +130,7 @@ def remove_node(self, node):
130130
Remove node from the properties bin.
131131
132132
Args:
133-
node (NodeGraphQt.Node): node object.
133+
node (NodeGraphQt.BaseNode): node object.
134134
"""
135135
self.__on_prop_close(node.id)
136136

@@ -145,7 +145,7 @@ def prop_widget(self, node):
145145
Returns the node property widget.
146146
147147
Args:
148-
node (NodeGraphQt.Node): node object.
148+
node (NodeGraphQt.BaseNode): node object.
149149
150150
Returns:
151151
NodePropWidget: node property widget.
@@ -158,7 +158,7 @@ def prop_widget(self, node):
158158

159159
if __name__ == '__main__':
160160
import sys
161-
from NodeGraphQt import Node, NodeGraph
161+
from NodeGraphQt import BaseNode, NodeGraph
162162
from NodeGraphQt.constants import (NODE_PROP_QLABEL,
163163
NODE_PROP_QLINEEDIT,
164164
NODE_PROP_QCOMBO,
@@ -167,7 +167,7 @@ def prop_widget(self, node):
167167
NODE_PROP_SLIDER)
168168

169169

170-
class TestNode(Node):
170+
class TestNode(BaseNode):
171171
NODE_NAME = 'test node'
172172

173173
def __init__(self):

docs/_static/ngqt.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ div.highlight{
261261
}
262262

263263
div.note {
264-
background-color: #28313a;
265-
border: 1px solid #2f4c54;
264+
background-color: #50313b;
265+
border: 1px solid #733c4b;
266266
border-radius: 4px;
267267
}
268268

@@ -325,3 +325,9 @@ div.code-block-caption {
325325
color: #222;
326326
border: 1px solid #C6C9CB;
327327
}
328+
329+
dl.field-list.simple {
330+
background: #212325;
331+
border-radius: 3px;
332+
padding: 4px 12px 2px;
333+
}

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414

1515
import os
1616
import sys
17+
from datetime import datetime
1718

1819
base_path = os.path.abspath('.')
1920
root_path = os.path.split(base_path)[0]
2021
sys.path.insert(0, root_path)
2122

2223
import NodeGraphQt
2324

24-
2525
# -- Project information -----------------------------------------------------
2626

2727
project = 'NodeGraphQt'
28-
copyright = '2018, {}'.format(NodeGraphQt.__author__)
28+
copyright = '{}, {}'.format(datetime.now().year, NodeGraphQt.__author__)
2929
author = NodeGraphQt.__author__
3030

3131
# The full version, including alpha/beta/rc tags
@@ -46,7 +46,7 @@
4646
extensions = [
4747
'sphinx.ext.autodoc',
4848
'sphinx.ext.autosectionlabel',
49-
# 'sphinx.ext.coverage',
49+
'sphinx.ext.coverage',
5050
'sphinx.ext.intersphinx',
5151
'sphinx.ext.napoleon',
5252
]

docs/graph.rst

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

44
**Inherited from:** :class:`PySide2.QtCore.QObject`
55

6-
The NodeGraph class is the main controller for managing all nodes.
6+
The ``NodeGraph`` class is the main controller for managing all nodes.
77

88
.. image:: _images/graph.png
99
:width: 60%

docs/nodes.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Nodes
55
Node Object
66
===========
77

8-
**Inherited by:** :class:`NodeGraphQt.Node`, :class:`NodeGraphQt.Backdrop`
8+
**Inherited by:** :class:`NodeGraphQt.BaseNode`, :class:`NodeGraphQt.Backdrop`
99

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

@@ -25,26 +25,26 @@ The ``NodeObject`` class is the main base class that all nodes inherit from.
2525
:exclude-members: model, NODE_NAME
2626

2727

28-
Node
29-
====
28+
Base Node
29+
=========
3030

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

33-
The ``Node`` class is the base class for nodes that allows port connections from one node to another.
33+
The ``BaseNode`` class is the base class for nodes that allows port connections from one node to another.
3434

3535

3636
.. image:: _images/node.png
3737
:width: 250px
3838

3939
----
4040

41-
.. autoclass:: NodeGraphQt.Node
41+
.. autoclass:: NodeGraphQt.BaseNode
4242
:members:
4343
:exclude-members: update_model
4444

4545

46-
Backdrop
47-
========
46+
Backdrop Node
47+
=============
4848

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

0 commit comments

Comments
 (0)