mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -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 *
|
||||
import anki, aqt, aqt.tagedit
|
||||
from aqt.utils import getSaveFile, tooltip
|
||||
from aqt.utils import getSaveFile, tooltip, showWarning
|
||||
from anki.exporting import exporters
|
||||
|
||||
class ExportDialog(QDialog):
|
||||
|
|
@ -52,7 +52,12 @@ class ExportDialog(QDialog):
|
|||
name = self.decks[self.frm.deck.currentIndex()]
|
||||
self.exporter.did = self.col.decks.id(name)
|
||||
self.mw.progress.start(immediate=True)
|
||||
self.exporter.exportInto(file)
|
||||
self.mw.progress.finish()
|
||||
tooltip(_("%d exported.") % self.exporter.count)
|
||||
try:
|
||||
self.exporter.exportInto(file)
|
||||
except (OSError, IOError), e:
|
||||
showWarning(_("Couldn't save file: %s") % unicode(e))
|
||||
else:
|
||||
tooltip(_("%d exported.") % self.exporter.count)
|
||||
finally:
|
||||
self.mw.progress.finish()
|
||||
QDialog.accept(self)
|
||||
|
|
|
|||
Loading…
Reference in a new issue