mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Merge pull request #1391 from sobjornstad/change_note_type_hook
Add hook for selecting a new note type in the add window
This commit is contained in:
commit
0f48aa4a49
2 changed files with 7 additions and 0 deletions
|
@ -148,6 +148,7 @@ class AddCards(QDialog):
|
|||
self.editor.loadNote(
|
||||
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:
|
||||
note = self._new_note()
|
||||
|
|
|
@ -781,6 +781,12 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
|||
return_type="str",
|
||||
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
|
||||
###################
|
||||
Hook(
|
||||
|
|
Loading…
Reference in a new issue