import .apkg files in a background thread
This commit is contained in:
parent
231fa30a86
commit
ad9dad8748
@ -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:
|
||||
@ -407,7 +407,7 @@ def importFile(mw, file):
|
||||
if "invalidFile" in err:
|
||||
msg = _(
|
||||
"""\
|
||||
Invalid file. Please restore from backup."""
|
||||
Invalid file. Please restore from backup."""
|
||||
)
|
||||
showWarning(msg)
|
||||
elif "invalidTempFolder" in err:
|
||||
@ -416,7 +416,7 @@ Invalid file. Please restore from backup."""
|
||||
showWarning(
|
||||
_(
|
||||
"""\
|
||||
Unable to import from a read-only file."""
|
||||
Unable to import from a read-only file."""
|
||||
)
|
||||
)
|
||||
else:
|
||||
@ -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 New Issue
Block a user