mirror of
https://github.com/ankitects/anki.git
synced 2026-01-10 04:23:54 -05:00
DisplayEditMenu -> OpenDialogMenu
This commit is contained in:
parent
f13c27d21d
commit
88756e899b
3 changed files with 19 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 displayEditMenu(DisplayEditMenuRequest) returns (generic.Empty);
|
rpc openDialogMenu(OpenDialogMenuRequest) returns (generic.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
service BackendFrontendService {}
|
service BackendFrontendService {}
|
||||||
|
|
@ -53,6 +53,7 @@ message PlayAVTagsRequest {
|
||||||
repeated card_rendering.AVTag tags = 1;
|
repeated card_rendering.AVTag tags = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DisplayEditMenuRequest {
|
message OpenDialogMenuRequest {
|
||||||
optional int64 cid = 1;
|
string name = 1;
|
||||||
|
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 DisplayEditMenuRequest, PlayAVTagsRequest
|
from anki.frontend_pb2 import OpenDialogMenuRequest, PlayAVTagsRequest
|
||||||
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,12 +706,13 @@ def play_avtags():
|
||||||
play_tags(av_tags_to_native(req.tags))
|
play_tags(av_tags_to_native(req.tags))
|
||||||
|
|
||||||
|
|
||||||
def display_edit_menu():
|
def open_dialog_menu():
|
||||||
req = DisplayEditMenuRequest.FromString(request.data)
|
req = OpenDialogMenuRequest.FromString(request.data)
|
||||||
aqt.mw.reviewer.card = aqt.mw.col.get_card(
|
if req.HasField("current_card_id"):
|
||||||
CardId(req.cid) if req.HasField("cid") else None
|
aqt.mw.reviewer.card = aqt.mw.col.get_card(
|
||||||
)
|
CardId(req.current_card_id)
|
||||||
aqt.mw.taskman.run_on_main(aqt.mw.onEditCurrent)
|
)
|
||||||
|
aqt.mw.taskman.run_on_main(lambda: aqt.dialogs.open(req.name, aqt.mw))
|
||||||
|
|
||||||
|
|
||||||
post_handler_list = [
|
post_handler_list = [
|
||||||
|
|
@ -732,7 +733,7 @@ post_handler_list = [
|
||||||
save_custom_colours,
|
save_custom_colours,
|
||||||
next_card_data,
|
next_card_data,
|
||||||
play_avtags,
|
play_avtags,
|
||||||
display_edit_menu,
|
open_dialog_menu,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {
|
||||||
import {
|
import {
|
||||||
buryOrSuspendCards,
|
buryOrSuspendCards,
|
||||||
compareAnswer,
|
compareAnswer,
|
||||||
displayEditMenu,
|
openDialogMenu,
|
||||||
getConfigJson,
|
getConfigJson,
|
||||||
nextCardData,
|
nextCardData,
|
||||||
playAvtags,
|
playAvtags,
|
||||||
|
|
@ -96,8 +96,12 @@ export class ReviewerState {
|
||||||
this.showQuestion(null);
|
this.showQuestion(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public displayMenu(name: string) {
|
||||||
|
openDialogMenu({name, currentCardId: this.currentCard?.card?.id });
|
||||||
|
}
|
||||||
|
|
||||||
public displayEditMenu() {
|
public displayEditMenu() {
|
||||||
displayEditMenu({ cid: this.currentCard?.card?.id });
|
this.displayMenu("EditCurrent")
|
||||||
}
|
}
|
||||||
|
|
||||||
public buryCurrentCard() {
|
public buryCurrentCard() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue