mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
option to disable backup compression
This commit is contained in:
parent
46a771def3
commit
647ca8bffa
3 changed files with 14 additions and 1 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
######################################################################
|
||||
|
|
|
@ -349,6 +349,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="compressBackups">
|
||||
<property name="text">
|
||||
<string>Compress backups (slower)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="openBackupFolder">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in a new issue