mirror of
https://github.com/ankitects/anki.git
synced 2026-01-14 06:23:57 -05:00
Search_model has context
I have an add-on which allow to open multiple windows. So would like to know which browser has done the search. This would allow me to have browser with various setting. In particular, I've an add-on which allow to show a single line by note, and I would like for some browser to have this feature on and for some other to have this feature off.
This commit is contained in:
parent
2c500a1538
commit
e3e929fed2
1 changed files with 2 additions and 1 deletions
|
|
@ -70,6 +70,7 @@ class FindDupesDialog:
|
|||
@dataclass
|
||||
class SearchContext:
|
||||
search: str
|
||||
browser: Browser
|
||||
order: Union[bool, str] = True
|
||||
# if set, provided card ids will be used instead of the regular search
|
||||
card_ids: Optional[Sequence[int]] = None
|
||||
|
|
@ -181,7 +182,7 @@ class DataModel(QAbstractTableModel):
|
|||
self.cards = []
|
||||
error_message: Optional[str] = None
|
||||
try:
|
||||
ctx = SearchContext(search=txt)
|
||||
ctx = SearchContext(search=txt, browser=self.browser)
|
||||
gui_hooks.browser_will_search(ctx)
|
||||
if ctx.card_ids is None:
|
||||
ctx.card_ids = self.col.find_cards(ctx.search, order=ctx.order)
|
||||
|
|
|
|||
Loading…
Reference in a new issue