Skip to content

Commit cf4d69e

Browse files
committed
port disconnect signal
1 parent 5ab1a26 commit cf4d69e

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

NodeGraphQt/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def __init__(self):
8484
from .base.node import NodeObject, BaseNode, BackdropNode
8585
from .base.port import Port
8686
from .pkg_info import __version__ as VERSION
87+
from .pkg_info import __license__ as LICENSE
8788

8889
# functions
8990
from .base.actions import setup_context_menu
@@ -94,7 +95,7 @@ def __init__(self):
9495

9596
__version__ = VERSION
9697
__all__ = [
97-
'BackdropNode', 'BaseNode', 'Menu', 'MenuCommand', 'NodeGraph',
98+
'BackdropNode', 'BaseNode', 'LICENSE', 'Menu', 'MenuCommand', 'NodeGraph',
9899
'NodeObject', 'NodeTreeWidget', 'Port', 'PropertiesBinWidget', 'VERSION',
99100
'constants', 'setup_context_menu'
100101
]

NodeGraphQt/base/graph.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class NodeGraph(QtCore.QObject):
3535
node_double_clicked = QtCore.Signal(NodeObject)
3636
#: signal for when a node has been connected emits (source port, target port).
3737
port_connected = QtCore.Signal(Port, Port)
38+
#: signal for when a node has been disconnected emits (source port, target port).
39+
port_disconnected = QtCore.Signal(Port, Port)
3840
#: signal for when a node property has changed emits (node, property name, property value).
3941
property_changed = QtCore.Signal(NodeObject, str, object)
4042
#: signal for when drop data has been added to the graph.

NodeGraphQt/base/port.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def connected_ports(self):
126126

127127
def connect_to(self, port=None):
128128
"""
129-
Create connection to the specified port.
129+
Create connection to the specified port and emits the "port_connected"
130+
signal from the parent node graph.
130131
131132
Args:
132133
port (NodeGraphQt.Port): port object.
@@ -170,7 +171,8 @@ def connect_to(self, port=None):
170171

171172
def disconnect_from(self, port=None):
172173
"""
173-
Disconnect from the specified port.
174+
Disconnect from the specified port and emits the "port_disconnected"
175+
signal from the parent node graph.
174176
175177
Args:
176178
port (NodeGraphQt.Port): port object.
@@ -179,3 +181,6 @@ def disconnect_from(self, port=None):
179181
return
180182
graph = self.node().graph
181183
graph.undo_stack().push(PortDisconnectedCmd(self, port))
184+
185+
# emit "port_disconnected" signal from the parent graph.
186+
graph.port_disconnected.emit(self, port)

NodeGraphQt/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
33
import os
4+
from .pkg_info import __version__
45

6+
#: Version of the NodeGraphQt framework.
7+
VERSION = __version__
58

69
# === PIPE ===
710

0 commit comments

Comments
 (0)