Use backend nid filter in browser
This commit is contained in:
parent
bc52a54dfc
commit
407358ab68
@ -35,6 +35,7 @@ from anki.rsbackend import ( # pylint: disable=unused-import
|
||||
FormatTimeSpanContext,
|
||||
InvalidInput,
|
||||
NamedFilter,
|
||||
NoteIDs,
|
||||
Progress,
|
||||
RustBackend,
|
||||
pb,
|
||||
@ -503,6 +504,7 @@ class Collection:
|
||||
forgot_in: Optional[int] = None,
|
||||
added_in: Optional[int] = None,
|
||||
due_in: Optional[int] = None,
|
||||
nids: Optional[List[int]] = None,
|
||||
) -> str:
|
||||
filters = searches or []
|
||||
|
||||
@ -528,6 +530,8 @@ class Collection:
|
||||
append_filter(FilterToSearchIn(added_in=added_in))
|
||||
if due_in:
|
||||
append_filter(FilterToSearchIn(due_in=due_in))
|
||||
if nids:
|
||||
append_filter(FilterToSearchIn(nids=NoteIDs(nids=nids)))
|
||||
if concat_by_or:
|
||||
sep = ConcatSeparator.OR
|
||||
else:
|
||||
|
@ -50,6 +50,7 @@ StockNoteType = pb.StockNoteType
|
||||
FilterToSearchIn = pb.FilterToSearchIn
|
||||
NamedFilter = pb.FilterToSearchIn.NamedFilter
|
||||
DupeIn = pb.FilterToSearchIn.DupeIn
|
||||
NoteIDs = pb.NoteIDs
|
||||
BackendNoteTypeID = pb.NoteTypeID
|
||||
ConcatSeparator = pb.ConcatenateSearchesIn.Separator
|
||||
SyncAuth = pb.SyncAuth
|
||||
|
@ -659,7 +659,7 @@ class Browser(QMainWindow):
|
||||
c = self.card = self.mw.reviewer.card
|
||||
nid = c and c.nid or 0
|
||||
if nid:
|
||||
search = "nid:%d" % nid
|
||||
search = self.col.search_string(nids=[nid])
|
||||
search = gui_hooks.default_search(search, c)
|
||||
self.model.search(search)
|
||||
self.focusCid(c.id)
|
||||
@ -1494,7 +1494,7 @@ where id in %s"""
|
||||
tv = self.form.tableView
|
||||
tv.selectionModel().clear()
|
||||
|
||||
search = "nid:" + ",".join([str(x) for x in nids])
|
||||
search = self.col.search_string(nids=nids)
|
||||
self.search_for(search)
|
||||
|
||||
tv.selectAll()
|
||||
@ -1705,7 +1705,7 @@ where id in %s"""
|
||||
t += (
|
||||
"""<li><a href=# onclick="pycmd('%s');return false;">%s</a>: %s</a>"""
|
||||
% (
|
||||
"nid:" + ",".join(str(id) for id in nids),
|
||||
self.col.search_string(nids=nids).replace('"', '"'),
|
||||
tr(TR.BROWSING_NOTE_COUNT, count=len(nids)),
|
||||
html.escape(val),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user