Add three filtered deck dialog hooks
Similar to deckconf hooks
This commit is contained in:
parent
4b5944f181
commit
713c8f619d
@ -10,6 +10,7 @@ from anki.errors import SearchError
|
||||
from anki.lang import without_unicode_isolation
|
||||
from anki.scheduler import FilteredDeckForUpdate
|
||||
from aqt import AnkiQt, colors
|
||||
from aqt import gui_hooks
|
||||
from aqt.qt import *
|
||||
from aqt.scheduling_ops import add_or_update_filtered_deck
|
||||
from aqt.theme import theme_manager
|
||||
@ -156,6 +157,8 @@ class FilteredDeckConfigDialog(QDialog):
|
||||
without_unicode_isolation(tr(TR.ACTIONS_OPTIONS_FOR, val=self.deck.name))
|
||||
)
|
||||
|
||||
gui_hooks.filtered_deck_dialog_did_load_deck(self, deck)
|
||||
|
||||
def reopen(
|
||||
self,
|
||||
_mw: AnkiQt,
|
||||
@ -300,10 +303,13 @@ class FilteredDeckConfigDialog(QDialog):
|
||||
return
|
||||
|
||||
def success(out: OpChangesWithCount) -> None:
|
||||
gui_hooks.filtered_deck_dialog_did_add_or_update_deck(self, self.deck)
|
||||
saveGeom(self, self.GEOMETRY_KEY)
|
||||
aqt.dialogs.markClosed(self.DIALOG_KEY)
|
||||
QDialog.accept(self)
|
||||
|
||||
gui_hooks.filtered_deck_dialog_will_add_or_update_deck(self, self.deck)
|
||||
|
||||
add_or_update_filtered_deck(mw=self.mw, deck=self.deck, success=success)
|
||||
|
||||
# Step load/save
|
||||
|
@ -284,6 +284,32 @@ hooks = [
|
||||
],
|
||||
doc="Called before config group is renamed",
|
||||
),
|
||||
# Filtered deck options
|
||||
###################
|
||||
Hook(
|
||||
name="filtered_deck_dialog_did_load_deck",
|
||||
args=[
|
||||
"filtered_deck_dialog: aqt.filtered_deck.FilteredDeckConfigDialog",
|
||||
"filtered_deck: anki.scheduler.FilteredDeckForUpdate",
|
||||
],
|
||||
doc="Allows updating widget state once the filtered deck config is loaded",
|
||||
),
|
||||
Hook(
|
||||
name="filtered_deck_dialog_will_add_or_update_deck",
|
||||
args=[
|
||||
"filtered_deck_dialog: aqt.filtered_deck.FilteredDeckConfigDialog",
|
||||
"filtered_deck: anki.scheduler.FilteredDeckForUpdate",
|
||||
],
|
||||
doc="Allows modifying the filtered deck config object before it is written",
|
||||
),
|
||||
Hook(
|
||||
name="filtered_deck_dialog_did_add_or_update_deck",
|
||||
args=[
|
||||
"filtered_deck_dialog: aqt.filtered_deck.FilteredDeckConfigDialog",
|
||||
"filtered_deck: anki.scheduler.FilteredDeckForUpdate",
|
||||
],
|
||||
doc="Allows performing changes after a filtered deck has been added or updated",
|
||||
),
|
||||
# Browser
|
||||
###################
|
||||
Hook(
|
||||
|
Loading…
Reference in New Issue
Block a user