- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r496 r450 14 14 from mlx.gui.callouts import ApproachCalloutsEditor 15 15 from mlx.gui.pirep import PIREPViewer 16 from mlx.gui.bugreport import BugReportDialog17 16 18 17 import mlx.const as const … … 86 85 87 86 self._sendPIREPCallback = None 88 self._sendBugReportCallback = None89 87 90 88 self.webHandler = web.Handler() … … 111 109 self._checklistEditor = ChecklistEditor(self) 112 110 self._approachCalloutsEditor = ApproachCalloutsEditor(self) 113 self._bugReportDialog = BugReportDialog(self)114 111 115 112 menuBar = self._buildMenuBar(accelGroup) … … 996 993 prefsMenuItem.connect("activate", self._editPreferences) 997 994 toolsMenu.append(prefsMenuItem) 998 999 toolsMenu.append(gtk.SeparatorMenuItem())1000 1001 bugReportMenuItem = gtk.ImageMenuItem(gtk.STOCK_PASTE)1002 bugReportMenuItem.set_use_stock(True)1003 bugReportMenuItem.set_label(xstr("menu_tools_bugreport"))1004 bugReportMenuItem.add_accelerator("activate", accelGroup,1005 ord(xstr("menu_tools_bugreport_key")),1006 CONTROL_MASK, ACCEL_VISIBLE)1007 bugReportMenuItem.connect("activate", self._reportBug)1008 toolsMenu.append(bugReportMenuItem)1009 995 1010 996 viewMenuItem = gtk.MenuItem(xstr("menu_view")) … … 1146 1132 self._setupTimeSync() 1147 1133 self._listenHotkeys() 1148 1149 def _reportBug(self, menuItem):1150 """Callback for reporting a bug."""1151 self._bugReportDialog.run()1152 1134 1153 1135 def _setupTimeSync(self): … … 1390 1372 callback(returned, result) 1391 1373 1392 def sendBugReport(self, summary, description, email, callback = None):1393 """Send the bug report with the given data."""1394 description += "\n\n" + ("=" * 40)1395 description += "\n\nThe contents of the log:\n\n"1396 1397 for (timestampString, text) in self._logger.lines:1398 description += unicode(formatFlightLogLine(timestampString, text))1399 1400 description += "\n\n" + ("=" * 40)1401 description += "\n\nThe contents of the debug log:\n\n"1402 1403 buffer = self._debugLogView.get_buffer()1404 description += buffer.get_text(buffer.get_start_iter(),1405 buffer.get_end_iter(), True)1406 1407 self.beginBusy(xstr("sendBugReport_busy"))1408 self._sendBugReportCallback = callback1409 self.webHandler.sendBugReport(self._bugReportSentCallback,1410 summary, description, email)1411 1412 def _bugReportSentCallback(self, returned, result):1413 """Callback function for the bug report sending result."""1414 gobject.idle_add(self._handleBugReportSent, returned, result)1415 1416 def _handleBugReportSent(self, returned, result):1417 """Callback for the bug report sending result."""1418 self.endBusy()1419 secondaryMarkup = None1420 type = MESSAGETYPE_ERROR1421 if returned:1422 if result.success:1423 type = MESSAGETYPE_INFO1424 messageFormat = xstr("sendBugReport_success") % (result.ticketID,)1425 secondaryMarkup = xstr("sendBugReport_success_sec")1426 else:1427 messageFormat = xstr("sendBugReport_error")1428 secondaryMarkup = xstr("sendBugReport_siteerror_sec")1429 else:1430 messageFormat = xstr("sendBugReport_error")1431 secondaryMarkup = xstr("sendBugReport_error_sec")1432 1433 dialog = gtk.MessageDialog(parent = self._wizard.gui._bugReportDialog,1434 type = type, message_format = messageFormat)1435 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1436 dialog.set_title(WINDOW_TITLE_BASE)1437 if secondaryMarkup is not None:1438 dialog.format_secondary_markup(secondaryMarkup)1439 1440 dialog.run()1441 dialog.hide()1442 1443 callback = self._sendBugReportCallback1444 self._sendBugReportCallback = None1445 if callback is not None:1446 callback(returned, result)1447 1448 1374 def _listenHotkeys(self): 1449 1375 """Setup the hotkeys based on the configuration."""
Note:
See TracChangeset
for help on using the changeset viewer.