QNodeEditor.socket.Socket#
- class QNodeEditor.socket.Socket(entry: Entry, value_type: Type = <class 'int'>)#
Bases:
QObjectSocket container holding a reference to all edges connected to it.
This class should not be used since all socket instances are handled by
Entryinstances automatically.- graphics#
Graphics object that is shown in the scene representing this socket
Properties
Signal that is emitted when a new edge is connected to the socket
Signal that is emitted when an edge is disconnected from the socket
Methods
Create a new socket.
Connect a new edge to the socket.
Get the state of the socket as a (JSON-safe) dictionary.
Remove all edges from the socket
Remove an edge from the socket
Set the state of this socket from a state dictionary.
Update the graphics for all edges connected to this socket
- __init__(entry: Entry, value_type: Type = <class 'int'>)#
Create a new socket.
- Parameters:
entry (
Entry) – Entry this socket belongs tovalue_type (Type) – Type of the socket (not yet implemented)
- add_edge(edge: Edge) None#
Connect a new edge to the socket.
- Parameters:
edge (
edge.Edge) – Edge to connect to the socket- Return type:
None
- get_state() dict#
Get the state of the socket as a (JSON-safe) dictionary.
The dictionary contains:
id: The internal ID of the socket
- Returns:
JSON-safe dictionary representing socket state
- Return type:
dict
- remove_all_edges() None#
Remove all edges from the socket
- Return type:
None
- remove_edge(edge: Edge) None#
Remove an edge from the socket
- Parameters:
edge (
edge.Edge) – Edge to remove from the socket- Return type:
None
- set_state(state: dict, restore_id: bool = True) bool#
Set the state of this socket from a state dictionary.
The dictionary contains:
id: The internal ID of the socket
- Parameters:
state (dict) – Dictionary representation of the desired socket state
restore_id (bool) – Whether to restore the internal ID or use a new one
- Returns:
Whether setting the entry state succeeded.
- Return type:
bool
- update_edges() None#
Update the graphics for all edges connected to this socket
- Return type:
None