mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Enable strict_optional for aqt/deckbrowser.py (#3537)
* Enable strict_optional * Fix mypy errors
This commit is contained in:
parent
0ce907fe5b
commit
2889299670
2 changed files with 9 additions and 3 deletions
|
@ -50,6 +50,8 @@ strict_optional = True
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
[mypy-aqt.taglimit]
|
[mypy-aqt.taglimit]
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
|
[mypy-aqt.deckbrowser]
|
||||||
|
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]
|
||||||
|
|
|
@ -309,12 +309,16 @@ class DeckBrowser:
|
||||||
def _showOptions(self, did: str) -> None:
|
def _showOptions(self, did: str) -> None:
|
||||||
m = QMenu(self.mw)
|
m = QMenu(self.mw)
|
||||||
a = m.addAction(tr.actions_rename())
|
a = m.addAction(tr.actions_rename())
|
||||||
|
assert a is not None
|
||||||
qconnect(a.triggered, lambda b, did=did: self._rename(DeckId(int(did))))
|
qconnect(a.triggered, lambda b, did=did: self._rename(DeckId(int(did))))
|
||||||
a = m.addAction(tr.actions_options())
|
a = m.addAction(tr.actions_options())
|
||||||
|
assert a is not None
|
||||||
qconnect(a.triggered, lambda b, did=did: self._options(DeckId(int(did))))
|
qconnect(a.triggered, lambda b, did=did: self._options(DeckId(int(did))))
|
||||||
a = m.addAction(tr.actions_export())
|
a = m.addAction(tr.actions_export())
|
||||||
|
assert a is not None
|
||||||
qconnect(a.triggered, lambda b, did=did: self._export(DeckId(int(did))))
|
qconnect(a.triggered, lambda b, did=did: self._export(DeckId(int(did))))
|
||||||
a = m.addAction(tr.actions_delete())
|
a = m.addAction(tr.actions_delete())
|
||||||
|
assert a is not None
|
||||||
qconnect(a.triggered, lambda b, did=did: self._delete(DeckId(int(did))))
|
qconnect(a.triggered, lambda b, did=did: self._delete(DeckId(int(did))))
|
||||||
gui_hooks.deck_browser_will_show_options_menu(m, int(did))
|
gui_hooks.deck_browser_will_show_options_menu(m, int(did))
|
||||||
m.popup(QCursor.pos())
|
m.popup(QCursor.pos())
|
||||||
|
@ -357,9 +361,9 @@ class DeckBrowser:
|
||||||
).run_in_background()
|
).run_in_background()
|
||||||
|
|
||||||
def _delete(self, did: DeckId) -> None:
|
def _delete(self, did: DeckId) -> None:
|
||||||
deck_name = self.mw.col.decks.find_deck_in_tree(
|
deck = self.mw.col.decks.find_deck_in_tree(self._render_data.tree, did)
|
||||||
self._render_data.tree, did
|
assert deck is not None
|
||||||
).name
|
deck_name = deck.name
|
||||||
remove_decks(
|
remove_decks(
|
||||||
parent=self.mw, deck_ids=[did], deck_name=deck_name
|
parent=self.mw, deck_ids=[did], deck_name=deck_name
|
||||||
).run_in_background()
|
).run_in_background()
|
||||||
|
|
Loading…
Reference in a new issue