Changeset 496:0dadad5a93b8 for src/mlx
- Timestamp:
- 04/06/13 14:06:45 (12 years ago)
- Branch:
- xplane
- Parents:
-
478:00d38a068da9 (diff), 495:9c830f5791a5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Location:
- src/mlx
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/checks.py
r478 r496 1382 1382 if state.groundSpeed>50: 1383 1383 SpeedChecker.logSpeedFault(flight, state) 1384 else: 1385 self._takeoffState = None 1384 1386 1385 1387 def _checkPushAndTaxi(self, flight, aircraft, state): … … 1426 1428 def isCondition(self, flight, aircraft, oldState, state): 1427 1429 """Check if the fault condition holds.""" 1428 return (flight.stage==const.STAGE_BOARDING and \ 1430 return state.strobeLightsOn is not None and \ 1431 ((flight.stage==const.STAGE_BOARDING and \ 1429 1432 state.strobeLightsOn and state.onTheGround) or \ 1430 1433 (flight.stage==const.STAGE_TAKEOFF and \ … … 1434 1437 not state.strobeLightsOn and not state.onTheGround) or \ 1435 1438 (flight.stage==const.STAGE_PARKING and \ 1436 state.strobeLightsOn and state.onTheGround) 1439 state.strobeLightsOn and state.onTheGround)) 1437 1440 1438 1441 def logFault(self, flight, aircraft, logger, oldState, state): -
src/mlx/checks.py
r480 r496 957 957 """Check if the fault condition holds.""" 958 958 if flight.stage==const.STAGE_CRUISE: 959 bankLimit = 30 959 isDH8DXplane = flight.aircraftType==const.AIRCRAFT_DH8D and \ 960 (flight.fsType==const.SIM_XPLANE10 or 961 flight.fsType==const.SIM_XPLANE9) 962 bankLimit = 35 if isDH8DXplane else 30 960 963 elif flight.stage in [const.STAGE_TAKEOFF, const.STAGE_CLIMB, 961 964 const.STAGE_DESCENT, const.STAGE_LANDING]: … … 968 971 def logFault(self, flight, aircraft, logger, oldState, state): 969 972 """Log the fault.""" 973 message = "Bank too steep (%.1f)" % (state.bank,) 970 974 flight.handleFault(BankChecker, state.timestamp, 971 FaultChecker._appendDuring(flight, "Bank too steep"),975 FaultChecker._appendDuring(flight, message), 972 976 2) 973 977 -
src/mlx/gui/gui.py
r450 r496 14 14 from mlx.gui.callouts import ApproachCalloutsEditor 15 15 from mlx.gui.pirep import PIREPViewer 16 from mlx.gui.bugreport import BugReportDialog 16 17 17 18 import mlx.const as const … … 85 86 86 87 self._sendPIREPCallback = None 88 self._sendBugReportCallback = None 87 89 88 90 self.webHandler = web.Handler() … … 109 111 self._checklistEditor = ChecklistEditor(self) 110 112 self._approachCalloutsEditor = ApproachCalloutsEditor(self) 113 self._bugReportDialog = BugReportDialog(self) 111 114 112 115 menuBar = self._buildMenuBar(accelGroup) … … 993 996 prefsMenuItem.connect("activate", self._editPreferences) 994 997 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) 995 1009 996 1010 viewMenuItem = gtk.MenuItem(xstr("menu_view")) … … 1132 1146 self._setupTimeSync() 1133 1147 self._listenHotkeys() 1148 1149 def _reportBug(self, menuItem): 1150 """Callback for reporting a bug.""" 1151 self._bugReportDialog.run() 1134 1152 1135 1153 def _setupTimeSync(self): … … 1372 1390 callback(returned, result) 1373 1391 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 = callback 1409 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 = None 1420 type = MESSAGETYPE_ERROR 1421 if returned: 1422 if result.success: 1423 type = MESSAGETYPE_INFO 1424 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._sendBugReportCallback 1444 self._sendBugReportCallback = None 1445 if callback is not None: 1446 callback(returned, result) 1447 1374 1448 def _listenHotkeys(self): 1375 1449 """Setup the hotkeys based on the configuration.""" -
src/mlx/gui/gui.py
r491 r496 69 69 self._flight = None 70 70 self._simulator = None 71 self._fsType = None 71 72 self._monitoring = False 72 73 … … 208 209 209 210 @property 211 def fsType(self): 212 """Get the flight simulator type.""" 213 return self._fsType 214 215 @property 210 216 def entranceExam(self): 211 217 """Get whether an entrance exam is about to be taken.""" … … 428 434 self._wizard.connected(fsType, descriptor) 429 435 self._reconnecting = False 436 self._fsType = fsType 430 437 self._listenHotkeys() 431 438 -
src/mlx/gui/monitor.py
r431 r496 376 376 self._navLightsOn.set_sensitive(aircraftState.navLightsOn is True) 377 377 self._antiCollisionLightsOn.set_sensitive(aircraftState.antiCollisionLightsOn) 378 self._strobeLightsOn.set_sensitive(aircraftState.strobeLightsOn )378 self._strobeLightsOn.set_sensitive(aircraftState.strobeLightsOn is True) 379 379 380 380 if self._previousState is None or \ -
src/mlx/gui/monitor.py
r480 r496 226 226 table.attach(label, 0, 1, 8, 9) 227 227 table.attach(self._qnh, 1, 2, 8, 9) 228 229 (label, self._cog) = self._createLabeledEntry("CoG:", 7) 230 table.attach(label, 2, 3, 8, 9) 231 table.attach(self._cog, 3, 4, 8, 9) 228 232 229 233 alignment.add(table) … … 312 316 self._adf2.set_text("-") 313 317 self._qnh.set_text("-") 318 self._cog.set_text("-") 314 319 else: 315 320 self._timestamp.set_text(time.strftime("%H:%M:%S", … … 386 391 self._gearControlDown.set_sensitive(aircraftState.gearControlDown) 387 392 self._gearsDown.set_sensitive(aircraftState.gearsDown) 388 self._spoilersArmed.set_sensitive(aircraftState.spoilersArmed )393 self._spoilersArmed.set_sensitive(aircraftState.spoilersArmed is True) 389 394 self._spoilersExtension.set_text("%.0f" % (aircraftState.spoilersExtension,)) 390 395 self._windSpeed.set_text("%.0f" % (aircraftState.windSpeed,)) … … 404 409 self._adf1.set_text("-" if aircraftState.adf1 is None else aircraftState.adf1) 405 410 self._adf2.set_text("-" if aircraftState.adf2 is None else aircraftState.adf2) 411 self._cog.set_text("%.2f%%" % (aircraftState.cog*100.0,)) 406 412 407 413 #------------------------------------------------------------------------------ -
src/mlx/web.py
r450 r496 13 13 import traceback 14 14 import xml.sax 15 import xmlrpclib 15 16 16 17 #--------------------------------------------------------------------------------------- … … 794 795 #------------------------------------------------------------------------------ 795 796 797 class SendBugReport(Request): 798 """A request to send a bug report to the project homepage.""" 799 _latin2Encoder = codecs.getencoder("iso-8859-2") 800 801 def __init__(self, callback, summary, description, email): 802 """Construct the request for the given bug report.""" 803 super(SendBugReport, self).__init__(callback) 804 self._summary = summary 805 self._description = description 806 self._email = email 807 808 def run(self): 809 """Perform the sending of the bug report.""" 810 serverProxy = xmlrpclib.ServerProxy("http://mlx.varadiistvan.hu/rpc") 811 812 result = Result() 813 result.success = False 814 815 attributes = {} 816 if self._email: 817 attributes["reporter"] = self._email 818 819 result.ticketID = serverProxy.ticket.create(self._summary, self._description, 820 attributes, True) 821 print "Created ticket with ID:", result.ticketID 822 result.success = True 823 824 return result 825 826 #------------------------------------------------------------------------------ 827 796 828 class Handler(threading.Thread): 797 829 """The handler for the web services. … … 835 867 """Send the given ACARS""" 836 868 self._addRequest(SendACARS(callback, acars)) 869 870 def sendBugReport(self, callback, summary, description, email): 871 """Send a bug report with the given data.""" 872 self._addRequest(SendBugReport(callback, summary, description, email)) 837 873 838 874 def run(self):
Note:
See TracChangeset
for help on using the changeset viewer.