mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
Add simplified legacy exporter hooks
Allows add-ons to be notified of exports when legacy handlers are enabled, without the need for monkey-patches.
This commit is contained in:
parent
475f9814ca
commit
423a87ab7c
2 changed files with 14 additions and 0 deletions
|
@ -196,6 +196,7 @@ class ExportDialog(QDialog):
|
||||||
else:
|
else:
|
||||||
self.on_export_finished()
|
self.on_export_finished()
|
||||||
|
|
||||||
|
gui_hooks.legacy_exporter_will_export(self.exporter.ext)
|
||||||
if self.isVerbatim:
|
if self.isVerbatim:
|
||||||
gui_hooks.collection_will_temporarily_close(self.mw.col)
|
gui_hooks.collection_will_temporarily_close(self.mw.col)
|
||||||
self.mw.progress.start()
|
self.mw.progress.start()
|
||||||
|
@ -213,6 +214,7 @@ class ExportDialog(QDialog):
|
||||||
msg = tr.exporting_note_exported(count=self.exporter.count)
|
msg = tr.exporting_note_exported(count=self.exporter.count)
|
||||||
else:
|
else:
|
||||||
msg = tr.exporting_card_exported(count=self.exporter.count)
|
msg = tr.exporting_card_exported(count=self.exporter.count)
|
||||||
|
gui_hooks.legacy_exporter_did_export(self.exporter.ext)
|
||||||
tooltip(msg, period=3000)
|
tooltip(msg, period=3000)
|
||||||
QDialog.reject(self)
|
QDialog.reject(self)
|
||||||
|
|
||||||
|
|
|
@ -816,6 +816,8 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
||||||
|
|
||||||
`output` provides access to the unused/missing file lists and the text output that will be shown in the Check Media screen.""",
|
`output` provides access to the unused/missing file lists and the text output that will be shown in the Check Media screen.""",
|
||||||
),
|
),
|
||||||
|
# Importing/exporting data
|
||||||
|
###################
|
||||||
Hook(
|
Hook(
|
||||||
name="exporter_will_export",
|
name="exporter_will_export",
|
||||||
args=[
|
args=[
|
||||||
|
@ -844,6 +846,16 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
||||||
],
|
],
|
||||||
doc="""Called after collection and deck exports.""",
|
doc="""Called after collection and deck exports.""",
|
||||||
),
|
),
|
||||||
|
Hook(
|
||||||
|
name="legacy_exporter_will_export",
|
||||||
|
args=["file_extension: str"],
|
||||||
|
doc="""Called before collection and deck exports performed by legacy exporters.""",
|
||||||
|
),
|
||||||
|
Hook(
|
||||||
|
name="legacy_exporter_did_export",
|
||||||
|
args=["file_extension: str"],
|
||||||
|
doc="""Called after collection and deck exports performed by legacy exporters.""",
|
||||||
|
),
|
||||||
# Dialog Manager
|
# Dialog Manager
|
||||||
###################
|
###################
|
||||||
Hook(
|
Hook(
|
||||||
|
|
Loading…
Reference in a new issue