mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
Rename Options to ExportOptions for better namespacing in add-ons
This commit is contained in:
parent
238e53cd5e
commit
475f9814ca
2 changed files with 16 additions and 16 deletions
|
@ -126,14 +126,14 @@ class ExportDialog(QDialog):
|
|||
break
|
||||
return path
|
||||
|
||||
def options(self, out_path: str) -> Options:
|
||||
def options(self, out_path: str) -> ExportOptions:
|
||||
limit: ExportLimit = None
|
||||
if self.nids:
|
||||
limit = NoteIdsLimit(self.nids)
|
||||
elif current_deck_id := self.current_deck_id():
|
||||
limit = DeckIdLimit(current_deck_id)
|
||||
|
||||
return Options(
|
||||
return ExportOptions(
|
||||
out_path=out_path,
|
||||
include_scheduling=self.frm.includeSched.isChecked(),
|
||||
include_media=self.frm.includeMedia.isChecked(),
|
||||
|
@ -166,7 +166,7 @@ class ExportDialog(QDialog):
|
|||
|
||||
|
||||
@dataclass
|
||||
class Options:
|
||||
class ExportOptions:
|
||||
out_path: str
|
||||
include_scheduling: bool
|
||||
include_media: bool
|
||||
|
@ -200,7 +200,7 @@ class Exporter(ABC):
|
|||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: Options) -> None:
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: ExportOptions) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
|
@ -219,7 +219,7 @@ class ColpkgExporter(Exporter):
|
|||
return tr.exporting_anki_collection_package()
|
||||
|
||||
@classmethod
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: Options) -> None:
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: ExportOptions) -> None:
|
||||
options = gui_hooks.exporter_will_export(options, cls.format)
|
||||
|
||||
def on_success(_: None) -> None:
|
||||
|
@ -257,7 +257,7 @@ class ApkgExporter(Exporter):
|
|||
return tr.exporting_anki_deck_package()
|
||||
|
||||
@classmethod
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: Options) -> None:
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: ExportOptions) -> None:
|
||||
options = gui_hooks.exporter_will_export(options, cls.format)
|
||||
|
||||
def on_success(count: int) -> None:
|
||||
|
@ -291,7 +291,7 @@ class NoteCsvExporter(Exporter):
|
|||
return tr.exporting_notes_in_plain_text()
|
||||
|
||||
@classmethod
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: Options) -> None:
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: ExportOptions) -> None:
|
||||
options = gui_hooks.exporter_will_export(options, cls.format)
|
||||
|
||||
def on_success(count: int) -> None:
|
||||
|
@ -323,7 +323,7 @@ class CardCsvExporter(Exporter):
|
|||
return tr.exporting_cards_in_plain_text()
|
||||
|
||||
@classmethod
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: Options) -> None:
|
||||
def export(cls, mw: aqt.main.AnkiQt, options: ExportOptions) -> None:
|
||||
options = gui_hooks.exporter_will_export(options, cls.format)
|
||||
|
||||
def on_success(count: int) -> None:
|
||||
|
|
|
@ -819,27 +819,27 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
|||
Hook(
|
||||
name="exporter_will_export",
|
||||
args=[
|
||||
"options: aqt.import_export.exporting.Options",
|
||||
"export_options: aqt.import_export.exporting.ExportOptions",
|
||||
"export_format: aqt.import_export.exporting.ExportFormat",
|
||||
],
|
||||
return_type="aqt.import_export.exporting.Options",
|
||||
return_type="aqt.import_export.exporting.ExportOptions",
|
||||
doc="""Called before collection and deck exports.
|
||||
|
||||
Allows add-ons to be notified of impending deck exports and potentially
|
||||
modify the export options. To perform the export unaltered, please return
|
||||
`options` as is, e.g.:
|
||||
`export_options` as is, e.g.:
|
||||
|
||||
def on_exporter_will_export(options: Options, export_format: ExportFormat):
|
||||
def on_exporter_will_export(export_options: ExportOptions, export_format: ExportFormat):
|
||||
if export_format != ExportFormat.APKG:
|
||||
return options
|
||||
options.limit = ...
|
||||
return options
|
||||
return export_options
|
||||
export_options.limit = ...
|
||||
return export_options
|
||||
""",
|
||||
),
|
||||
Hook(
|
||||
name="exporter_did_export",
|
||||
args=[
|
||||
"options: aqt.import_export.exporting.Options",
|
||||
"export_options: aqt.import_export.exporting.ExportOptions",
|
||||
"export_format: aqt.import_export.exporting.ExportFormat",
|
||||
],
|
||||
doc="""Called after collection and deck exports.""",
|
||||
|
|
Loading…
Reference in a new issue