(self)
Provides a dialog window to allow the user to save the image file.
Provides a dialog window to allow the user to save the image file.
Provides a dialog window to allow the user to save the image file .
def saveImage(self):
        """ Provides a dialog window to allow the user to save the image file.
        """
        imageFile, _ = QFileDialog.getSaveFileName(self,
                "Choose a filename to save the image", "", "Images (*.png)")

        info = QFileInfo(imageFile)

        if info.baseName() != '':
            newImageFile = QFileInfo(info.absoluteDir(),
                    info.baseName() + '.png').absoluteFilePath()

            if not self.finalWidget.pixmap().save(newImageFile, 'PNG'):
                QMessageBox.warning(self, "Cannot save file",
                        "The file could not be saved.",
                        QMessageBox.Cancel, QMessageBox.NoButton,
                        QMessageBox.NoButton)
        else:
            QMessageBox.warning(self, "Cannot save file",
                    "Please enter a valid filename.", QMessageBox.Cancel,
                    QMessageBox.NoButton, QMessageBox.NoButton)
def saveImage ( self ) : imageFile , _ = QFileDialog . getSaveFileName ( self , "Choose a filename to save the image" , "" , "Images (*.png)" ) info = QFileInfo ( imageFile ) if info . baseName ( ) != '' : newImageFile = QFileInfo ( info . absoluteDir ( ) , info . baseName ( ) + '.png' ) . absoluteFilePath ( ) if not self . finalWidget . pixmap ( ) . save ( newImageFile , 'PNG' ) : QMessageBox . warning ( self , "Cannot save file" , "The file could not be saved." , QMessageBox . Cancel , QMessageBox . NoButton , QMessageBox . NoButton ) else : QMessageBox . warning ( self , "Cannot save file" , "Please enter a valid filename." , QMessageBox . Cancel , QMessageBox . NoButton , QMessageBox . NoButton )