diff --git a/aqt/main.py b/aqt/main.py index 6a8fc970a..5bb1b2e4c 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -322,6 +322,10 @@ the manual for information on how to restore from an automatic backup.")) def backup(self): nbacks = self.pm.profile['numBackups'] + if self.pm.profile.get('compressBackups', True): + zipStorage = zipfile.ZIP_DEFLATED + else: + zipStorage = zipfile.ZIP_STORED if not nbacks or os.getenv("ANKIDEV", 0): return dir = self.pm.backupFolder() @@ -342,7 +346,7 @@ the manual for information on how to restore from an automatic backup.")) n = backups[-1][0] + 1 # do backup newpath = os.path.join(dir, "backup-%d.apkg" % n) - z = zipfile.ZipFile(newpath, "w", zipfile.ZIP_DEFLATED) + z = zipfile.ZipFile(newpath, "w", zipStorage) z.write(path, "collection.anki2") z.writestr("media", "{}") z.close() diff --git a/aqt/preferences.py b/aqt/preferences.py index 19d2c2ba6..1fc4465cd 100644 --- a/aqt/preferences.py +++ b/aqt/preferences.py @@ -112,6 +112,7 @@ Not currently enabled; click the sync button in the main window to enable.""")) def setupBackup(self): self.form.numBackups.setValue(self.prof['numBackups']) + self.form.compressBackups.setChecked(self.prof.get("compressBackups", True)) self.connect(self.form.openBackupFolder, SIGNAL("linkActivated(QString)"), self.onOpenBackup) @@ -121,6 +122,7 @@ Not currently enabled; click the sync button in the main window to enable.""")) def updateBackup(self): self.prof['numBackups'] = self.form.numBackups.value() + self.prof['compressBackups'] = self.form.compressBackups.isChecked() # Basic & Advanced Options ###################################################################### diff --git a/designer/preferences.ui b/designer/preferences.ui index 03b96e11f..186314b9a 100644 --- a/designer/preferences.ui +++ b/designer/preferences.ui @@ -349,6 +349,13 @@ + + + + Compress backups (slower) + + +