diff --git a/NodeGraphQt/__init__.py b/NodeGraphQt/__init__.py index f59c2eda..601a8897 100644 --- a/NodeGraphQt/__init__.py +++ b/NodeGraphQt/__init__.py @@ -84,6 +84,7 @@ def __init__(self): from .base.node import NodeObject, BaseNode, BackdropNode from .base.port import Port from .pkg_info import __version__ as VERSION +from .pkg_info import __license__ as LICENSE # functions from .base.actions import setup_context_menu @@ -94,7 +95,7 @@ def __init__(self): __version__ = VERSION __all__ = [ - 'BackdropNode', 'BaseNode', 'Menu', 'MenuCommand', 'NodeGraph', + 'BackdropNode', 'BaseNode', 'LICENSE', 'Menu', 'MenuCommand', 'NodeGraph', 'NodeObject', 'NodeTreeWidget', 'Port', 'PropertiesBinWidget', 'VERSION', 'constants', 'setup_context_menu' ] diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 10724c92..f0d82123 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -35,6 +35,8 @@ class NodeGraph(QtCore.QObject): node_double_clicked = QtCore.Signal(NodeObject) #: signal for when a node has been connected emits (source port, target port). port_connected = QtCore.Signal(Port, Port) + #: signal for when a node has been disconnected emits (source port, target port). + port_disconnected = QtCore.Signal(Port, Port) #: signal for when a node property has changed emits (node, property name, property value). property_changed = QtCore.Signal(NodeObject, str, object) #: signal for when drop data has been added to the graph. diff --git a/NodeGraphQt/base/port.py b/NodeGraphQt/base/port.py index 2af0b0af..4f1a0ba5 100644 --- a/NodeGraphQt/base/port.py +++ b/NodeGraphQt/base/port.py @@ -126,7 +126,8 @@ def connected_ports(self): def connect_to(self, port=None): """ - Create connection to the specified port. + Create connection to the specified port and emits the "port_connected" + signal from the parent node graph. Args: port (NodeGraphQt.Port): port object. @@ -170,7 +171,8 @@ def connect_to(self, port=None): def disconnect_from(self, port=None): """ - Disconnect from the specified port. + Disconnect from the specified port and emits the "port_disconnected" + signal from the parent node graph. Args: port (NodeGraphQt.Port): port object. @@ -179,3 +181,6 @@ def disconnect_from(self, port=None): return graph = self.node().graph graph.undo_stack().push(PortDisconnectedCmd(self, port)) + + # emit "port_disconnected" signal from the parent graph. + graph.port_disconnected.emit(self, port) diff --git a/NodeGraphQt/constants.py b/NodeGraphQt/constants.py index 1eceee78..c093247a 100644 --- a/NodeGraphQt/constants.py +++ b/NodeGraphQt/constants.py @@ -1,7 +1,10 @@ #!/usr/bin/python # -*- coding: utf-8 -*- import os +from .pkg_info import __version__ +#: Version of the NodeGraphQt framework. +VERSION = __version__ # === PIPE ===