From 126b64211566b473d1c2d25fbef9f79ddd062f1d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 30 Jan 2021 21:50:53 +1000 Subject: [PATCH] disable multiple selection for now --- qt/aqt/sidebar.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qt/aqt/sidebar.py b/qt/aqt/sidebar.py index 5a528ff06..78eac879a 100644 --- a/qt/aqt/sidebar.py +++ b/qt/aqt/sidebar.py @@ -6,7 +6,7 @@ from __future__ import annotations from concurrent.futures import Future from enum import Enum -from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple +from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, cast import aqt from anki.collection import ConfigBoolKey @@ -275,7 +275,9 @@ class SidebarTreeView(QTreeView): self.setUniformRowHeights(True) self.setHeaderHidden(True) self.setIndentation(15) - self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection) + # this doesn't play nicely with shift+click to OR items - we may want + # to put it behind a 'multi-select' mode + # self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection) self.setDragDropMode(QAbstractItemView.InternalMove) self.setDragDropOverwriteMode(False) @@ -660,7 +662,13 @@ class SidebarTreeView(QTreeView): if idx: sm = self.selectionModel() sm.clear() - sm.select(idx, QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows) + sm.select( + idx, + cast( + QItemSelectionModel.SelectionFlag, + QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows, + ), + ) m.exec_(QCursor.pos())