fix description in export screen (thanks to ANH)

https://forums.ankiweb.net/t/anki-2-1-31-exporting-display-bug/2669/3
This commit is contained in:
Damien Elmes 2020-08-26 08:33:35 +10:00
parent 068eca5319
commit 5355c3c25e
2 changed files with 11 additions and 7 deletions

View File

@ -92,7 +92,7 @@ class Exporter:
class TextCardExporter(Exporter):
key = lambda: _("Cards in Plain Text")
key = lambda self: _("Cards in Plain Text")
ext = ".txt"
includeHTML = True
@ -122,7 +122,7 @@ class TextCardExporter(Exporter):
class TextNoteExporter(Exporter):
key = lambda: _("Notes in Plain Text")
key = lambda self: _("Notes in Plain Text")
ext = ".txt"
includeTags = True
includeHTML = True
@ -164,7 +164,7 @@ where cards.id in %s)"""
class AnkiExporter(Exporter):
key = lambda: _("Anki 2.0 Deck")
key = lambda self: _("Anki 2.0 Deck")
ext = ".anki2"
includeSched: Union[bool, None] = False
includeMedia = True
@ -313,7 +313,7 @@ class AnkiExporter(Exporter):
class AnkiPackageExporter(AnkiExporter):
key = lambda: _("Anki Deck Package")
key = lambda self: _("Anki Deck Package")
ext = ".apkg"
def __init__(self, col: Collection) -> None:
@ -394,7 +394,7 @@ class AnkiPackageExporter(AnkiExporter):
class AnkiCollectionPackageExporter(AnkiPackageExporter):
key = lambda: _("Anki Collection Package")
key = lambda self: _("Anki Collection Package")
ext = ".colpkg"
verbatim = True
includeSched = None
@ -427,7 +427,7 @@ class AnkiCollectionPackageExporter(AnkiPackageExporter):
def exporters() -> List[Tuple[str, Any]]:
def id(obj):
if callable(obj.key):
key_str = obj.key()
key_str = obj.key(obj)
else:
key_str = obj.key
return ("%s (*%s)" % (key_str, obj.ext), obj)

View File

@ -114,12 +114,16 @@ class ExportDialog(QDialog):
deck_name = re.sub('[\\\\/?<>:*|"^]', "_", deck_name)
filename = "{0}{1}".format(deck_name, self.exporter.ext)
if callable(self.exporter.key):
key_str = self.exporter.key()
else:
key_str = self.exporter.key
while 1:
file = getSaveFile(
self,
_("Export"),
"export",
self.exporter.key,
key_str,
self.exporter.ext,
fname=filename,
)