Skip to content

Commit b235486

Browse files
committed
doc updates
1 parent e7d98a2 commit b235486

File tree

8 files changed

+244
-207
lines changed

8 files changed

+244
-207
lines changed

NodeGraphQt/base/node.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,14 @@ def create_property(self, name, value, items=None, range=None,
253253
"""
254254
Creates a custom property to the node.
255255
256-
Widget Types:
256+
See Also:
257+
Custom node properties bin widget
258+
:class:`NodeGraphQt.PropertiesBinWidget`
259+
260+
Hint:
261+
Here are some constants variables used to define the node
262+
widget type in the ``PropertiesBinWidget``.
263+
257264
- :attr:`NodeGraphQt.constants.NODE_PROP`
258265
- :attr:`NodeGraphQt.constants.NODE_PROP_QLABEL`
259266
- :attr:`NodeGraphQt.constants.NODE_PROP_QLINEEDIT`
@@ -270,15 +277,13 @@ def create_property(self, name, value, items=None, range=None,
270277
- :attr:`NodeGraphQt.constants.NODE_PROP_INT`
271278
- :attr:`NodeGraphQt.constants.NODE_PROP_BUTTON`
272279
273-
See Also:
274-
:class:`NodeGraphQt.PropertiesBinWidget`
275-
276280
Args:
277281
name (str): name of the property.
278282
value (object): data.
279283
items (list[str]): items used by widget type ``NODE_PROP_QCOMBO``
280284
range (tuple)): ``(min, max)`` values used by ``NODE_PROP_SLIDER``
281-
widget_type (int): widget flag to display in the ``PropertiesBinWidget``
285+
widget_type (int): widget flag to display in the
286+
:class:`NodeGraphQt.PropertiesBinWidget`
282287
tab (str): name of the widget tab to display in the properties bin.
283288
ext (str): file ext of ``NODE_PROP_FILE``
284289
funcs (list[function]) list of functions for NODE_PROP_BUTTON

NodeGraphQt/base/port.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class Port(object):
1515
.. image:: ../_images/port.png
1616
:width: 50%
1717
18+
See Also:
19+
For adding a ports into a node see:
20+
:meth:`BaseNode.add_input`, :meth:`BaseNode.add_output`
21+
1822
Args:
1923
node (NodeGraphQt.NodeObject): parent node.
2024
port (PortItem): graphic item used for drawing.

NodeGraphQt/widgets/node_widgets.py

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ def add_node_widget(self, widget):
3030

3131
class NodeBaseWidget(QtWidgets.QGraphicsProxyWidget):
3232
"""
33-
NodeBaseWidget is the main base class for all node widgets that is
34-
embedded in a :class:`NodeGraphQt.BaseNode` object.
33+
This is the main wrapper class that allows a widget to be
34+
added in a :class:`NodeGraphQt.BaseNode`.
35+
36+
If you want to add your own custom widget into a node you'll need
37+
to subclass ``NodeBaseWidget`` for an example have a look at the source
38+
code for the ``NodeComboBox``
39+
`here <https://github.com/jchanvfx/NodeGraphQt/blob/master/NodeGraphQt/widgets/node_widgets.py#L149>`_.
3540
"""
3641

3742
value_changed = QtCore.Signal(str, object)
@@ -61,6 +66,10 @@ def widget(self):
6166
"""
6267
Returns the embedded QWidget used in the node.
6368
69+
Note:
70+
To add your own custom widget in a :class:`NodeGraphQt.BaseNode`
71+
you must re-implement this function.
72+
6473
Returns:
6574
QtWidgets.QWidget: nested QWidget
6675
"""
@@ -71,6 +80,10 @@ def value(self):
7180
"""
7281
Returns the widgets current value.
7382
83+
Note:
84+
You must re-implement this function to get the value from your
85+
custom widget.
86+
7487
Returns:
7588
str: current property value.
7689
"""
@@ -81,6 +94,9 @@ def value(self, text):
8194
"""
8295
Sets the widgets current value.
8396
97+
Note:
98+
You must re-implement this function to update your custom widget.
99+
84100
Args:
85101
text (str): new text value.
86102
"""
@@ -148,11 +164,12 @@ def get_icon(self, name):
148164

149165
class NodeComboBox(NodeBaseWidget):
150166
"""
151-
NodeComboBox widget is subclassed from :class:`NodeBaseWidget`,
152-
this widget is displayed as a ``QComboBox`` embedded in a node.
167+
Displays as a ``QComboBox`` in a node.
168+
169+
**Inherited from:** :class:`NodeBaseWidget`
153170
154171
.. note::
155-
`To embed a ``QComboBox`` in a node see func:`
172+
`To embed a` ``QComboBox`` `in a node see func:`
156173
:meth:`NodeGraphQt.BaseNode.add_combo_menu`
157174
"""
158175

@@ -221,11 +238,12 @@ def clear(self):
221238

222239
class NodeLineEdit(NodeBaseWidget):
223240
"""
224-
NodeLineEdit widget is subclassed from :class:`NodeBaseWidget`,
225-
this widget is displayed as a ``QLineEdit`` embedded in a node.
241+
Displays as a ``QLineEdit`` in a node.
242+
243+
**Inherited from:** :class:`NodeBaseWidget`
226244
227245
.. note::
228-
`To embed a ``QLineEdit`` in a node see func:`
246+
`To embed a` ``QLineEdit`` `in a node see func:`
229247
:meth:`NodeGraphQt.BaseNode.add_text_input`
230248
"""
231249

@@ -269,15 +287,16 @@ def value(self, text=''):
269287

270288
class NodeFloatEdit(NodeBaseWidget):
271289
"""
272-
NodeFloatEdit widget is subclassed from :class:`NodeBaseWidget`,
273-
this widget is displayed as a ``QLineEdit`` embedded in a node.
290+
Displays as a ``QLineEdit`` in a node.
291+
292+
**Inherited from:** :class:`NodeBaseWidget`
274293
275294
.. note::
276-
`To embed a ``QLineEdit`` in a node see func:`
295+
`To embed a` ``QLineEdit`` `in a node see func:`
277296
:meth:`NodeGraphQt.BaseNode.add_float_input`
278297
"""
279298

280-
def __init__(self, parent=None, name='', label='', value = 0.0):
299+
def __init__(self, parent=None, name='', label='', value=0.0):
281300
super(NodeFloatEdit, self).__init__(parent, name, label)
282301
self._ledit = _ValueEdit()
283302
self._ledit.setStyleSheet(STYLE_QLINEEDIT)
@@ -317,11 +336,12 @@ def value(self, value):
317336

318337
class NodeIntEdit(NodeFloatEdit):
319338
"""
320-
NodeIntEdit widget is subclassed from :class:`NodeFloatEdit`,
321-
this widget is displayed as a ``QLineEdit`` embedded in a node.
339+
Displays as a ``QLineEdit`` in a node.
340+
341+
**Inherited from:** :class:`NodeBaseWidget`
322342
323343
.. note::
324-
`To embed a ``QLineEdit`` in a node see func:`
344+
`To embed a` ``QLineEdit`` `in a node see func:`
325345
:meth:`NodeGraphQt.BaseNode.add_int_input`
326346
"""
327347

@@ -333,11 +353,12 @@ def __init__(self, parent=None, name='', label='', value=0):
333353

334354
class NodeCheckBox(NodeBaseWidget):
335355
"""
336-
NodeCheckBox widget is subclassed from :class:`NodeBaseWidget`,
337-
this widget is displayed as a ``QCheckBox`` embedded in a node.
356+
Displays as a ``QCheckBox`` in a node.
357+
358+
**Inherited from:** :class:`NodeBaseWidget`
338359
339360
.. note::
340-
`To embed a ``QCheckBox`` in a node see func:`
361+
`To embed a` ``QCheckBox`` `in a node see func:`
341362
:meth:`NodeGraphQt.BaseNode.add_checkbox`
342363
"""
343364

@@ -385,12 +406,13 @@ def value(self, state=False):
385406

386407
class NodeFilePath(NodeLineEdit):
387408
"""
388-
NodeFilePath widget is subclassed from :class:`NodeLineEdit`,
389-
this widget is displayed as a ``QLineEdit`` embedded in a node.
409+
Displays as a ``QLineEdit`` in a node.
410+
411+
**Inherited from:** :class:`NodeBaseWidget`
390412
391413
.. note::
392-
`To embed a ``QLineEdit`` in a node see func:`
393-
:meth:`NodeGraphQt.BaseNode.add_float_input`
414+
To embed a ``QLineEdit`` in a node see:
415+
:meth:`NodeGraphQt.BaseNode.add_file_input`
394416
"""
395417

396418
def __init__(self, parent=None, name='', label='', text='', ext='*'):

0 commit comments

Comments
 (0)