From 788a3eeced0cd01999b5a879fc8a90fb98b3c650 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Sat, 23 May 2020 11:14:52 +0200 Subject: [PATCH] Satisfy black reformatter --- qt/aqt/gui_hooks.py | 17 +++++++++++++---- qt/tools/genhooks_gui.py | 26 +++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/qt/aqt/gui_hooks.py b/qt/aqt/gui_hooks.py index 3eca0f770..241bffd2e 100644 --- a/qt/aqt/gui_hooks.py +++ b/qt/aqt/gui_hooks.py @@ -918,14 +918,23 @@ deck_browser_will_show_options_menu = _DeckBrowserWillShowOptionsMenuHook() class _DeckConfDidAddConfigHook: - """Called after a new config group was added as a clone of the current one, but before initializing the widget state""" + """Allows modification of a newly created config group + + This hook is called after the config group was created, but + before initializing the widget state. + + `deck_conf` will point to the old config group, `new_conf_id` will + point to the newly created config group. + + Config groups are created as clones of the current one. + """ _hooks: List[Callable[["aqt.deckconf.DeckConf", Any, Any, str, int], None]] = [] def append( self, cb: Callable[["aqt.deckconf.DeckConf", Any, Any, str, int], None] ) -> None: - """(deck_conf: aqt.deckconf.DeckConf, deck: Any, config: Any, new_name: str, new_confg_id: int)""" + """(deck_conf: aqt.deckconf.DeckConf, deck: Any, config: Any, new_name: str, new_conf_id: int)""" self._hooks.append(cb) def remove( @@ -940,11 +949,11 @@ class _DeckConfDidAddConfigHook: deck: Any, config: Any, new_name: str, - new_confg_id: int, + new_conf_id: int, ) -> None: for hook in self._hooks: try: - hook(deck_conf, deck, config, new_name, new_confg_id) + hook(deck_conf, deck, config, new_name, new_conf_id) except: # if the hook fails, remove it self._hooks.remove(hook) diff --git a/qt/tools/genhooks_gui.py b/qt/tools/genhooks_gui.py index 0d9caec22..8da8a7e69 100644 --- a/qt/tools/genhooks_gui.py +++ b/qt/tools/genhooks_gui.py @@ -174,8 +174,23 @@ hooks = [ ), Hook( name="deck_conf_did_add_config", - args=["deck_conf: aqt.deckconf.DeckConf", "deck: Any", "config: Any", "new_name: str", "new_confg_id: int"], - doc="Called after a new config group was added as a clone of the current one, but before initializing the widget state", + args=[ + "deck_conf: aqt.deckconf.DeckConf", + "deck: Any", + "config: Any", + "new_name: str", + "new_conf_id: int", + ], + doc="""Allows modification of a newly created config group + + This hook is called after the config group was created, but + before initializing the widget state. + + `deck_conf` will point to the old config group, `new_conf_id` will + point to the newly created config group. + + Config groups are created as clones of the current one. + """, ), Hook( name="deck_conf_will_remove_config", @@ -184,7 +199,12 @@ hooks = [ ), Hook( name="deck_conf_will_rename_config", - args=["deck_conf: aqt.deckconf.DeckConf", "deck: Any", "config: Any", "new_name: str"], + args=[ + "deck_conf: aqt.deckconf.DeckConf", + "deck: Any", + "config: Any", + "new_name: str", + ], doc="Called before config group is renamed", ), # Browser