Skip to content

Commit 8cad0da

Browse files
committed
slice connection command.
1 parent bb7cad5 commit 8cad0da

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

NodeGraphQt/base/graph.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,17 @@ def _on_connection_sliced(self, ports):
197197
ports (list[list[widgets.port.PortItem]]):
198198
pair list of port connections (in port, out port)
199199
"""
200-
for in_port, out_port in ports:
201-
print(in_port, out_port)
200+
if not ports:
201+
return
202+
ptypes = {'in': 'inputs', 'out': 'outputs'}
203+
self._undo_stack.beginMacro('slice connections')
204+
for p1_view, p2_view in ports:
205+
node1 = self._model.nodes[p1_view.node.id]
206+
node2 = self._model.nodes[p2_view.node.id]
207+
port1 = getattr(node1, ptypes[p1_view.port_type])()[p1_view.name]
208+
port2 = getattr(node2, ptypes[p2_view.port_type])()[p2_view.name]
209+
port1.disconnect_from(port2)
210+
self._undo_stack.endMacro()
202211

203212
@property
204213
def model(self):

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
PySide2>=5.12
22
Qt.py>=1.2.0.b2
3-
python>=3.6

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
packages=setuptools.find_packages(exclude=["example_nodes"]),
3030
classifiers=classifiers,
3131
include_package_data=True,
32+
python_requires='>=3.6',
3233
)
3334

3435

0 commit comments

Comments
 (0)