allow customizing search order

This commit is contained in:
Damien Elmes 2020-03-21 17:38:09 +10:00
parent dfa7f5e142
commit 99416477ac

View File

@ -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: