diff --git a/qt/aqt/import_export/exporting.py b/qt/aqt/import_export/exporting.py index f4d132ab0..f4967961b 100644 --- a/qt/aqt/import_export/exporting.py +++ b/qt/aqt/import_export/exporting.py @@ -55,6 +55,7 @@ class ExportDialog(QDialog): NoteCsvExporter, CardCsvExporter, ] + gui_hooks.exporters_list_did_initialize(self.exporter_classes) self.frm.format.insertItems( 0, [f"{e.name()} (.{e.extension})" for e in self.exporter_classes] ) diff --git a/qt/tools/genhooks_gui.py b/qt/tools/genhooks_gui.py index 6a3a139ab..39a020db3 100644 --- a/qt/tools/genhooks_gui.py +++ b/qt/tools/genhooks_gui.py @@ -19,7 +19,7 @@ prefix = """\ from __future__ import annotations -from typing import Any, Callable, Sequence, Literal +from typing import Any, Callable, Sequence, Literal, Type import anki import aqt @@ -856,6 +856,15 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest) args=["legacy_exporter: anki.exporting.Exporter"], doc="""Called after collection and deck exports performed by legacy exporters.""", ), + Hook( + name="exporters_list_did_initialize", + args=["exporters: list[Type[aqt.import_export.exporting.Exporter]]"], + doc="""Called after the list of exporter classes is created. + + Allows you to register custom exporters and/or replace existing ones by + modifying the exporter list. + """, + ), # Dialog Manager ################### Hook(