make decks root search collection; move current deck

Also use explicit 'deck:*' search, to make it more obvious what is
happening
This commit is contained in:
Damien Elmes 2021-02-08 22:48:45 +10:00
parent a8ddb65e1c
commit 05074f2cc1
2 changed files with 14 additions and 7 deletions

View File

@ -591,12 +591,6 @@ class SidebarTreeView(QTreeView):
type = SidebarItemType.FLAG
search = self._filter_func
root.add_simple(
TR.BROWSING_CURRENT_DECK,
icon=icon,
type=type,
on_click=search(SearchTerm(deck="current")),
)
root.add_simple(
name=TR.BROWSING_SIDEBAR_DUE_TODAY,
icon=icon,
@ -814,6 +808,14 @@ class SidebarTreeView(QTreeView):
collapse_key=Config.Bool.COLLAPSE_DECKS,
type=SidebarItemType.DECK_ROOT,
)
root.on_click = self._filter_func(SearchTerm(deck="*"))
root.add_simple(
name=tr(TR.BROWSING_CURRENT_DECK),
icon=icon,
type=SidebarItemType.DECK,
on_click=self._filter_func(SearchTerm(deck="current")),
)
render(root, tree.children)
# Tree: Notetypes

View File

@ -304,7 +304,12 @@ impl From<pb::SearchTerm> for Node<'_> {
escape_anki_wildcards(&s).into_owned().into(),
)),
Filter::Deck(s) => Node::Search(SearchNode::Deck(
escape_anki_wildcards(&s).into_owned().into(),
if s == "*" {
s
} else {
escape_anki_wildcards(&s).into_owned()
}
.into(),
)),
Filter::Note(s) => Node::Search(SearchNode::NoteType(
escape_anki_wildcards(&s).into_owned().into(),