skip add/replace prompt when importing 1-deck apkg

This commit is contained in:
Damien Elmes 2012-10-24 18:07:46 +09:00
parent 9e74f81fa4
commit c64f5130e2

View file

@ -315,6 +315,17 @@ Unable to import from a read-only file."""))
mw.reset() mw.reset()
def setupApkgImport(mw, importer): def setupApkgImport(mw, importer):
meta = None
try:
z = zipfile.ZipFile(importer.file)
meta = json.load(z.open("meta"))
if not meta['full']:
# add
return True
except:
# no meta attribute on broken file
pass
# if old file or full collection, we have to prompt user
diag = askUserDialog(_("""\ diag = askUserDialog(_("""\
Would you like to add to your collection, or replace it?"""), Would you like to add to your collection, or replace it?"""),
[_("Add"), [_("Add"),