mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
Allow choosing filtered decks in stats (#3687)
* add optional passthru param dyn to DeckChooser * include filtered decks when choosing decks in stats
This commit is contained in:
parent
7fa544df9b
commit
5a7a9090b6
2 changed files with 5 additions and 1 deletions
|
@ -21,10 +21,12 @@ class DeckChooser(QHBoxLayout):
|
|||
label: bool = True,
|
||||
starting_deck_id: DeckId | None = None,
|
||||
on_deck_changed: Callable[[int], None] | None = None,
|
||||
dyn: bool = False,
|
||||
) -> None:
|
||||
QHBoxLayout.__init__(self)
|
||||
self._widget = widget # type: ignore
|
||||
self.mw = mw
|
||||
self.dyn = dyn
|
||||
self._setup_ui(show_label=label)
|
||||
|
||||
self._selected_deck_id = DeckId(0)
|
||||
|
@ -78,7 +80,7 @@ class DeckChooser(QHBoxLayout):
|
|||
|
||||
def _ensure_selected_deck_valid(self) -> None:
|
||||
deck = self.mw.col.decks.get(self._selected_deck_id, default=False)
|
||||
if not deck or deck["dyn"]:
|
||||
if not deck or (not self.dyn and deck["dyn"]):
|
||||
self.selected_deck_id = DEFAULT_DECK_ID
|
||||
|
||||
def _update_button_label(self) -> None:
|
||||
|
@ -117,6 +119,7 @@ class DeckChooser(QHBoxLayout):
|
|||
parent=self._widget,
|
||||
geomKey="selectDeck",
|
||||
callback=callback,
|
||||
dyn=self.dyn,
|
||||
)
|
||||
|
||||
def on_operation_did_execute(
|
||||
|
|
|
@ -56,6 +56,7 @@ class NewDeckStats(QDialog):
|
|||
self.mw,
|
||||
f.deckArea,
|
||||
on_deck_changed=self.on_deck_changed,
|
||||
dyn=True, # include filtered decks
|
||||
)
|
||||
|
||||
b = f.buttonBox.addButton(
|
||||
|
|
Loading…
Reference in a new issue