mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Add reviewer suspend and bury hooks (#1967)
* Add reviewer suspend and bury hooks * Empty commit * Change my name in CONTRIBUTORS
This commit is contained in:
parent
0c3a7a88d3
commit
d7d9f51b68
3 changed files with 21 additions and 1 deletions
|
@ -104,7 +104,7 @@ wisherhxl <wisherhxl@gmail.com>
|
||||||
dobefore <1432338032@qq.com>
|
dobefore <1432338032@qq.com>
|
||||||
Bart Louwers <bart.git@emeel.net>
|
Bart Louwers <bart.git@emeel.net>
|
||||||
Sam Penny <github.com/sam1penny>
|
Sam Penny <github.com/sam1penny>
|
||||||
Mateus Etto <mateus.etto@gmail.com>
|
Yutsuten <mateus.etto@gmail.com>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -1051,23 +1051,27 @@ time = %(time)d;
|
||||||
op.run_in_background()
|
op.run_in_background()
|
||||||
|
|
||||||
def suspend_current_note(self) -> None:
|
def suspend_current_note(self) -> None:
|
||||||
|
gui_hooks.reviewer_will_suspend_note(self.card.nid)
|
||||||
suspend_note(
|
suspend_note(
|
||||||
parent=self.mw,
|
parent=self.mw,
|
||||||
note_ids=[self.card.nid],
|
note_ids=[self.card.nid],
|
||||||
).success(lambda _: tooltip(tr.studying_note_suspended())).run_in_background()
|
).success(lambda _: tooltip(tr.studying_note_suspended())).run_in_background()
|
||||||
|
|
||||||
def suspend_current_card(self) -> None:
|
def suspend_current_card(self) -> None:
|
||||||
|
gui_hooks.reviewer_will_suspend_card(self.card.id)
|
||||||
suspend_cards(
|
suspend_cards(
|
||||||
parent=self.mw,
|
parent=self.mw,
|
||||||
card_ids=[self.card.id],
|
card_ids=[self.card.id],
|
||||||
).success(lambda _: tooltip(tr.studying_card_suspended())).run_in_background()
|
).success(lambda _: tooltip(tr.studying_card_suspended())).run_in_background()
|
||||||
|
|
||||||
def bury_current_note(self) -> None:
|
def bury_current_note(self) -> None:
|
||||||
|
gui_hooks.reviewer_will_bury_note(self.card.nid)
|
||||||
bury_notes(parent=self.mw, note_ids=[self.card.nid],).success(
|
bury_notes(parent=self.mw, note_ids=[self.card.nid],).success(
|
||||||
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
|
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
|
||||||
).run_in_background()
|
).run_in_background()
|
||||||
|
|
||||||
def bury_current_card(self) -> None:
|
def bury_current_card(self) -> None:
|
||||||
|
gui_hooks.reviewer_will_bury_card(self.card.id)
|
||||||
bury_cards(parent=self.mw, card_ids=[self.card.id],).success(
|
bury_cards(parent=self.mw, card_ids=[self.card.id],).success(
|
||||||
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
|
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
|
||||||
).run_in_background()
|
).run_in_background()
|
||||||
|
|
|
@ -198,6 +198,22 @@ hooks = [
|
||||||
return_type="str",
|
return_type="str",
|
||||||
doc="""Used to inspect and modify a recording recorded by "Record Own Voice" before replaying.""",
|
doc="""Used to inspect and modify a recording recorded by "Record Own Voice" before replaying.""",
|
||||||
),
|
),
|
||||||
|
Hook(
|
||||||
|
name="reviewer_will_suspend_note",
|
||||||
|
args=["nid: int"],
|
||||||
|
),
|
||||||
|
Hook(
|
||||||
|
name="reviewer_will_suspend_card",
|
||||||
|
args=["id: int"],
|
||||||
|
),
|
||||||
|
Hook(
|
||||||
|
name="reviewer_will_bury_note",
|
||||||
|
args=["nid: int"],
|
||||||
|
),
|
||||||
|
Hook(
|
||||||
|
name="reviewer_will_bury_card",
|
||||||
|
args=["id: int"],
|
||||||
|
),
|
||||||
# Debug
|
# Debug
|
||||||
###################
|
###################
|
||||||
Hook(
|
Hook(
|
||||||
|
|
Loading…
Reference in a new issue