Skip to content

Commit

Permalink
Refactor node deserialize method
Browse files Browse the repository at this point in the history
  • Loading branch information
don4get committed Apr 13, 2020
1 parent e0f8fe4 commit 885af98
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
7 changes: 7 additions & 0 deletions docs/source/apidoc/nodedge.graphics_node_title_item.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodedge.graphics\_node\_title\_item
===================================

.. automodule:: nodedge.graphics_node_title_item
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/apidoc/nodedge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Submodules
nodedge.graphics_edge
nodedge.graphics_node
nodedge.graphics_node_content
nodedge.graphics_node_title_item
nodedge.graphics_scene
nodedge.graphics_socket
nodedge.graphics_view
Expand Down
19 changes: 9 additions & 10 deletions nodedge/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ def __init__(
:Instance Attributes:
- **scene** - reference to the :class:`~nodedge.scene.Scene` -
**graphicsEdge** - Instance of
:class:`~nodedge.graphics_edge.GraphicsEdge` subclass handling graphical
representation in the ``QGraphicsScene``.
**graphicsEdge** - Instance of :class:`~nodedge.graphics_edge.GraphicsEdge`
subclass handling graphical representation in the ``QGraphicsScene``.
"""

super().__init__()
Expand Down Expand Up @@ -138,9 +137,9 @@ def edgeType(self) -> int:
:getter: Get edge type constant for current :class:`~nodedge.edge.Edge`.
:setter: Set new edge type. On background, create new
:class:`~nodedge.graphics_edge.GraphicsEdge` child class if necessary, add this
``QGraphicsPathItem`` to the ``QGraphicsScene`` and update edge sockets
positions.
:class:`~nodedge.graphics_edge.GraphicsEdge` child class if necessary,
add this ``QGraphicsPathItem`` to the ``QGraphicsScene`` and update edge
sockets positions.
:type: :class:`~nodedge.edge.EdgeType`
"""
return self._edgeType
Expand Down Expand Up @@ -168,7 +167,7 @@ def isSelected(self):
:getter: Get selection state of the edge.
:setter: Provide the safe selecting/deselecting operation. In the background it
takes care about the flags, notifications and storing history for undo/redo.
takes care about the flags, notifications and storing history for undo/redo.
:type: ``bool``
"""
Expand Down Expand Up @@ -217,10 +216,10 @@ def getOtherSocket(self, knownSocket: "Socket"):
Return the opposite socket on this `Edge`.
:param knownSocket: Provide known :class:`~nodedge.socket.Socket` to be able
to determine the opposite one :type knownSocket:
:class:`~nodedge.socket.Socket`
to determine the opposite one
:type knownSocket: :class:`~nodedge.socket.Socket`
:return: The opposite socket on this :class:`~nodedge.edge.Edge`,
eventually ``None``.
eventually ``None``.
:rtype: :class:`~nodedge.socket.Socket` or ``None``
"""

Expand Down
15 changes: 8 additions & 7 deletions nodedge/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def initSockets(
Create input and output sockets.
:param inputs: list of types of the input `Sockets`. Every type is associated
with a ``int``
with a ``int``
:type inputs: ``Collection[int]``
:param outputs: list of types of the input `Sockets`
:type outputs: ``Collection[int]``
Expand Down Expand Up @@ -273,7 +273,7 @@ def socketPos(self, index: int, location: int, countOnThisSide: int = 1) -> QPoi
:param index: Order number of the Socket. (0, 1, 2, ...)
:type index: ``int``
:param location: `Socket location constant` describing where
the Socket is located
the Socket is located
:type location: :class:`~nodedge.socket.SocketLocation`
:param countOnThisSide: Total number of Sockets on this `Socket Position`
:type countOnThisSide: ``int``
Expand Down Expand Up @@ -372,7 +372,7 @@ def markChildrenDirty(self, newValue: bool = True) -> None:
descendants. Note: it does not apply to this node.
:param newValue: ``True`` if children should be `Dirty`,
``False`` to un-dirty them.
``False`` to un-dirty them.
:type newValue: ``bool``
"""
for otherNode in self.getChildrenNodes():
Expand Down Expand Up @@ -404,7 +404,7 @@ def markChildrenInvalid(self, newValue: bool = True) -> None:
Note: it does not apply to this node.
:param newValue: ``True`` if children should be `Invalid`, ``False`` to make
them valid.
them valid.
:type newValue: ``bool``
"""
for otherNode in self.getChildrenNodes():
Expand Down Expand Up @@ -491,8 +491,8 @@ def inputNodesAt(self, index: int) -> List["Node"]:
:param index: order number of the input socket
:type index: ``int``
:return: all :class:`~nodedge.node.Node` instances which are connected
to the specified input or ``[]`` if there is no connection
or index is out of range.
to the specified input or ``[]`` if there is no connection
or index is out of range.
:rtype: List[:class:`~nodedge.node.Node`]
"""
return self.__IONodesAt("input", index)
Expand Down Expand Up @@ -524,7 +524,8 @@ def outputNodesAt(self, index: int) -> List["Node"]:
:param index: order number of the output socket
:type index: ``int``
:return: all :class:`~nodedge.node.Node` instances which are connected to the
specified output or ``[]`` if there is no connection or index is out of range
specified output or ``[]`` if there is no connection or
index is out of range.
:rtype: List[:class:`~nodedge.node.Node`]
"""
return self.__IONodesAt("output", index)
Expand Down

0 comments on commit 885af98

Please sign in to comment.