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

def functions::BaseQAFunctions::publish_cb (   self,
  action,
  app,
  extra 
)

Publish a review to a file.

Definition at line 158 of file functions.py.

00158                                              :
        '''Publish a review to a file.'''
        # Check that the review is in a completed state
        if self.checklist.resolution == 'Needs-Reviewing':
            msgDialog = gtk.MessageDialog(app.ReviewerWindow,
                    gtk.DIALOG_DESTROY_WITH_PARENT,
                    gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,
                    'You have not checked all items in the checklist so the'
                    ' review is incomplete.  Are you sure you want to submit'
                    ' a review based on the current work?')
            msgDialog.set_title('Incomplete review: submit anyway?')
            msgDialog.set_default_response(gtk.RESPONSE_NO)
            response = msgDialog.run()
            msgDialog.destroy()
            if (response == gtk.RESPONSE_NO or response == gtk.RESPONSE_NONE
                    or response == gtk.RESPONSE_DELETE_EVENT):
                return

        # Select the file to publish a review into
        fileSelect = gtk.FileSelection(
                title = 'Select a file to publish the review into')
        if (os.path.isdir(qaglobals.lastReviewDir) and
                os.access(qaglobals.lastReviewDir, os.R_OK|os.X_OK)):
            fileSelect.set_filename(qaglobals.lastReviewDir)

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

        if filename:
            qaglobals.lastReviewDir = os.path.dirname(filename) + os.path.sep
            try:
                app.reviewView.publish(filename)
            except IOError, msg:
                msgDialog = gtk.MessageDialog(app.ReviewerWindow,
                        gtk.DIALOG_DESTROY_WITH_PARENT,
                        gtk.MESSAGE_QUESTION, gtk.BUTTONS_CLOSE,
                        'The location you selected is not a valid place to'
                        ' save the review.  This could be because you don\'t'
                        ' have permission to write files there, lack of disk'
                        ' space, or some other problem.  Please select'
                        ' another directory to save into.')
                msgDialog.set_title('Not a Writable Location')
                msgDialog.set_default_response(gtk.RESPONSE_NO)
                response = msgDialog.run()
                msgDialog.destroy()
                return
                return


Generated by  Doxygen 1.6.0   Back to index