Use the save_image() function to save images so we get an unhandled error if something goes wrong

This commit is contained in:
Kovid Goyal 2016-10-31 00:22:47 +05:30
parent 80b0f18b08
commit 7ab2a87f5f

View File

@ -69,7 +69,8 @@ class ImageView(QDialog):
_('Choose a file to save to'), filters=filters,
all_files=False)
if f:
self.current_img.save(f)
from calibre.utils.img import save_image
save_image(self.current_img.toImage(), f)
def adjust_image(self, factor):
self.label.resize(self.factor * self.current_img.size())
@ -147,7 +148,8 @@ class ImagePopup(object):
if __name__ == '__main__':
import sys
app = QApplication([])
from calibre.gui2 import Application
app = Application([])
p = QPixmap()
p.load(sys.argv[-1])
u = QUrl.fromLocalFile(sys.argv[-1])