Add ExportFormat enum and use it in Exporter classes

This commit is contained in:
Glutanimate 2022-07-18 14:11:54 +02:00
parent d482e90c6b
commit 7f7c7db0cb

View file

@ -8,6 +8,7 @@ import re
import time import time
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum
from typing import Sequence, Type from typing import Sequence, Type
import aqt.forms import aqt.forms
@ -178,6 +179,13 @@ class Options:
limit: ExportLimit limit: ExportLimit
class ExportFormat(Enum):
COLPKG = "colpkg"
APKG = "apkg"
CSV_NOTES = "txt"
CSV_CARDS = "txt"
class Exporter(ABC): class Exporter(ABC):
extension: str extension: str
show_deck_list = False show_deck_list = False
@ -202,7 +210,7 @@ class Exporter(ABC):
class ColpkgExporter(Exporter): class ColpkgExporter(Exporter):
extension = "colpkg" extension = ExportFormat.COLPKG.value
show_include_media = True show_include_media = True
show_legacy_support = True show_legacy_support = True
@ -235,7 +243,7 @@ class ColpkgExporter(Exporter):
class ApkgExporter(Exporter): class ApkgExporter(Exporter):
extension = "apkg" extension = ExportFormat.APKG.value
show_deck_list = True show_deck_list = True
show_include_scheduling = True show_include_scheduling = True
show_include_media = True show_include_media = True
@ -263,7 +271,7 @@ class ApkgExporter(Exporter):
class NoteCsvExporter(Exporter): class NoteCsvExporter(Exporter):
extension = "txt" extension = ExportFormat.CSV_NOTES.value
show_deck_list = True show_deck_list = True
show_include_html = True show_include_html = True
show_include_tags = True show_include_tags = True
@ -295,7 +303,7 @@ class NoteCsvExporter(Exporter):
class CardCsvExporter(Exporter): class CardCsvExporter(Exporter):
extension = "txt" extension = ExportFormat.CSV_CARDS.value
show_deck_list = True show_deck_list = True
show_include_html = True show_include_html = True