From 99416477acc0ef13d4203e32c450a854725ddcf7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 21 Mar 2020 17:38:09 +1000 Subject: [PATCH] allow customizing search order --- qt/aqt/browser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 6fec53a00..4c38a70ec 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -72,6 +72,7 @@ class FindDupesDialog: @dataclass class SearchContext: search: str + order: Union[bool, str] = True # if set, provided card ids will be used instead of the regular search card_ids: Optional[Sequence[int]] = None @@ -184,7 +185,7 @@ class DataModel(QAbstractTableModel): ctx = SearchContext(search=txt) gui_hooks.browser_will_search(ctx) 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) self.cards = ctx.card_ids except Exception as e: