mirror of
https://github.com/ankitects/anki.git
synced 2025-12-12 22:36:55 -05:00
allow customizing search order
This commit is contained in:
parent
dfa7f5e142
commit
99416477ac
1 changed files with 2 additions and 1 deletions
|
|
@ -72,6 +72,7 @@ class FindDupesDialog:
|
||||||
@dataclass
|
@dataclass
|
||||||
class SearchContext:
|
class SearchContext:
|
||||||
search: str
|
search: str
|
||||||
|
order: Union[bool, str] = True
|
||||||
# if set, provided card ids will be used instead of the regular search
|
# if set, provided card ids will be used instead of the regular search
|
||||||
card_ids: Optional[Sequence[int]] = None
|
card_ids: Optional[Sequence[int]] = None
|
||||||
|
|
||||||
|
|
@ -184,7 +185,7 @@ class DataModel(QAbstractTableModel):
|
||||||
ctx = SearchContext(search=txt)
|
ctx = SearchContext(search=txt)
|
||||||
gui_hooks.browser_will_search(ctx)
|
gui_hooks.browser_will_search(ctx)
|
||||||
if ctx.card_ids is None:
|
if ctx.card_ids is None:
|
||||||
ctx.card_ids = self.col.find_cards(txt)
|
ctx.card_ids = self.col.find_cards(txt, order=ctx.order)
|
||||||
gui_hooks.browser_did_search(ctx)
|
gui_hooks.browser_did_search(ctx)
|
||||||
self.cards = ctx.card_ids
|
self.cards = ctx.card_ids
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue