mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Add hook after selecting a new note type in the add window
This commit is contained in:
parent
94c4f99343
commit
67f9fc519e
2 changed files with 7 additions and 0 deletions
|
@ -148,6 +148,7 @@ class AddCards(QDialog):
|
||||||
self.editor.loadNote(
|
self.editor.loadNote(
|
||||||
focusTo=min(self.editor.last_field_index or 0, len(new.fields) - 1)
|
focusTo=min(self.editor.last_field_index or 0, len(new.fields) - 1)
|
||||||
)
|
)
|
||||||
|
gui_hooks.add_cards_did_change_note_type(old.note_type(), new.note_type())
|
||||||
|
|
||||||
def _load_new_note(self, sticky_fields_from: Optional[Note] = None) -> None:
|
def _load_new_note(self, sticky_fields_from: Optional[Note] = None) -> None:
|
||||||
note = self._new_note()
|
note = self._new_note()
|
||||||
|
|
|
@ -781,6 +781,12 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
||||||
return_type="str",
|
return_type="str",
|
||||||
doc="""Allows changing the history line in the add-card window.""",
|
doc="""Allows changing the history line in the add-card window.""",
|
||||||
),
|
),
|
||||||
|
Hook(
|
||||||
|
name="add_cards_did_change_note_type",
|
||||||
|
args=["old: anki.models.NoteType", "new: anki.models.NoteType"],
|
||||||
|
doc="""Executed after the user selects a new note type when adding
|
||||||
|
cards.""",
|
||||||
|
),
|
||||||
# Editing
|
# Editing
|
||||||
###################
|
###################
|
||||||
Hook(
|
Hook(
|
||||||
|
|
Loading…
Reference in a new issue