From 32dcd90b50f43a7af8d38ac99c8e6f18022b0cb0 Mon Sep 17 00:00:00 2001 From: Sergey Zhuravlevich Date: Thu, 7 Jan 2021 10:02:49 +0100 Subject: [PATCH] Prioritize dialog: allow removing multiple prioritizations at once Removing prioritizations one-by-one can be tedious. This commit enables extended selection in the prioritizations list. Multiple items can be selected with conventional methods, such as holding down Ctrl or Shift key and clicking the items or holding down the left mouse button and hovering the cursor over the list. All items also can be selected with Ctrl+A. Multiple items drag-n-drop is also possible. To avoid confusion, the selection in the prioritizations list is cleared after the items are removed or drag-n-dropped. Signed-off-by: Sergey Zhuravlevich --- core/gui/prioritize_dialog.py | 1 + qt/prioritize_dialog.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/core/gui/prioritize_dialog.py b/core/gui/prioritize_dialog.py index 62f57619..adcd8515 100644 --- a/core/gui/prioritize_dialog.py +++ b/core/gui/prioritize_dialog.py @@ -80,6 +80,7 @@ class PrioritizeDialog(GUIObject): def remove_selected(self): self.prioritization_list.remove_selected() + self.prioritization_list.select([]) def perform_reprioritization(self): self.app.reprioritize_groups(self._sort_key) diff --git a/qt/prioritize_dialog.py b/qt/prioritize_dialog.py index 3fb1ef02..07d2d961 100644 --- a/qt/prioritize_dialog.py +++ b/qt/prioritize_dialog.py @@ -50,6 +50,7 @@ class PrioritizationList(ListviewModel): strMimeData = bytes(mimeData.data(MIME_INDEXES)).decode() indexes = list(map(int, strMimeData.split(","))) self.model.move_indexes(indexes, row) + self.view.selectionModel().clearSelection() return True def mimeData(self, indexes): @@ -114,6 +115,7 @@ class PrioritizeDialog(QDialog): self.prioritizationListView.setDragEnabled(True) self.prioritizationListView.setDragDropMode(QAbstractItemView.InternalMove) self.prioritizationListView.setSelectionBehavior(QAbstractItemView.SelectRows) + self.prioritizationListView.setSelectionMode(QAbstractItemView.ExtendedSelection) self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)