more friendly message for v2 import into v1
This commit is contained in:
parent
4dece5a972
commit
c322f68ab8
@ -21,6 +21,10 @@ MID = 2
|
||||
MOD = 3
|
||||
|
||||
|
||||
class V2ImportIntoV1(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Anki2Importer(Importer):
|
||||
|
||||
needMapper = False
|
||||
@ -58,7 +62,7 @@ class Anki2Importer(Importer):
|
||||
if self.src.db.scalar("select 1 from cards where queue != 0 limit 1"):
|
||||
self.source_needs_upgrade = True
|
||||
elif self._importing_v2 and self.col.sched_ver() == 1:
|
||||
raise Exception("must upgrade to new scheduler to import this file")
|
||||
raise V2ImportIntoV1()
|
||||
|
||||
def _import(self) -> None:
|
||||
self._decks = {}
|
||||
|
@ -14,6 +14,7 @@ import anki.importing as importing
|
||||
import aqt.deckchooser
|
||||
import aqt.forms
|
||||
import aqt.modelchooser
|
||||
from anki.importing.anki2 import V2ImportIntoV1
|
||||
from anki.importing.apkg import AnkiPackageImporter
|
||||
from aqt import AnkiQt, gui_hooks
|
||||
from aqt.qt import *
|
||||
@ -394,6 +395,11 @@ def importFile(mw: AnkiQt, file: str) -> None:
|
||||
future.result()
|
||||
except zipfile.BadZipfile:
|
||||
showWarning(invalidZipMsg())
|
||||
except V2ImportIntoV1:
|
||||
showWarning(
|
||||
"""\
|
||||
To import this deck, please click the Update button at the top of the deck list, then try again."""
|
||||
)
|
||||
except Exception as e:
|
||||
err = repr(str(e))
|
||||
if "invalidFile" in err:
|
||||
|
Loading…
Reference in New Issue
Block a user