mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Norm search
This commit is contained in:
parent
5b24d9e4a6
commit
b712053c06
1 changed files with 7 additions and 0 deletions
|
@ -188,6 +188,7 @@ class DataModel(QAbstractTableModel):
|
||||||
ctx = SearchContext(search=txt, browser=self.browser)
|
ctx = SearchContext(search=txt, browser=self.browser)
|
||||||
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.search = self.browser.norm_search(ctx.search)
|
||||||
ctx.card_ids = self.col.find_cards(ctx.search, order=ctx.order)
|
ctx.card_ids = self.col.find_cards(ctx.search, 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
|
||||||
|
@ -818,6 +819,12 @@ class Browser(QMainWindow):
|
||||||
# no row change will fire
|
# no row change will fire
|
||||||
self._onRowChanged(None, None)
|
self._onRowChanged(None, None)
|
||||||
|
|
||||||
|
def norm_search(self, search: str) -> str:
|
||||||
|
normed = self.col.backend.norm_search(search)
|
||||||
|
self._lastSearchTxt = normed
|
||||||
|
self.form.searchEdit.lineEdit().setText(normed)
|
||||||
|
return normed
|
||||||
|
|
||||||
def updateTitle(self):
|
def updateTitle(self):
|
||||||
selected = len(self.form.tableView.selectionModel().selectedRows())
|
selected = len(self.form.tableView.selectionModel().selectedRows())
|
||||||
cur = len(self.model.cards)
|
cur = len(self.model.cards)
|
||||||
|
|
Loading…
Reference in a new issue