mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 03:53:55 -05:00
Fix: Python undo not updated
This commit is contained in:
parent
2168b7fc1c
commit
f9370eaefa
1 changed files with 23 additions and 3 deletions
|
|
@ -29,7 +29,12 @@ import aqt.main
|
||||||
import aqt.operations
|
import aqt.operations
|
||||||
from anki import hooks
|
from anki import hooks
|
||||||
from anki.cards import Card
|
from anki.cards import Card
|
||||||
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 PlayAVTagsRequest, ReviewerActionRequest
|
from anki.frontend_pb2 import PlayAVTagsRequest, ReviewerActionRequest
|
||||||
from anki.scheduler.v3 import SchedulingStatesWithContext, SetSchedulingStatesRequest
|
from anki.scheduler.v3 import SchedulingStatesWithContext, SetSchedulingStatesRequest
|
||||||
|
|
@ -667,6 +672,7 @@ def next_card_data() -> bytes:
|
||||||
data = NextCardDataResponse.FromString(raw)
|
data = NextCardDataResponse.FromString(raw)
|
||||||
|
|
||||||
av_player.stop_and_clear_queue()
|
av_player.stop_and_clear_queue()
|
||||||
|
aqt.mw.update_undo_actions()
|
||||||
|
|
||||||
if len(data.next_card.queue.cards) == 0:
|
if len(data.next_card.queue.cards) == 0:
|
||||||
card = None
|
card = None
|
||||||
|
|
@ -757,6 +763,20 @@ def reviewer_action():
|
||||||
aqt.mw.taskman.run_on_main(REVIEWER_ACTIONS[req.menu])
|
aqt.mw.taskman.run_on_main(REVIEWER_ACTIONS[req.menu])
|
||||||
|
|
||||||
|
|
||||||
|
def undo_redo(action: str):
|
||||||
|
resp = raw_backend_request(action)()
|
||||||
|
aqt.mw.update_undo_actions()
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
|
def undo():
|
||||||
|
return undo_redo("undo")
|
||||||
|
|
||||||
|
|
||||||
|
def redo():
|
||||||
|
return undo_redo("redo")
|
||||||
|
|
||||||
|
|
||||||
post_handler_list = [
|
post_handler_list = [
|
||||||
congrats_info,
|
congrats_info,
|
||||||
get_deck_configs_for_update,
|
get_deck_configs_for_update,
|
||||||
|
|
@ -776,6 +796,8 @@ post_handler_list = [
|
||||||
next_card_data,
|
next_card_data,
|
||||||
play_avtags,
|
play_avtags,
|
||||||
reviewer_action,
|
reviewer_action,
|
||||||
|
undo,
|
||||||
|
redo,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -786,8 +808,6 @@ exposed_backend_list = [
|
||||||
"set_config_json",
|
"set_config_json",
|
||||||
"get_config_json",
|
"get_config_json",
|
||||||
"get_undo_status",
|
"get_undo_status",
|
||||||
"undo",
|
|
||||||
"redo",
|
|
||||||
# DeckService
|
# DeckService
|
||||||
"get_deck_names",
|
"get_deck_names",
|
||||||
# I18nService
|
# I18nService
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue