mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Introduce exporters_list_created hook to new export code (#1978)
* Introduce exporters_list_created hook for new export code * Fix hook and argument name
This commit is contained in:
parent
09eef8e746
commit
a584ef1f50
2 changed files with 11 additions and 1 deletions
|
@ -55,6 +55,7 @@ class ExportDialog(QDialog):
|
||||||
NoteCsvExporter,
|
NoteCsvExporter,
|
||||||
CardCsvExporter,
|
CardCsvExporter,
|
||||||
]
|
]
|
||||||
|
gui_hooks.exporters_list_did_initialize(self.exporter_classes)
|
||||||
self.frm.format.insertItems(
|
self.frm.format.insertItems(
|
||||||
0, [f"{e.name()} (.{e.extension})" for e in self.exporter_classes]
|
0, [f"{e.name()} (.{e.extension})" for e in self.exporter_classes]
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,7 +19,7 @@ prefix = """\
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Callable, Sequence, Literal
|
from typing import Any, Callable, Sequence, Literal, Type
|
||||||
|
|
||||||
import anki
|
import anki
|
||||||
import aqt
|
import aqt
|
||||||
|
@ -856,6 +856,15 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
||||||
args=["legacy_exporter: anki.exporting.Exporter"],
|
args=["legacy_exporter: anki.exporting.Exporter"],
|
||||||
doc="""Called after collection and deck exports performed by legacy exporters.""",
|
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
|
# Dialog Manager
|
||||||
###################
|
###################
|
||||||
Hook(
|
Hook(
|
||||||
|
|
Loading…
Reference in a new issue