mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Merge pull request #3535 from bpnguyen107/aqt-strict-optional-taglimit
Enable strict_optional for aqt/taglimit.py
This commit is contained in:
commit
8ebb274ff2
2 changed files with 11 additions and 3 deletions
|
@ -48,6 +48,8 @@ strict_optional = True
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
[mypy-aqt.customstudy]
|
[mypy-aqt.customstudy]
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
|
[mypy-aqt.taglimit]
|
||||||
|
strict_optional = True
|
||||||
[mypy-anki.scheduler.base]
|
[mypy-anki.scheduler.base]
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
[mypy-anki._backend.rsbridge]
|
[mypy-anki._backend.rsbridge]
|
||||||
|
|
|
@ -50,7 +50,9 @@ class TagLimit(QDialog):
|
||||||
list.addItem(item)
|
list.addItem(item)
|
||||||
if select:
|
if select:
|
||||||
idx = list.indexFromItem(item)
|
idx = list.indexFromItem(item)
|
||||||
list.selectionModel().select(
|
list_selection_model = list.selectionModel()
|
||||||
|
assert list_selection_model is not None
|
||||||
|
list_selection_model.select(
|
||||||
idx, QItemSelectionModel.SelectionFlag.Select
|
idx, QItemSelectionModel.SelectionFlag.Select
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -77,12 +79,16 @@ class TagLimit(QDialog):
|
||||||
if want_active:
|
if want_active:
|
||||||
item = self.form.activeList.item(c)
|
item = self.form.activeList.item(c)
|
||||||
idx = self.form.activeList.indexFromItem(item)
|
idx = self.form.activeList.indexFromItem(item)
|
||||||
if self.form.activeList.selectionModel().isSelected(idx):
|
active_list_selection_model = self.form.activeList.selectionModel()
|
||||||
|
assert active_list_selection_model is not None
|
||||||
|
if active_list_selection_model.isSelected(idx):
|
||||||
include_tags.append(tag.name)
|
include_tags.append(tag.name)
|
||||||
# inactive
|
# inactive
|
||||||
item = self.form.inactiveList.item(c)
|
item = self.form.inactiveList.item(c)
|
||||||
idx = self.form.inactiveList.indexFromItem(item)
|
idx = self.form.inactiveList.indexFromItem(item)
|
||||||
if self.form.inactiveList.selectionModel().isSelected(idx):
|
inactive_list_selection_model = self.form.inactiveList.selectionModel()
|
||||||
|
assert inactive_list_selection_model is not None
|
||||||
|
if inactive_list_selection_model.isSelected(idx):
|
||||||
exclude_tags.append(tag.name)
|
exclude_tags.append(tag.name)
|
||||||
|
|
||||||
if (len(include_tags) + len(exclude_tags)) > 100:
|
if (len(include_tags) + len(exclude_tags)) > 100:
|
||||||
|
|
Loading…
Reference in a new issue