From feaa32b751b2f929dd33ff86b93a7f76b36063e7 Mon Sep 17 00:00:00 2001 From: Glutanimate Date: Thu, 25 Mar 2021 02:33:15 +0100 Subject: [PATCH] Supply deck ID in hook, so that add-ons may update deck config dict (for newly created filtered decks where the deck ID is not yet set in the FilteredDeckForUpdate object) --- qt/aqt/filtered_deck.py | 4 +++- qt/tools/genhooks_gui.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qt/aqt/filtered_deck.py b/qt/aqt/filtered_deck.py index 658fcfe87..d5d921b80 100644 --- a/qt/aqt/filtered_deck.py +++ b/qt/aqt/filtered_deck.py @@ -303,7 +303,9 @@ class FilteredDeckConfigDialog(QDialog): return def success(out: OpChangesWithID) -> None: - gui_hooks.filtered_deck_dialog_did_add_or_update_deck(self, self.deck) + gui_hooks.filtered_deck_dialog_did_add_or_update_deck( + self, self.deck, out.id + ) saveGeom(self, self.GEOMETRY_KEY) aqt.dialogs.markClosed(self.DIALOG_KEY) QDialog.accept(self) diff --git a/qt/tools/genhooks_gui.py b/qt/tools/genhooks_gui.py index 36d0ca47c..cd9b540df 100644 --- a/qt/tools/genhooks_gui.py +++ b/qt/tools/genhooks_gui.py @@ -307,6 +307,7 @@ hooks = [ args=[ "filtered_deck_dialog: aqt.filtered_deck.FilteredDeckConfigDialog", "filtered_deck: anki.scheduler.FilteredDeckForUpdate", + "deck_id: int", ], doc="Allows performing changes after a filtered deck has been added or updated", ),