mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 03:53:55 -05:00
OpenDialogMenu -> OpenReviewerMenu
This commit is contained in:
parent
38346578ca
commit
7c88768331
3 changed files with 16 additions and 13 deletions
|
|
@ -34,7 +34,7 @@ service FrontendService {
|
||||||
|
|
||||||
// Plays the listed AV tags
|
// Plays the listed AV tags
|
||||||
rpc PlayAVTags(PlayAVTagsRequest) returns (generic.Empty);
|
rpc PlayAVTags(PlayAVTagsRequest) returns (generic.Empty);
|
||||||
rpc openDialogMenu(OpenDialogMenuRequest) returns (generic.Empty);
|
rpc OpenReviewerMenu(openReviewerMenuRequest) returns (generic.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
service BackendFrontendService {}
|
service BackendFrontendService {}
|
||||||
|
|
@ -53,7 +53,7 @@ message PlayAVTagsRequest {
|
||||||
repeated card_rendering.AVTag tags = 1;
|
repeated card_rendering.AVTag tags = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OpenDialogMenuRequest {
|
message openReviewerMenuRequest {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
optional int64 current_card_id = 2;
|
optional int64 current_card_id = 2;
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ from anki import hooks
|
||||||
from anki.cards import Card, CardId
|
from anki.cards import Card, CardId
|
||||||
from anki.collection import OpChanges, OpChangesOnly, Progress, SearchNode
|
from anki.collection import OpChanges, OpChangesOnly, Progress, SearchNode
|
||||||
from anki.decks import UpdateDeckConfigs
|
from anki.decks import UpdateDeckConfigs
|
||||||
from anki.frontend_pb2 import OpenDialogMenuRequest, PlayAVTagsRequest
|
from anki.frontend_pb2 import PlayAVTagsRequest, openReviewerMenuRequest
|
||||||
from anki.scheduler.v3 import SchedulingStatesWithContext, SetSchedulingStatesRequest
|
from anki.scheduler.v3 import SchedulingStatesWithContext, SetSchedulingStatesRequest
|
||||||
from anki.scheduler_pb2 import NextCardDataResponse
|
from anki.scheduler_pb2 import NextCardDataResponse
|
||||||
from anki.template import (
|
from anki.template import (
|
||||||
|
|
@ -706,13 +706,16 @@ def play_avtags():
|
||||||
play_tags(av_tags_to_native(req.tags))
|
play_tags(av_tags_to_native(req.tags))
|
||||||
|
|
||||||
|
|
||||||
def open_dialog_menu():
|
REVIEWER_MENUS = {
|
||||||
req = OpenDialogMenuRequest.FromString(request.data)
|
"EditCurrent": lambda: aqt.mw.taskman.run_on_main(aqt.mw.onEditCurrent),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def open_reviewer_menu():
|
||||||
|
req = openReviewerMenuRequest.FromString(request.data)
|
||||||
if req.HasField("current_card_id"):
|
if req.HasField("current_card_id"):
|
||||||
aqt.mw.reviewer.card = aqt.mw.col.get_card(
|
aqt.mw.reviewer.card = aqt.mw.col.get_card(CardId(req.current_card_id))
|
||||||
CardId(req.current_card_id)
|
REVIEWER_MENUS[req.name]()
|
||||||
)
|
|
||||||
aqt.mw.taskman.run_on_main(lambda: aqt.dialogs.open(req.name, aqt.mw))
|
|
||||||
|
|
||||||
|
|
||||||
post_handler_list = [
|
post_handler_list = [
|
||||||
|
|
@ -733,7 +736,7 @@ post_handler_list = [
|
||||||
save_custom_colours,
|
save_custom_colours,
|
||||||
next_card_data,
|
next_card_data,
|
||||||
play_avtags,
|
play_avtags,
|
||||||
open_dialog_menu,
|
open_reviewer_menu,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ import {
|
||||||
import {
|
import {
|
||||||
buryOrSuspendCards,
|
buryOrSuspendCards,
|
||||||
compareAnswer,
|
compareAnswer,
|
||||||
openDialogMenu,
|
|
||||||
getConfigJson,
|
getConfigJson,
|
||||||
nextCardData,
|
nextCardData,
|
||||||
|
openReviewerMenu,
|
||||||
playAvtags,
|
playAvtags,
|
||||||
redo,
|
redo,
|
||||||
setConfigJson,
|
setConfigJson,
|
||||||
|
|
@ -97,11 +97,11 @@ export class ReviewerState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public displayMenu(name: string) {
|
public displayMenu(name: string) {
|
||||||
openDialogMenu({name, currentCardId: this.currentCard?.card?.id });
|
openReviewerMenu({ name, currentCardId: this.currentCard?.card?.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
public displayEditMenu() {
|
public displayEditMenu() {
|
||||||
this.displayMenu("EditCurrent")
|
this.displayMenu("EditCurrent");
|
||||||
}
|
}
|
||||||
|
|
||||||
public buryCurrentCard() {
|
public buryCurrentCard() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue