mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 13:17:12 -05:00
add a more friendly error when saving to read-only dir
This commit is contained in:
parent
c21c9ab8c3
commit
e89ccaa18b
1 changed files with 9 additions and 4 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
import anki, aqt, aqt.tagedit
|
import anki, aqt, aqt.tagedit
|
||||||
from aqt.utils import getSaveFile, tooltip
|
from aqt.utils import getSaveFile, tooltip, showWarning
|
||||||
from anki.exporting import exporters
|
from anki.exporting import exporters
|
||||||
|
|
||||||
class ExportDialog(QDialog):
|
class ExportDialog(QDialog):
|
||||||
|
|
@ -52,7 +52,12 @@ class ExportDialog(QDialog):
|
||||||
name = self.decks[self.frm.deck.currentIndex()]
|
name = self.decks[self.frm.deck.currentIndex()]
|
||||||
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:
|
||||||
self.exporter.exportInto(file)
|
self.exporter.exportInto(file)
|
||||||
self.mw.progress.finish()
|
except (OSError, IOError), e:
|
||||||
|
showWarning(_("Couldn't save file: %s") % unicode(e))
|
||||||
|
else:
|
||||||
tooltip(_("%d exported.") % self.exporter.count)
|
tooltip(_("%d exported.") % self.exporter.count)
|
||||||
|
finally:
|
||||||
|
self.mw.progress.finish()
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue