Logo Search packages:      
Sourcecode: qa-assistant version File versions  Download package

def qareviewer::QAReviewer::save_as_cb (   self,
  action,
  extra 
)

Save the current review to a file.

Definition at line 358 of file qareviewer.py.

00358                                        :
        '''Save the current review to a file.'''
        fileSelect = gtk.FileSelection(title='Select the file to save the review into.')
        if (os.path.isdir(self.lastSaveFileDir) and
                os.access(self.lastSaveFileDir, os.R_OK|os.X_OK)):
            fileSelect.set_filename(self.lastSaveFileDir)

        filename = None
        response = fileSelect.run()
        try:
            if response == gtk.RESPONSE_OK:
                filename = fileSelect.get_filename()
        finally:
            fileSelect.destroy()
            del fileSelect

        if filename:
            ### FIXME: Check if file exists
            # If so, prompt to overwrite
            self.lastSaveFileDir = os.path.dirname(filename)+'/'
            try:
                self.checklist.publish(filename)
            except IOError, ex:
                errorDialog = gtk.MessageDialog(self.ReviewerWindow,
                        gtk.DIALOG_DESTROY_WITH_PARENT,
                        gtk.MESSAGE_WARNING,
                        gtk.BUTTONS_CLOSE,
                        'We were unable to save the review to the file you'
                        ' specified.  The error was:\n' + ex.msg +
                        '\n\nPlease select again.')
                errorDialog.set_title('Unable to save review')
                errorDialog.set_default_response(gtk.RESPONSE_CLOSE)
                response = errorDialog.run()
                errorDialog.destroy()
            else:
                self.uiManager.groups['modified'].set_sensitive(False)


    #
    # Menu/Toolbar callbacks


Generated by  Doxygen 1.6.0   Back to index