check that save to desktop was successful before showing message

This commit is contained in:
Soren I. Bjornstad 2014-06-17 08:44:26 -05:00
parent 6771af40b1
commit 4de023ecba

View File

@ -61,9 +61,14 @@ class DeckStats(QDialog):
painter = QPainter(image) painter = QPainter(image)
p.mainFrame().render(painter) p.mainFrame().render(painter)
painter.end() painter.end()
image.save(path, "png") isOK = image.save(path, "png")
if isOK:
showInfo(_("An image was saved to your desktop."))
else:
showInfo(_("""\
Anki could not save the image. Please check that you have permission to write \
to your desktop."""))
p.setViewportSize(oldsize) p.setViewportSize(oldsize)
showInfo(_("An image was saved to your desktop."))
def changePeriod(self, n): def changePeriod(self, n):
self.period = n self.period = n