From c64f5130e2808f6c466b505e936a99e9f5c04b70 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 24 Oct 2012 18:07:46 +0900 Subject: [PATCH] skip add/replace prompt when importing 1-deck apkg --- aqt/importing.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aqt/importing.py b/aqt/importing.py index 9e228b5b7..eed3008a4 100644 --- a/aqt/importing.py +++ b/aqt/importing.py @@ -315,6 +315,17 @@ Unable to import from a read-only file.""")) mw.reset() 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(_("""\ Would you like to add to your collection, or replace it?"""), [_("Add"),