mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
make sure we can write the deck, so we can warn w/ apkg too
This commit is contained in:
parent
e89ccaa18b
commit
5ba108b53b
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
# Copyright: Damien Elmes <anki@ichi2.net>
|
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import os
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
import anki, aqt, aqt.tagedit
|
import anki, aqt, aqt.tagedit
|
||||||
from aqt.utils import getSaveFile, tooltip, showWarning
|
from aqt.utils import getSaveFile, tooltip, showWarning
|
||||||
|
@ -53,10 +54,13 @@ class ExportDialog(QDialog):
|
||||||
self.exporter.did = self.col.decks.id(name)
|
self.exporter.did = self.col.decks.id(name)
|
||||||
self.mw.progress.start(immediate=True)
|
self.mw.progress.start(immediate=True)
|
||||||
try:
|
try:
|
||||||
self.exporter.exportInto(file)
|
f = open(file, "wb")
|
||||||
|
f.close()
|
||||||
except (OSError, IOError), e:
|
except (OSError, IOError), e:
|
||||||
showWarning(_("Couldn't save file: %s") % unicode(e))
|
showWarning(_("Couldn't save file: %s") % unicode(e))
|
||||||
else:
|
else:
|
||||||
|
os.unlink(file)
|
||||||
|
self.exporter.exportInto(file)
|
||||||
tooltip(_("%d exported.") % self.exporter.count)
|
tooltip(_("%d exported.") % self.exporter.count)
|
||||||
finally:
|
finally:
|
||||||
self.mw.progress.finish()
|
self.mw.progress.finish()
|
||||||
|
|
Loading…
Reference in a new issue