mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
import .apkg files in a background thread
This commit is contained in:
parent
231fa30a86
commit
ad9dad8748
1 changed files with 34 additions and 31 deletions
|
@ -395,11 +395,11 @@ def importFile(mw, file):
|
|||
|
||||
# importing non-colpkg files
|
||||
mw.progress.start(immediate=True)
|
||||
try:
|
||||
try:
|
||||
importer.run()
|
||||
finally:
|
||||
|
||||
def on_done(future: Future):
|
||||
mw.progress.finish()
|
||||
try:
|
||||
future.result()
|
||||
except zipfile.BadZipfile:
|
||||
showWarning(invalidZipMsg())
|
||||
except Exception as e:
|
||||
|
@ -429,8 +429,11 @@ Unable to import from a read-only file."""
|
|||
tooltip(log)
|
||||
else:
|
||||
showText(log)
|
||||
|
||||
mw.reset()
|
||||
|
||||
mw.taskman.run_in_background(importer.run, on_done)
|
||||
|
||||
|
||||
def invalidZipMsg():
|
||||
return _(
|
||||
|
|
Loading…
Reference in a new issue