Changeset 484:e6fc7bff478b for src/mlx/gui
- Timestamp:
- 03/31/13 09:33:45 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/bugreport.py
r483 r484 97 97 def run(self): 98 98 """Run the checklist editor dialog.""" 99 self.set_sensitive(True) 100 self._description.set_sensitive(True) 99 101 self._updateButtons() 100 102 self._sendButton.grab_default() 101 103 self.show_all() 102 104 response = super(BugReportDialog, self).run() 103 self.hide() 105 106 print "response", response, RESPONSETYPE_ACCEPT 107 if response==RESPONSETYPE_ACCEPT: 108 self._send() 109 else: 110 self.hide() 104 111 105 112 def _summaryChanged(self, entry): … … 110 117 """Update the sensitivity of the buttoms.""" 111 118 self._sendButton.set_sensitive(self._summary.get_text()!="") 119 120 def _send(self): 121 """Send the bug report.""" 122 descriptionBuffer = self._description.get_buffer() 123 description = \ 124 descriptionBuffer.get_text(descriptionBuffer.get_start_iter(), 125 descriptionBuffer.get_end_iter(), 126 False) 127 self.set_sensitive(False) 128 self._gui.sendBugReport(self._summary.get_text(), 129 description, 130 self._email.get_text(), 131 self._bugReportSent) 132 133 def _bugReportSent(self, returned, result): 134 """Called when the bug report was sent.""" 135 self.set_sensitive(True) 136 self._description.set_sensitive(True) 137 if returned and result.success: 138 self.hide() 139 self._summary.set_text("") 140 self._description.get_buffer().set_text("") 141 self._email.set_text("") 142 else: 143 self.run() -
src/mlx/gui/gui.py
r483 r484 85 85 86 86 self._sendPIREPCallback = None 87 self._sendBugReportCallback = None 87 88 88 89 self.webHandler = web.Handler() … … 109 110 self._checklistEditor = ChecklistEditor(self) 110 111 self._approachCalloutsEditor = ApproachCalloutsEditor(self) 111 self._bug reportDialog = BugReportDialog(self)112 self._bugReportDialog = BugReportDialog(self) 112 113 113 114 menuBar = self._buildMenuBar(accelGroup) … … 1141 1142 def _reportBug(self, menuItem): 1142 1143 """Callback for reporting a bug.""" 1143 self._bug reportDialog.run()1144 self._bugReportDialog.run() 1144 1145 1145 1146 def _setupTimeSync(self): … … 1382 1383 callback(returned, result) 1383 1384 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 1384 1428 def _listenHotkeys(self): 1385 1429 """Setup the hotkeys based on the configuration."""
Note:
See TracChangeset
for help on using the changeset viewer.