2020-01-13 05:38:05 +01:00
|
|
|
# Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
|
|
|
"""
|
|
|
|
See pylib/tools/genhooks.py for more info.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
2020-01-15 00:11:20 +01:00
|
|
|
import sys
|
2020-01-13 05:38:05 +01:00
|
|
|
|
2020-01-15 00:11:20 +01:00
|
|
|
pylib = os.path.join(os.path.dirname(__file__), "..", "..", "pylib")
|
|
|
|
sys.path.append(pylib)
|
|
|
|
|
|
|
|
from tools.hookslib import Hook, update_file
|
2020-01-13 05:38:05 +01:00
|
|
|
|
|
|
|
# Hook list
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
hooks = [
|
2020-01-15 04:03:11 +01:00
|
|
|
# Reviewing
|
|
|
|
###################
|
2020-02-08 06:31:41 +01:00
|
|
|
Hook(
|
|
|
|
name="overview_did_refresh",
|
|
|
|
args=["overview: aqt.overview.Overview"],
|
|
|
|
doc="""Allow to update the overview window. E.g. add the deck name in the
|
|
|
|
title.""",
|
|
|
|
),
|
2020-02-17 16:49:21 +01:00
|
|
|
Hook(
|
|
|
|
name="overview_will_render_content",
|
|
|
|
args=[
|
|
|
|
"overview: aqt.overview.Overview",
|
|
|
|
"content: aqt.overview.OverviewContent",
|
|
|
|
],
|
|
|
|
doc="""Used to modify HTML content sections in the overview body
|
|
|
|
|
|
|
|
'content' contains the sections of HTML content the overview body
|
|
|
|
will be updated with.
|
|
|
|
|
|
|
|
When modifying the content of a particular section, please make sure your
|
|
|
|
changes only perform the minimum required edits to make your add-on work.
|
|
|
|
You should avoid overwriting or interfering with existing data as much
|
|
|
|
as possible, instead opting to append your own changes, e.g.:
|
|
|
|
|
|
|
|
def on_overview_will_render_content(overview, content):
|
|
|
|
content.table += "\n<div>my html</div>"
|
|
|
|
""",
|
|
|
|
),
|
2020-02-08 06:31:41 +01:00
|
|
|
Hook(
|
|
|
|
name="deck_browser_did_render",
|
|
|
|
args=["deck_browser: aqt.deckbrowser.DeckBrowser"],
|
|
|
|
doc="""Allow to update the deck browser window. E.g. change its title.""",
|
|
|
|
),
|
2020-02-16 19:29:01 +01:00
|
|
|
Hook(
|
2020-02-17 16:26:21 +01:00
|
|
|
name="deck_browser_will_render_content",
|
2020-02-16 19:29:01 +01:00
|
|
|
args=[
|
|
|
|
"deck_browser: aqt.deckbrowser.DeckBrowser",
|
2020-02-17 16:26:21 +01:00
|
|
|
"content: aqt.deckbrowser.DeckBrowserContent",
|
2020-02-16 19:29:01 +01:00
|
|
|
],
|
|
|
|
doc="""Used to modify HTML content sections in the deck browser body
|
|
|
|
|
2020-02-17 16:26:21 +01:00
|
|
|
'content' contains the sections of HTML content the deck browser body
|
|
|
|
will be updated with.
|
2020-02-16 19:29:01 +01:00
|
|
|
|
2020-02-17 16:26:21 +01:00
|
|
|
When modifying the content of a particular section, please make sure your
|
|
|
|
changes only perform the minimum required edits to make your add-on work.
|
|
|
|
You should avoid overwriting or interfering with existing data as much
|
|
|
|
as possible, instead opting to append your own changes, e.g.:
|
2020-02-16 19:29:01 +01:00
|
|
|
|
2020-02-17 16:26:21 +01:00
|
|
|
def on_deck_browser_will_render_content(deck_browser, content):
|
|
|
|
content.stats += "\n<div>my html</div>"
|
2020-02-16 19:29:01 +01:00
|
|
|
""",
|
|
|
|
),
|
2020-01-13 09:37:08 +01:00
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="reviewer_did_show_question",
|
2020-01-13 09:37:08 +01:00
|
|
|
args=["card: Card"],
|
|
|
|
legacy_hook="showQuestion",
|
|
|
|
legacy_no_args=True,
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="reviewer_did_show_answer",
|
2020-01-13 09:37:08 +01:00
|
|
|
args=["card: Card"],
|
|
|
|
legacy_hook="showAnswer",
|
|
|
|
legacy_no_args=True,
|
|
|
|
),
|
2020-01-24 15:36:05 +01:00
|
|
|
Hook(
|
|
|
|
name="reviewer_will_answer_card",
|
|
|
|
args=[
|
|
|
|
"ease_tuple: Tuple[bool, int]",
|
2020-01-24 15:48:05 +01:00
|
|
|
"reviewer: aqt.reviewer.Reviewer",
|
|
|
|
"card: Card",
|
2020-01-24 15:36:05 +01:00
|
|
|
],
|
|
|
|
return_type="Tuple[bool, int]",
|
|
|
|
doc="""Used to modify the ease at which a card is rated or to bypass
|
|
|
|
rating the card completely.
|
|
|
|
|
|
|
|
ease_tuple is a tuple consisting of a boolean expressing whether the reviewer
|
|
|
|
should continue with rating the card, and an integer expressing the ease at
|
|
|
|
which the card should be rated.
|
|
|
|
|
|
|
|
If your code just needs to be notified of the card rating event, you should use
|
|
|
|
the reviewer_did_answer_card hook instead.""",
|
|
|
|
),
|
|
|
|
Hook(
|
|
|
|
name="reviewer_did_answer_card",
|
|
|
|
args=["reviewer: aqt.reviewer.Reviewer", "card: Card", "ease: int"],
|
|
|
|
),
|
2020-01-14 23:53:57 +01:00
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="reviewer_will_show_context_menu",
|
2020-01-15 04:03:11 +01:00
|
|
|
args=["reviewer: aqt.reviewer.Reviewer", "menu: QMenu"],
|
|
|
|
legacy_hook="Reviewer.contextMenuEvent",
|
|
|
|
),
|
|
|
|
Hook(
|
|
|
|
name="reviewer_will_end",
|
|
|
|
legacy_hook="reviewCleanup",
|
|
|
|
doc="Called before Anki transitions from the review screen to another screen.",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="card_will_show",
|
2020-01-15 04:03:11 +01:00
|
|
|
args=["text: str", "card: Card", "kind: str"],
|
|
|
|
return_type="str",
|
|
|
|
legacy_hook="prepareQA",
|
|
|
|
doc="Can modify card text before review/preview.",
|
2020-01-14 23:53:57 +01:00
|
|
|
),
|
2020-02-24 13:42:30 +01:00
|
|
|
# Deck options
|
|
|
|
###################
|
2020-02-24 15:29:23 +01:00
|
|
|
Hook(
|
|
|
|
name="deck_conf_did_setup_ui_form",
|
|
|
|
args=["deck_conf: aqt.deckconf.DeckConf"],
|
|
|
|
doc="Allows modifying or adding widgets in the deck options UI form",
|
|
|
|
),
|
2020-02-24 13:42:30 +01:00
|
|
|
Hook(
|
|
|
|
name="deck_conf_will_show",
|
|
|
|
args=["deck_conf: aqt.deckconf.DeckConf"],
|
|
|
|
doc="Allows modifying the deck options dialog before it is shown",
|
|
|
|
),
|
|
|
|
Hook(
|
|
|
|
name="deck_conf_did_load_config",
|
|
|
|
args=["deck_conf: aqt.deckconf.DeckConf", "config: Any"],
|
|
|
|
doc="Called once widget state has been set from deck config",
|
|
|
|
),
|
|
|
|
Hook(
|
|
|
|
name="deck_conf_will_save_config",
|
|
|
|
args=["deck_conf: aqt.deckconf.DeckConf", "config: Any", "deck: Any"],
|
|
|
|
doc="Called before widget state is saved to config",
|
|
|
|
),
|
2020-01-15 04:03:11 +01:00
|
|
|
# Browser
|
|
|
|
###################
|
2020-01-14 23:53:57 +01:00
|
|
|
Hook(
|
2020-01-15 08:18:11 +01:00
|
|
|
name="browser_menus_did_init",
|
2020-01-14 23:53:57 +01:00
|
|
|
args=["browser: aqt.browser.Browser"],
|
|
|
|
legacy_hook="browser.setupMenus",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="browser_will_show_context_menu",
|
2020-01-14 23:53:57 +01:00
|
|
|
args=["browser: aqt.browser.Browser", "menu: QMenu"],
|
|
|
|
legacy_hook="browser.onContextMenu",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="browser_did_change_row",
|
2020-01-14 23:53:57 +01:00
|
|
|
args=["browser: aqt.browser.Browser"],
|
|
|
|
legacy_hook="browser.rowChanged",
|
|
|
|
),
|
2020-02-15 21:03:15 +01:00
|
|
|
Hook(
|
|
|
|
name="browser_will_build_tree",
|
|
|
|
args=[
|
|
|
|
"handled: bool",
|
|
|
|
"tree: aqt.browser.SidebarItem",
|
|
|
|
"stage: aqt.browser.SidebarStage",
|
|
|
|
"browser: aqt.browser.Browser",
|
|
|
|
],
|
|
|
|
return_type="bool",
|
|
|
|
doc="""Used to add or replace items in the browser sidebar tree
|
|
|
|
|
|
|
|
'tree' is the root SidebarItem that all other items are added to.
|
|
|
|
|
|
|
|
'stage' is an enum describing the different construction stages of
|
|
|
|
the sidebar tree at which you can interject your changes.
|
|
|
|
The different values can be inspected by looking at
|
|
|
|
aqt.browser.SidebarStage.
|
|
|
|
|
|
|
|
If you want Anki to proceed with the construction of the tree stage
|
|
|
|
in question after your have performed your changes or additions,
|
|
|
|
return the 'handled' boolean unchanged.
|
|
|
|
|
|
|
|
On the other hand, if you want to prevent Anki from adding its own
|
|
|
|
items at a particular construction stage (e.g. in case your add-on
|
|
|
|
implements its own version of that particular stage), return 'True'.
|
|
|
|
|
|
|
|
If you return 'True' at SidebarStage.ROOT, the sidebar will not be
|
|
|
|
populated by any of the other construction stages. For any other stage
|
|
|
|
the tree construction will just continue as usual.
|
|
|
|
|
|
|
|
For example, if your code wishes to replace the tag tree, you could do:
|
|
|
|
|
|
|
|
def on_browser_will_build_tree(handled, root, stage, browser):
|
|
|
|
if stage != SidebarStage.TAGS:
|
|
|
|
# not at tag tree building stage, pass on
|
|
|
|
return handled
|
|
|
|
|
|
|
|
# your tag tree construction code
|
|
|
|
# root.addChild(...)
|
|
|
|
|
|
|
|
# your code handled tag tree construction, no need for Anki
|
|
|
|
# or other add-ons to build the tag tree
|
|
|
|
return True
|
|
|
|
""",
|
|
|
|
),
|
2020-01-15 04:03:11 +01:00
|
|
|
# States
|
|
|
|
###################
|
2020-01-15 03:16:54 +01:00
|
|
|
Hook(
|
|
|
|
name="state_will_change",
|
|
|
|
args=["new_state: str", "old_state: str"],
|
|
|
|
legacy_hook="beforeStateChange",
|
|
|
|
),
|
|
|
|
Hook(
|
|
|
|
name="state_did_change",
|
|
|
|
args=["new_state: str", "old_state: str"],
|
|
|
|
legacy_hook="afterStateChange",
|
|
|
|
),
|
|
|
|
# different sig to original
|
|
|
|
Hook(
|
|
|
|
name="state_shortcuts_will_change",
|
2020-01-15 03:46:53 +01:00
|
|
|
args=["state: str", "shortcuts: List[Tuple[str, Callable]]"],
|
2020-01-15 03:16:54 +01:00
|
|
|
),
|
2020-01-15 03:46:53 +01:00
|
|
|
Hook(
|
|
|
|
name="state_did_revert",
|
|
|
|
args=["action: str"],
|
|
|
|
legacy_hook="revertedState",
|
|
|
|
doc="Called when user used the undo option to restore to an earlier database state.",
|
|
|
|
),
|
2020-01-15 03:16:54 +01:00
|
|
|
Hook(
|
|
|
|
name="state_did_reset",
|
|
|
|
legacy_hook="reset",
|
|
|
|
doc="Called when the interface needs to be redisplayed after non-trivial changes have been made.",
|
|
|
|
),
|
2020-01-22 01:46:35 +01:00
|
|
|
# Webview
|
|
|
|
###################
|
|
|
|
Hook(
|
|
|
|
name="webview_did_receive_js_message",
|
2020-02-08 23:59:29 +01:00
|
|
|
args=["handled: Tuple[bool, Any]", "message: str", "context: Any"],
|
2020-01-22 01:46:35 +01:00
|
|
|
return_type="Tuple[bool, Any]",
|
|
|
|
doc="""Used to handle pycmd() messages sent from Javascript.
|
|
|
|
|
2020-02-08 23:59:29 +01:00
|
|
|
Message is the string passed to pycmd().
|
|
|
|
|
|
|
|
For messages you don't want to handle, return 'handled' unchanged.
|
2020-01-22 01:46:35 +01:00
|
|
|
|
|
|
|
If you handle a message and don't want it passed to the original
|
|
|
|
bridge command handler, return (True, None).
|
2020-02-08 23:59:29 +01:00
|
|
|
|
2020-01-22 01:46:35 +01:00
|
|
|
If you want to pass a value to pycmd's result callback, you can
|
2020-02-08 23:59:29 +01:00
|
|
|
return it with (True, some_value).
|
|
|
|
|
|
|
|
Context is the instance that was passed to set_bridge_command().
|
|
|
|
It can be inspected to check which screen this hook is firing
|
|
|
|
in, and to get a reference to the screen. For example, if your
|
|
|
|
code wishes to function only in the review screen, you could do:
|
|
|
|
|
|
|
|
if not isinstance(context, aqt.reviewer.Reviewer):
|
|
|
|
# not reviewer, pass on message
|
|
|
|
return handled
|
|
|
|
|
|
|
|
if message == "my-mark-action":
|
|
|
|
# our message, call onMark() on the reviewer instance
|
|
|
|
context.onMark()
|
|
|
|
# and don't pass message to other handlers
|
|
|
|
return (True, None)
|
|
|
|
else:
|
|
|
|
# some other command, pass it on
|
|
|
|
return handled
|
|
|
|
""",
|
2020-01-22 01:46:35 +01:00
|
|
|
),
|
2020-02-12 22:00:13 +01:00
|
|
|
Hook(
|
|
|
|
name="webview_will_set_content",
|
|
|
|
args=["web_content: aqt.webview.WebContent", "context: Optional[Any]",],
|
|
|
|
doc="""Used to modify web content before it is rendered.
|
|
|
|
|
|
|
|
Web_content contains the HTML, JS, and CSS the web view will be
|
|
|
|
populated with.
|
|
|
|
|
|
|
|
Context is the instance that was passed to stdHtml().
|
|
|
|
It can be inspected to check which screen this hook is firing
|
|
|
|
in, and to get a reference to the screen. For example, if your
|
|
|
|
code wishes to function only in the review screen, you could do:
|
|
|
|
|
2020-02-15 15:03:58 +01:00
|
|
|
def on_webview_will_set_content(web_content: WebContent, context):
|
|
|
|
|
|
|
|
if not isinstance(context, aqt.reviewer.Reviewer):
|
|
|
|
# not reviewer, do not modify content
|
|
|
|
return
|
|
|
|
|
|
|
|
# reviewer, perform changes to content
|
|
|
|
|
|
|
|
context: aqt.reviewer.Reviewer
|
|
|
|
|
|
|
|
addon_package = mw.addonManager.addonFromModule(__name__)
|
|
|
|
|
|
|
|
web_content.css.append(
|
|
|
|
f"/_addons/{addon_package}/web/my-addon.css")
|
|
|
|
web_content.js.append(
|
|
|
|
f"/_addons/{addon_package}/web/my-addon.js")
|
2020-02-12 22:00:13 +01:00
|
|
|
|
2020-02-15 15:03:58 +01:00
|
|
|
web_content.head += "<script>console.log('my-addon')</script>"
|
|
|
|
web_content.body += "<div id='my-addon'></div>"
|
2020-02-12 22:00:13 +01:00
|
|
|
""",
|
|
|
|
),
|
2020-01-22 01:46:35 +01:00
|
|
|
Hook(
|
|
|
|
name="webview_will_show_context_menu",
|
|
|
|
args=["webview: aqt.webview.AnkiWebView", "menu: QMenu"],
|
|
|
|
legacy_hook="AnkiWebView.contextMenuEvent",
|
|
|
|
),
|
2020-01-15 04:03:11 +01:00
|
|
|
# Main
|
|
|
|
###################
|
|
|
|
Hook(name="profile_did_open", legacy_hook="profileLoaded"),
|
|
|
|
Hook(name="profile_will_close", legacy_hook="unloadProfile"),
|
|
|
|
Hook(
|
|
|
|
name="collection_did_load",
|
|
|
|
args=["col: anki.storage._Collection"],
|
|
|
|
legacy_hook="colLoading",
|
|
|
|
),
|
2020-01-15 03:16:54 +01:00
|
|
|
Hook(
|
|
|
|
name="undo_state_did_change", args=["can_undo: bool"], legacy_hook="undoState"
|
|
|
|
),
|
|
|
|
Hook(name="review_did_undo", args=["card_id: int"], legacy_hook="revertedCard"),
|
|
|
|
Hook(
|
2020-01-15 08:18:11 +01:00
|
|
|
name="style_did_init",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["style: str"],
|
|
|
|
return_type="str",
|
|
|
|
legacy_hook="setupStyle",
|
|
|
|
),
|
2020-02-15 23:21:23 +01:00
|
|
|
Hook(
|
|
|
|
name="top_toolbar_did_init_links",
|
2020-02-20 16:23:33 +01:00
|
|
|
args=["links: List[str]", "top_toolbar: aqt.toolbar.Toolbar"],
|
|
|
|
doc="""Used to modify or add links in the top toolbar of Anki's main window
|
|
|
|
|
|
|
|
'links' is a list of HTML link elements. Add-ons can generate their own links
|
|
|
|
by using aqt.toolbar.Toolbar.create_link. Links created in that way can then be
|
|
|
|
appended to the link list, e.g.:
|
|
|
|
|
|
|
|
def on_top_toolbar_did_init_links(links, toolbar):
|
|
|
|
my_link = toolbar.create_link(...)
|
|
|
|
links.append(my_link)
|
|
|
|
""",
|
2020-02-20 15:17:48 +01:00
|
|
|
),
|
2020-02-04 00:07:15 +01:00
|
|
|
Hook(
|
|
|
|
name="media_sync_did_progress", args=["entry: aqt.mediasync.LogEntryWithTime"],
|
2020-02-15 23:21:23 +01:00
|
|
|
),
|
2020-02-05 02:55:14 +01:00
|
|
|
Hook(name="media_sync_did_start_or_stop", args=["running: bool"]),
|
2020-01-15 04:03:11 +01:00
|
|
|
# Adding cards
|
|
|
|
###################
|
2020-01-15 03:16:54 +01:00
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="add_cards_will_show_history_menu",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["addcards: aqt.addcards.AddCards", "menu: QMenu"],
|
|
|
|
legacy_hook="AddCards.onHistory",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="add_cards_did_add_note",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["note: anki.notes.Note"],
|
|
|
|
legacy_hook="AddCards.noteAdded",
|
|
|
|
),
|
2020-01-15 04:03:11 +01:00
|
|
|
# Editing
|
|
|
|
###################
|
2020-01-15 03:16:54 +01:00
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_init_buttons",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["buttons: List", "editor: aqt.editor.Editor"],
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_init_shortcuts",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["shortcuts: List[Tuple]", "editor: aqt.editor.Editor"],
|
|
|
|
legacy_hook="setupEditorShortcuts",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_will_show_context_menu",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["editor_webview: aqt.editor.EditorWebView", "menu: QMenu"],
|
|
|
|
legacy_hook="EditorWebView.contextMenuEvent",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_fire_typing_timer",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["note: anki.notes.Note"],
|
|
|
|
legacy_hook="editTimer",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_focus_field",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["note: anki.notes.Note", "current_field_idx: int"],
|
|
|
|
legacy_hook="editFocusGained",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_unfocus_field",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["changed: bool", "note: anki.notes.Note", "current_field_idx: int"],
|
|
|
|
return_type="bool",
|
|
|
|
legacy_hook="editFocusLost",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_load_note",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["editor: aqt.editor.Editor"],
|
|
|
|
legacy_hook="loadNote",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_did_update_tags",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["note: anki.notes.Note"],
|
|
|
|
legacy_hook="tagsUpdated",
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="editor_will_use_font_for_field",
|
2020-01-15 03:16:54 +01:00
|
|
|
args=["font: str"],
|
|
|
|
return_type="str",
|
|
|
|
legacy_hook="mungeEditingFontName",
|
|
|
|
),
|
2020-01-20 13:01:38 +01:00
|
|
|
# Sound/video
|
|
|
|
###################
|
|
|
|
Hook(name="av_player_will_play", args=["tag: anki.sound.AVTag"]),
|
2020-01-22 05:39:18 +01:00
|
|
|
Hook(
|
|
|
|
name="av_player_did_begin_playing",
|
|
|
|
args=["player: aqt.sound.Player", "tag: anki.sound.AVTag"],
|
|
|
|
),
|
|
|
|
Hook(name="av_player_did_end_playing", args=["player: aqt.sound.Player"]),
|
2020-01-15 04:03:11 +01:00
|
|
|
# Other
|
|
|
|
###################
|
|
|
|
Hook(
|
|
|
|
name="current_note_type_did_change",
|
|
|
|
args=["notetype: Dict[str, Any]"],
|
|
|
|
legacy_hook="currentModelChanged",
|
|
|
|
legacy_no_args=True,
|
|
|
|
),
|
|
|
|
Hook(
|
2020-01-15 08:45:35 +01:00
|
|
|
name="deck_browser_will_show_options_menu",
|
2020-01-15 04:03:11 +01:00
|
|
|
args=["menu: QMenu", "deck_id: int"],
|
|
|
|
legacy_hook="showDeckOptions",
|
|
|
|
),
|
2020-01-13 05:38:05 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
path = os.path.join(os.path.dirname(__file__), "..", "aqt", "gui_hooks.py")
|
|
|
|
update_file(path, hooks)
|