Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FIX: allow deleting duplicated items in the variable list
this case should not happen though :)
  • Loading branch information
gdementen committed Apr 15, 2026
commit 853eb2bc05909347483cde3c2475db6f6af9e86d
11 changes: 8 additions & 3 deletions larray_editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,14 @@ def add_list_items(self, names):

def delete_list_item(self, to_delete):
deleted_items = self._listwidget.findItems(to_delete, Qt.MatchExactly)
if len(deleted_items) == 1:
deleted_item_idx = self._listwidget.row(deleted_items[0])
self._listwidget.takeItem(deleted_item_idx)
# normally there should be exactly one item to delete (and we initially
# tested for len == 1) because there should not be any duplicate named
# items but if, for some reason, we do have some duplicates, it is
# better to delete them all than not delete any
if len(deleted_items) >= 1:
for deleted_item in deleted_items:
item_idx = self._listwidget.row(deleted_item)
self._listwidget.takeItem(item_idx)

def display_item_in_new_window(self, list_item):
assert isinstance(list_item, QListWidgetItem)
Expand Down