mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
support import of renamed .apkg files
This commit is contained in:
parent
aa2b31a82b
commit
bd8707f54c
2 changed files with 9 additions and 2 deletions
|
@ -13,7 +13,7 @@ from anki.lang import _
|
|||
|
||||
Importers = (
|
||||
(_("Text separated by tabs or semicolons (*)"), TextImporter),
|
||||
(_("Packaged Anki Deck (*.apkg)"), AnkiPackageImporter),
|
||||
(_("Packaged Anki Deck (*.apkg *.zip)"), AnkiPackageImporter),
|
||||
(_("Anki 1.2 Deck (*.anki)"), Anki1Importer),
|
||||
(_("Mnemosyne 2.0 Deck (*.db)"), MnemosyneImporter),
|
||||
(_("Supermemo XML export (*.xml)"), SupermemoXmlImporter),
|
||||
|
|
|
@ -300,8 +300,15 @@ backup, please see the 'Backups' section of the user manual."""))
|
|||
mw.progress.finish()
|
||||
diag = ImportDialog(mw, importer)
|
||||
else:
|
||||
# if it's an apkg, we need to ask whether to import/replace
|
||||
# if it's an apkg/zip, first test it's a valid file
|
||||
if importer.__class__.__name__ == "AnkiPackageImporter":
|
||||
z = zipfile.ZipFile(importer.file)
|
||||
try:
|
||||
z.getinfo("collection.anki2")
|
||||
except:
|
||||
showWarning(_("The provided file is not a valid .apkg file."))
|
||||
return
|
||||
# we need to ask whether to import/replace
|
||||
if not setupApkgImport(mw, importer):
|
||||
return
|
||||
mw.progress.start(immediate=True)
|
||||
|
|
Loading…
Reference in a new issue