Skip to content

Commit fed59b8

Browse files
committed
doc clean up
1 parent 684293d commit fed59b8

File tree

3 files changed

+36
-32
lines changed

3 files changed

+36
-32
lines changed

NodeGraphQt/base/graph.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ def viewer(self):
265265
Returns the view interface used by the node graph.
266266
267267
Warnings:
268-
Methods in the `NodeViewer` are used internally
269-
by `NodeGraphQt` components.
268+
Methods in the ``NodeViewer`` are used internally
269+
by ``NodeGraphQt`` components.
270270
271271
See Also:
272272
:attr:`NodeGraph.widget` for adding the node graph into a
@@ -279,7 +279,7 @@ def viewer(self):
279279

280280
def scene(self):
281281
"""
282-
Return the scene object.
282+
Returns the ``QGraphicsScene`` object used in the node graph.
283283
284284
Returns:
285285
NodeGraphQt.widgets.scene.NodeScene: node scene.
@@ -421,9 +421,9 @@ def get_context_menu(self, menu):
421421
"""
422422
Returns the context menu specified by the name.
423423
424-
Menu types:
425-
"graph" - context menu from the node graph.
426-
"nodes" - context menu for the nodes.
424+
Menu Types:
425+
- ``"graph"`` context menu from the node graph.
426+
- ``"nodes"`` context menu for the nodes.
427427
428428
Args:
429429
menu (str): menu name.
@@ -466,13 +466,13 @@ def acyclic(self):
466466
Returns true if the current node graph is acyclic.
467467
468468
Returns:
469-
bool: true if acyclic (default: True).
469+
bool: true if acyclic (default: ``True``).
470470
"""
471471
return self._model.acyclic
472472

473473
def set_acyclic(self, mode=False):
474474
"""
475-
Enable the node graph to be a acyclic graph. (default=False)
475+
Enable the node graph to be a acyclic graph. (default: ``False``)
476476
477477
Args:
478478
mode (bool): true to enable acyclic.
@@ -520,10 +520,10 @@ def reset_zoom(self):
520520

521521
def set_zoom(self, zoom=0):
522522
"""
523-
Set the zoom factor of the Node Graph the default is 0.0
523+
Set the zoom factor of the Node Graph the default is ``0.0``
524524
525525
Args:
526-
zoom (float): zoom factor (max zoom out -0.9 / max zoom in 2.0)
526+
zoom (float): zoom factor (max zoom out ``-0.9`` / max zoom in ``2.0``)
527527
"""
528528
self._viewer.set_zoom(zoom)
529529

@@ -586,9 +586,9 @@ def create_node(self, node_type, name=None, selected=True, color=None,
586586
node_type (str): node instance type.
587587
name (str): set name of the node.
588588
selected (bool): set created node to be selected.
589-
color (tuple or str): node color (255, 255, 255) or '#FFFFFF'.
590-
text_color (tuple or str): node text color (255, 255, 255) or '#FFFFFF'.
591-
pos (list[int, int]): initial x, y position for the node (default: (0, 0)).
589+
color (tuple or str): node color ``(255, 255, 255)`` or ``"#FFFFFF"``.
590+
text_color (tuple or str): text color ``(255, 255, 255)`` or ``"#FFFFFF"``.
591+
pos (list[int, int]): initial x, y position for the node (default: ``(0, 0)``).
592592
593593
Returns:
594594
NodeGraphQt.BaseNode: the created instance of the node.
@@ -734,7 +734,7 @@ def get_node_by_id(self, node_id=None):
734734
Returns the node from the node id string.
735735
736736
Args:
737-
node_id (str): node id (:meth:`NodeObject.id`)
737+
node_id (str): node id (:attr:`NodeObject.id`)
738738
739739
Returns:
740740
NodeGraphQt.NodeObject: node object.
@@ -1053,7 +1053,7 @@ def disable_nodes(self, nodes, mode=None):
10531053

10541054
def question_dialog(self, text, title='Node Graph'):
10551055
"""
1056-
Prompts a question open dialog with "Yes" and "No" buttons in
1056+
Prompts a question open dialog with ``"Yes"`` and ``"No"`` buttons in
10571057
the node graph.
10581058
10591059
Note:
@@ -1093,7 +1093,7 @@ def load_dialog(self, current_dir=None, ext=None):
10931093
10941094
Args:
10951095
current_dir (str): path to a directory.
1096-
ext (str): custom file type extension (default: json)
1096+
ext (str): custom file type extension (default: ``"json"``)
10971097
10981098
Returns:
10991099
str: selected file path.
@@ -1110,7 +1110,7 @@ def save_dialog(self, current_dir=None, ext=None):
11101110
11111111
Args:
11121112
current_dir (str): path to a directory.
1113-
ext (str): custom file type extension (default: json)
1113+
ext (str): custom file type extension (default: ``"json"``)
11141114
11151115
Returns:
11161116
str: selected file path.

NodeGraphQt/base/node.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def color(self):
174174
Returns the node color in (red, green, blue) value.
175175
176176
Returns:
177-
tuple: (r, g, b) from 0-255 range.
177+
tuple: ``(r, g, b)`` from ``0-255`` range.
178178
"""
179179
r, g, b, a = self.model.color
180180
return r, g, b
@@ -184,9 +184,9 @@ def set_color(self, r=0, g=0, b=0):
184184
Sets the color of the node in (red, green, blue) value.
185185
186186
Args:
187-
r (int): red value 0-255 range.
188-
g (int): green value 0-255 range.
189-
b (int): blue value 0-255 range.
187+
r (int): red value ``0-255`` range.
188+
g (int): green value ``0-255`` range.
189+
b (int): blue value ``0-255`` range.
190190
"""
191191
self.set_property('color', (r, g, b, 255))
192192

@@ -195,7 +195,7 @@ def disabled(self):
195195
Returns weather the node is enabled or disabled.
196196
197197
Returns:
198-
bool: true if the node is disabled.
198+
bool: True if the node is disabled.
199199
"""
200200
return self.model.disabled
201201

@@ -204,7 +204,7 @@ def set_disabled(self, mode=False):
204204
Set the node state to either disabled or enabled.
205205
206206
Args:
207-
mode(bool): true to disable node.
207+
mode(bool): True to disable node.
208208
"""
209209
self.set_property('disabled', mode)
210210

@@ -235,8 +235,8 @@ def create_property(self, name, value, items=None, range=None,
235235
Args:
236236
name (str): name of the property.
237237
value (object): data.
238-
items (list[str]): items used by widget type NODE_PROP_QCOMBO
239-
range (tuple)): min, max values used by NODE_PROP_SLIDER
238+
items (list[str]): items used by widget type ``NODE_PROP_QCOMBO``
239+
range (tuple)): ``(min, max)`` values used by ``NODE_PROP_SLIDER``
240240
widget_type (int): widget flag to display in the properties bin.
241241
tab (str): name of the widget tab to display in the properties bin.
242242
"""
@@ -502,7 +502,7 @@ def add_input(self, name='input', multi_input=False, display_name=True,
502502
name (str): name for the input port.
503503
multi_input (bool): allow port to have more than one connection.
504504
display_name (bool): display the port name on the node.
505-
color (tuple): initial port color (r, g, b) 0-255.
505+
color (tuple): initial port color (r, g, b) ``0-255``.
506506
507507
Returns:
508508
NodeGraphQt.Port: the created port object.
@@ -532,7 +532,7 @@ def add_output(self, name='output', multi_output=True, display_name=True,
532532
name (str): name for the output port.
533533
multi_output (bool): allow port to have more than one connection.
534534
display_name (bool): display the port name on the node.
535-
color (tuple): initial port color (r, g, b) 0-255.
535+
color (tuple): initial port color (r, g, b) ``0-255``.
536536
537537
Returns:
538538
NodeGraphQt.Port: the created port object.

NodeGraphQt/base/port.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ def type_(self):
5252
"""
5353
Returns the port type.
5454
55+
Port Types:
56+
- :attr:`NodeGraphQt.constants.IN_PORT` for input port
57+
- :attr:`NodeGraphQt.constants.OUT_PORT` for output port
58+
5559
Returns:
56-
str: 'in' for input port or 'out' for output port.
60+
str: port connection type.
5761
"""
5862
return self.model.type_
5963

@@ -132,8 +136,8 @@ def connected_ports(self):
132136

133137
def connect_to(self, port=None):
134138
"""
135-
Create connection to the specified port and emits the "port_connected"
136-
signal from the parent node graph.
139+
Create connection to the specified port and emits the
140+
:attr:`NodeGraph.port_connected` signal from the parent node graph.
137141
138142
Args:
139143
port (NodeGraphQt.Port): port object.
@@ -184,8 +188,8 @@ def connect_to(self, port=None):
184188

185189
def disconnect_from(self, port=None):
186190
"""
187-
Disconnect from the specified port and emits the "port_disconnected"
188-
signal from the parent node graph.
191+
Disconnect from the specified port and emits the
192+
:attr:`NodeGraph.port_disconnected` signal from the parent node graph.
189193
190194
Args:
191195
port (NodeGraphQt.Port): port object.

0 commit comments

Comments
 (0)