From 91cf9084aa286fcbd16be9cc99367728ef4186ab Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sat, 27 May 2017 17:27:57 +1000 Subject: [PATCH] Make it possible to delete multiple items from the list with a shift-select --- onionshare_gui/file_selection.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py index f24c61ea..5939a865 100644 --- a/onionshare_gui/file_selection.py +++ b/onionshare_gui/file_selection.py @@ -35,6 +35,7 @@ class FileList(QtWidgets.QListWidget): self.setAcceptDrops(True) self.setIconSize(QtCore.QSize(32, 32)) self.setSortingEnabled(True) + self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) class DropHereLabel(QtWidgets.QLabel): """ @@ -253,9 +254,11 @@ class FileSelection(QtWidgets.QVBoxLayout): """ Delete button clicked """ - current_row = self.file_list.currentRow() - self.file_list.filenames.pop(current_row) - self.file_list.takeItem(current_row) + selected = self.file_list.selectedItems() + for item in selected: + itemrow = self.file_list.row(item) + self.file_list.filenames.pop(itemrow) + self.file_list.takeItem(itemrow) self.update() def server_started(self):