Ignore:
Timestamp:
03/31/13 09:33:45 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented the GUI logic of the bug report sending (re #190)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/gui.py

    r483 r484  
    8585
    8686        self._sendPIREPCallback = None
     87        self._sendBugReportCallback = None
    8788
    8889        self.webHandler = web.Handler()
     
    109110        self._checklistEditor = ChecklistEditor(self)
    110111        self._approachCalloutsEditor = ApproachCalloutsEditor(self)
    111         self._bugreportDialog = BugReportDialog(self)
     112        self._bugReportDialog = BugReportDialog(self)
    112113
    113114        menuBar = self._buildMenuBar(accelGroup)
     
    11411142    def _reportBug(self, menuItem):
    11421143        """Callback for reporting a bug."""
    1143         self._bugreportDialog.run()
     1144        self._bugReportDialog.run()
    11441145
    11451146    def _setupTimeSync(self):
     
    13821383            callback(returned, result)
    13831384
     1385    def sendBugReport(self, summary, description, email, callback = None):
     1386        """Send the bug report with the given data."""
     1387        self.beginBusy(xstr("sendBugReport_busy"))
     1388        self._sendBugReportCallback = callback
     1389        self.webHandler.sendBugReport(self._bugReportSentCallback,
     1390                                      summary, description, email)
     1391
     1392    def _bugReportSentCallback(self, returned, result):
     1393        """Callback function for the bug report sending result."""
     1394        gobject.idle_add(self._handleBugReportSent, returned, result)
     1395
     1396    def _handleBugReportSent(self, returned, result):
     1397        """Callback for the bug report sending result."""
     1398        self.endBusy()
     1399        secondaryMarkup = None
     1400        type = MESSAGETYPE_ERROR
     1401        if returned:
     1402            if result.success:
     1403                type = MESSAGETYPE_INFO
     1404                messageFormat = xstr("sendBugReport_success")
     1405                secondaryMarkup = xstr("sendBugReport_success_sec")
     1406            else:
     1407                messageFormat = xstr("sendBugReport_error")
     1408                secondaryMarkup = xstr("sendBugReport_siteerror_sec")
     1409        else:
     1410            messageFormat = xstr("sendBugReport_error")
     1411            secondaryMarkup = xstr("sendBugReport_error_sec")
     1412
     1413        dialog = gtk.MessageDialog(parent = self._wizard.gui._bugReportDialog,
     1414                                   type = type, message_format = messageFormat)
     1415        dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1416        dialog.set_title(WINDOW_TITLE_BASE)
     1417        if secondaryMarkup is not None:
     1418            dialog.format_secondary_markup(secondaryMarkup)
     1419
     1420        dialog.run()
     1421        dialog.hide()
     1422
     1423        callback = self._sendBugReportCallback
     1424        self._sendBugReportCallback = None
     1425        if callback is not None:
     1426            callback(returned, result)
     1427
    13841428    def _listenHotkeys(self):
    13851429        """Setup the hotkeys based on the configuration."""
Note: See TracChangeset for help on using the changeset viewer.