Skip to content

Commit fa8b3de

Browse files
committed
Prevent duplicate outputs in virtual devices
1 parent 7c8e230 commit fa8b3de

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

blacs/plugins/virtual_device/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,20 @@ def on_treeView_connection_table_clicked(self, index):
290290
complete_vds.append(vd.text())
291291

292292
for r in range(0, vd.rowCount()):
293-
if vd.child(r, self.VD_TREE_COL_NAME).text() != item.parent().text():
293+
output_group = vd.child(r, self.VD_TREE_COL_NAME)
294+
if output_group.text() != item.parent().text():
294295
continue
295296

296-
vd.child(r, self.VD_TREE_COL_NAME).appendRow(self.make_virtual_device_output_row(new_vd_output))
297+
# Avoid duplicating outputs in a virtual device
298+
already_present = False
299+
for j in range(0, output_group.rowCount()):
300+
if output_group.child(j).text() == new_vd_output.text():
301+
already_present = True
302+
break
303+
if already_present:
304+
continue
305+
306+
output_group.appendRow(self.make_virtual_device_output_row(new_vd_output))
297307

298308
def on_virtual_devices_item_changed(self, item):
299309
if item.column() != self.VD_TREE_COL_NAME or not item.data(self.VD_TREE_ROLE_IS_DUMMY_ROW):

0 commit comments

Comments
 (0)