diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 32c556e9f..52a4f2246 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -997,7 +997,7 @@ QTableView {{ gridline-color: {grid} }} tr(TR.BROWSING_AGAIN_TODAY), SearchTerm( rated=SearchTerm.Rated( - days=1, rating=SearchTerm.Rating.ANSWER_BUTTON_1 + days=1, rating=SearchTerm.RATING_AGAIN ) ), ), @@ -1013,39 +1013,39 @@ QTableView {{ gridline-color: {grid} }} ( ( tr(TR.ACTIONS_NEW), - SearchTerm(card_state=SearchTerm.CardState.NEW), + SearchTerm(card_state=SearchTerm.CARD_STATE_NEW), ), ( tr(TR.SCHEDULING_LEARNING), - SearchTerm(card_state=SearchTerm.CardState.LEARN), + SearchTerm(card_state=SearchTerm.CARD_STATE_LEARN), ), ( tr(TR.SCHEDULING_REVIEW), - SearchTerm(card_state=SearchTerm.CardState.REVIEW), + SearchTerm(card_state=SearchTerm.CARD_STATE_REVIEW), ), ( tr(TR.FILTERING_IS_DUE), - SearchTerm(card_state=SearchTerm.CardState.DUE), + SearchTerm(card_state=SearchTerm.CARD_STATE_DUE), ), None, ( tr(TR.BROWSING_SUSPENDED), - SearchTerm(card_state=SearchTerm.CardState.SUSPENDED), + SearchTerm(card_state=SearchTerm.CARD_STATE_SUSPENDED), ), ( tr(TR.BROWSING_BURIED), - SearchTerm(card_state=SearchTerm.CardState.BURIED), + SearchTerm(card_state=SearchTerm.CARD_STATE_BURIED), ), None, - (tr(TR.ACTIONS_RED_FLAG), SearchTerm(flag=SearchTerm.Flag.RED)), + (tr(TR.ACTIONS_RED_FLAG), SearchTerm(flag=SearchTerm.FLAG_RED)), ( tr(TR.ACTIONS_ORANGE_FLAG), - SearchTerm(flag=SearchTerm.Flag.ORANGE), + 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)), + (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_NONE)), + (tr(TR.BROWSING_ANY_FLAG), SearchTerm(flag=SearchTerm.FLAG_ANY)), ) ) ) diff --git a/qt/aqt/customstudy.py b/qt/aqt/customstudy.py index 335689506..c752f24fc 100644 --- a/qt/aqt/customstudy.py +++ b/qt/aqt/customstudy.py @@ -163,7 +163,7 @@ class CustomStudy(QDialog): search = self.mw.col.build_search_string( SearchTerm( rated=SearchTerm.Rated( - days=spin, rating=SearchTerm.Rating.ANSWER_BUTTON_1 + days=spin, rating=SearchTerm.RATING_AGAIN ) ) ) @@ -175,7 +175,7 @@ class CustomStudy(QDialog): dyn["resched"] = True elif i == RADIO_PREVIEW: search = self.mw.col.build_search_string( - SearchTerm(card_state=SearchTerm.CardState.NEW), + SearchTerm(card_state=SearchTerm.CARD_STATE_NEW), SearchTerm(added_in_days=spin), ) dyn["terms"][0] = [search, DYN_MAX_SIZE, DYN_OLDEST] @@ -184,19 +184,19 @@ class CustomStudy(QDialog): type = f.cardType.currentRow() if type == TYPE_NEW: terms = self.mw.col.build_search_string( - SearchTerm(card_state=SearchTerm.CardState.NEW) + SearchTerm(card_state=SearchTerm.CARD_STATE_NEW) ) ord = DYN_ADDED dyn["resched"] = True elif type == TYPE_DUE: terms = self.mw.col.build_search_string( - SearchTerm(card_state=SearchTerm.CardState.DUE) + SearchTerm(card_state=SearchTerm.CARD_STATE_DUE) ) ord = DYN_DUE dyn["resched"] = True elif type == TYPE_REVIEW: terms = self.mw.col.build_search_string( - SearchTerm(card_state=SearchTerm.CardState.NEW), negate=True + SearchTerm(card_state=SearchTerm.CARD_STATE_NEW), negate=True ) ord = DYN_RANDOM dyn["resched"] = True diff --git a/qt/aqt/dyndeckconf.py b/qt/aqt/dyndeckconf.py index 1ea32670f..c9d0d6338 100644 --- a/qt/aqt/dyndeckconf.py +++ b/qt/aqt/dyndeckconf.py @@ -48,11 +48,11 @@ class DeckConf(QDialog): self.loadConf() if search: search = self.mw.col.build_search_string( - search, SearchTerm(card_state=SearchTerm.CardState.DUE) + search, SearchTerm(card_state=SearchTerm.CARD_STATE_DUE) ) self.form.search.setText(search) search_2 = self.mw.col.build_search_string( - search, SearchTerm(card_state=SearchTerm.CardState.NEW) + search, SearchTerm(card_state=SearchTerm.CARD_STATE_NEW) ) self.form.search_2.setText(search_2) self.form.search.selectAll() diff --git a/rslib/backend.proto b/rslib/backend.proto index d3d023f7a..19d1bab13 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -766,32 +766,32 @@ message SearchTerm { string first_field = 2; } enum Flag { - WITHOUT = 0; - ANY = 1; - RED = 2; - ORANGE = 3; - GREEN = 4; - BLUE = 5; + FLAG_NONE = 0; + FLAG_ANY = 1; + FLAG_RED = 2; + FLAG_ORANGE = 3; + FLAG_GREEN = 4; + FLAG_BLUE = 5; } enum Rating { - ANY_ANSWER_BUTTON = 0; - ANSWER_BUTTON_1 = 1; - ANSWER_BUTTON_2 = 2; - ANSWER_BUTTON_3 = 3; - ANSWER_BUTTON_4 = 4; - MANUAL_RESCHEDULE = 5; + RATING_ANY = 0; + RATING_AGAIN = 1; + RATING_HARD = 2; + RATING_GOOD = 3; + RATING_EASY = 4; + RATING_BY_RESCHEDULE = 5; } message Rated { uint32 days = 1; Rating rating = 2; } enum CardState { - NEW = 0; - LEARN = 1; - REVIEW = 2; - DUE = 3; - SUSPENDED = 4; - BURIED = 5; + CARD_STATE_NEW = 0; + CARD_STATE_LEARN = 1; + CARD_STATE_REVIEW = 2; + CARD_STATE_DUE = 3; + CARD_STATE_SUSPENDED = 4; + CARD_STATE_BURIED = 5; } message IdList { repeated int64 ids = 1; diff --git a/rslib/src/backend/mod.rs b/rslib/src/backend/mod.rs index 2bd5f5a96..62bf0f341 100644 --- a/rslib/src/backend/mod.rs +++ b/rslib/src/backend/mod.rs @@ -335,7 +335,7 @@ impl From for Node<'_> { .into(), )), Filter::Flag(flag) => match Flag::from_i32(flag).unwrap_or(Flag::Any) { - Flag::Without => Node::Search(SearchNode::Flag(0)), + Flag::None => Node::Search(SearchNode::Flag(0)), Flag::Any => Node::Not(Box::new(Node::Search(SearchNode::Flag(0)))), Flag::Red => Node::Search(SearchNode::Flag(1)), Flag::Orange => Node::Search(SearchNode::Flag(2)), @@ -358,12 +358,12 @@ impl From for BoolSeparator { impl From for EaseKind { fn from(r: pb::search_term::Rating) -> Self { match r { - pb::search_term::Rating::AnswerButton1 => EaseKind::AnswerButton(1), - pb::search_term::Rating::AnswerButton2 => EaseKind::AnswerButton(2), - pb::search_term::Rating::AnswerButton3 => EaseKind::AnswerButton(3), - pb::search_term::Rating::AnswerButton4 => EaseKind::AnswerButton(4), - pb::search_term::Rating::AnyAnswerButton => EaseKind::AnyAnswerButton, - pb::search_term::Rating::ManualReschedule => EaseKind::ManualReschedule, + pb::search_term::Rating::Again => EaseKind::AnswerButton(1), + pb::search_term::Rating::Hard => EaseKind::AnswerButton(2), + pb::search_term::Rating::Good => EaseKind::AnswerButton(3), + pb::search_term::Rating::Easy => EaseKind::AnswerButton(4), + pb::search_term::Rating::Any => EaseKind::AnyAnswerButton, + pb::search_term::Rating::ByReschedule => EaseKind::ManualReschedule, } } }