Browse Source

Merge 770b5cb55f into e39f04d2d8

pull/1483/merge
Sebastian Lohff GitHub 2 months ago
parent
commit
393339b176
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 2 deletions
  1. +21
    -0
      source/frontend/patchcanvas/canvasbox.py
  2. +7
    -2
      source/frontend/patchcanvas/patchcanvas.py

+ 21
- 0
source/frontend/patchcanvas/canvasbox.py View File

@@ -497,10 +497,31 @@ class CanvasBox(QGraphicsObject):
conn_list_ids.append(tmp_conn_id)

if len(conn_list) > 0:
groups = {}
for conn_id, group_id, port_id in conn_list:
groups.setdefault(group_id, []).append(conn_id)
act_x_disc = discMenu.addAction(CanvasGetFullPortName(group_id, port_id))
act_x_disc.setData(conn_id)
act_x_disc.triggered.connect(canvas.qobject.PortContextMenuDisconnect)

# menu entries for disconnecting multiple connections to the same group
separator_added = False
for group_id, conn_ids in groups.items():
if len(conn_ids) < 2:
continue
for group in canvas.group_list:
if group.group_id == group_id:
group_name = group.group_name
break
else:
qCritical("Couldn't find group for group id {}".format(group_id))
continue
if not separator_added:
discMenu.addSeparator()
separator_added = True
act_x_disc_multi = discMenu.addAction("{} (all {} ports)".format(group_name, len(conn_ids)))
act_x_disc_multi.setData(conn_ids)
act_x_disc_multi.triggered.connect(canvas.qobject.PortContextMenuDisconnect)
else:
act_x_disc = discMenu.addAction("No connections")
act_x_disc.setEnabled(False)


+ 7
- 2
source/frontend/patchcanvas/patchcanvas.py View File

@@ -131,11 +131,16 @@ class CanvasObject(QObject):
@pyqtSlot()
def PortContextMenuDisconnect(self):
try:
connectionId = int(self.sender().data())
connection_ids = self.sender().data()
if isinstance(connection_ids, (list, tuple)):
connection_ids = [int(conn_id) for conn_id in connection_ids]
else:
connection_ids = [int(connection_ids)]
except:
return

CanvasCallback(ACTION_PORTS_DISCONNECT, connectionId, 0, "")
for connection_id in connection_ids:
CanvasCallback(ACTION_PORTS_DISCONNECT, connection_id, 0, "")

@pyqtSlot(int, bool, int, int)
def boxPositionChanged(self, groupId, split, x, y):


Loading…
Cancel
Save