diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 639f8cb88..6c3a1434a 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -16,6 +16,7 @@ import anki.find import anki.latex # sets up hook import anki.template from anki import hooks +from anki.backend_pb2 import SearchTerm from anki.cards import Card from anki.config import ConfigManager from anki.consts import * @@ -30,14 +31,11 @@ from anki.rsbackend import ( # pylint: disable=unused-import BackendNoteTypeID, ConcatSeparator, DBError, - DupeIn, - Flag, FormatTimeSpanContext, InvalidInput, NoteIDs, Progress, RustBackend, - SearchTerm, pb, ) from anki.sched import Scheduler as V1Scheduler @@ -789,7 +787,7 @@ table.review-log {{ {revlog_style} }} def dupe_search_term(mid: int, text: str) -> SearchTerm: """Helper function for building a DupeIn message.""" - dupe_in = DupeIn(mid=BackendNoteTypeID(ntid=mid), text=text) + dupe_in = SearchTerm.DupeIn(mid=BackendNoteTypeID(ntid=mid), text=text) return SearchTerm(dupe=dupe_in) diff --git a/pylib/anki/rsbackend.py b/pylib/anki/rsbackend.py index 994285484..15fbde7f5 100644 --- a/pylib/anki/rsbackend.py +++ b/pylib/anki/rsbackend.py @@ -47,9 +47,6 @@ TagTreeNode = pb.TagTreeNode NoteType = pb.NoteType DeckTreeNode = pb.DeckTreeNode StockNoteType = pb.StockNoteType -SearchTerm = pb.SearchTerm -Flag = pb.SearchTerm.Flag -DupeIn = pb.SearchTerm.DupeIn NoteIDs = pb.NoteIDs BackendNoteTypeID = pb.NoteTypeID ConcatSeparator = pb.ConcatenateSearchesIn.Separator diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 9d5f434cf..b4cd6f202 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -13,7 +13,7 @@ from typing import List, Optional, Sequence, Tuple, cast import aqt import aqt.forms from anki.cards import Card -from anki.collection import Collection, Flag, InvalidInput, SearchTerm, nid_search_term +from anki.collection import Collection, InvalidInput, SearchTerm, nid_search_term from anki.consts import * from anki.lang import without_unicode_isolation from anki.models import NoteType @@ -1041,12 +1041,15 @@ QTableView {{ gridline-color: {grid} }} SearchTerm(card_state=SearchTerm.CardState.BURIED), ), None, - (tr(TR.ACTIONS_RED_FLAG), SearchTerm(flag=Flag.RED)), - (tr(TR.ACTIONS_ORANGE_FLAG), SearchTerm(flag=Flag.ORANGE)), - (tr(TR.ACTIONS_GREEN_FLAG), SearchTerm(flag=Flag.GREEN)), - (tr(TR.ACTIONS_BLUE_FLAG), SearchTerm(flag=Flag.BLUE)), - (tr(TR.BROWSING_NO_FLAG), SearchTerm(flag=Flag.WITHOUT)), - (tr(TR.BROWSING_ANY_FLAG), SearchTerm(flag=Flag.ANY)), + (tr(TR.ACTIONS_RED_FLAG), SearchTerm(flag=SearchTerm.Flag.RED)), + ( + tr(TR.ACTIONS_ORANGE_FLAG), + SearchTerm(flag=SearchTerm.Flag.ORANGE), + ), + (tr(TR.ACTIONS_GREEN_FLAG), SearchTerm(flag=SearchTerm.Flag.GREEN)), + (tr(TR.ACTIONS_BLUE_FLAG), SearchTerm(flag=SearchTerm.Flag.BLUE)), + (tr(TR.BROWSING_NO_FLAG), SearchTerm(flag=SearchTerm.Flag.WITHOUT)), + (tr(TR.BROWSING_ANY_FLAG), SearchTerm(flag=SearchTerm.Flag.ANY)), ) ) )