Changeset 853:28eb49544c0f for src/mlx/gui
- Timestamp:
- 05/21/17 07:42:48 (8 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r845 r853 1266 1266 self._pirepEditor.setPIREP(pirep) 1267 1267 self._pirepEditor.show_all() 1268 self._pirepEditor.run() 1268 if self._pirepEditor.run()==RESPONSETYPE_OK: 1269 self.beginBusy(xstr("pirepEdit_save_busy")) 1270 self.webHandler.sendPIREP(self._pirepUpdatedCallback, pirep, 1271 update = True) 1272 else: 1273 self._pirepEditor.hide() 1274 1275 def _pirepUpdatedCallback(self, returned, result): 1276 """Callback for the PIREP updating result.""" 1277 gobject.idle_add(self._handlePIREPUpdated, returned, result) 1278 1279 def _handlePIREPUpdated(self, returned, result): 1280 """Callback for the PIREP updating result.""" 1281 self.endBusy() 1282 secondaryMarkup = None 1283 type = MESSAGETYPE_ERROR 1284 if returned: 1285 if result.success: 1286 type = None 1287 elif result.alreadyFlown: 1288 messageFormat = xstr("sendPIREP_already") 1289 secondaryMarkup = xstr("sendPIREP_already_sec") 1290 elif result.notAvailable: 1291 messageFormat = xstr("sendPIREP_notavail") 1292 else: 1293 messageFormat = xstr("sendPIREP_unknown") 1294 secondaryMarkup = xstr("sendPIREP_unknown_sec") 1295 else: 1296 print "PIREP sending failed", result 1297 messageFormat = xstr("sendPIREP_failed") 1298 secondaryMarkup = xstr("sendPIREP_failed_sec") 1299 1300 if type is not None: 1301 dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1302 type = type, message_format = messageFormat) 1303 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 1304 dialog.set_title(WINDOW_TITLE_BASE) 1305 if secondaryMarkup is not None: 1306 dialog.format_secondary_markup(secondaryMarkup) 1307 1308 dialog.run() 1309 dialog.hide() 1310 1269 1311 self._pirepEditor.hide() 1270 1312 -
src/mlx/gui/pirep.py
r849 r853 720 720 self.add_button(xstr("button_cancel"), RESPONSETYPE_CANCEL) 721 721 722 self._okButton = self.add_button(xstr("button_save"), RESPONSETYPE_OK) 722 self._okButton = self.add_button(xstr("button_save"), RESPONSETYPE_NONE) 723 self._okButton.connect("clicked", self._okClicked) 723 724 self._okButton.set_can_default(True) 724 725 self._modified = False 726 self._toSave = False 725 727 726 728 def setPIREP(self, pirep): … … 846 848 self._updateButtons() 847 849 self._modified = True 850 self._toSave = False 848 851 849 852 def delayCodesChanged(self): … … 1363 1366 self._approachType.get_text()!="") 1364 1367 1368 def _okClicked(self, button): 1369 """Called when the OK button has been clicked. 1370 1371 The PIREP is updated from the data in the window.""" 1372 if not askYesNo(xstr("pirepEdit_save_question"), parent = self): 1373 self.response(RESPONSETYPE_CANCEL) 1374 1375 pirep = self._pirep 1376 1377 pirep.filedCruiseAltitude = \ 1378 self._filedCruiseLevel.get_value_as_int() * 100 1379 pirep.cruiseAltitude = \ 1380 self._modifiedCruiseLevel.get_value_as_int() * 100 1381 1382 pirep.route = getTextViewText(self._userRoute) 1383 1384 pirep.departureMETAR = getTextViewText(self._departureMETAR) 1385 pirep.departureRunway = self._departureRunway.get_text() 1386 pirep.sid = self._sid.get_child().get_text() 1387 1388 pirep.arrivalMETAR = getTextViewText(self._arrivalMETAR) 1389 pirep.star = None if self._star.get_active()==0 \ 1390 else self._star.get_child().get_text() 1391 pirep.transition = None if self._transition.get_active()==0 \ 1392 else self._transition.get_child().get_text() 1393 pirep.approachType = self._approachType.get_text() 1394 pirep.arrivalRunway = self._arrivalRunway.get_text() 1395 1396 pirep.blockTimeStart = \ 1397 self._blockTimeStart.getTimestampFrom(pirep.blockTimeStart) 1398 pirep.blockTimeEnd = \ 1399 self._blockTimeEnd.getTimestampFrom(pirep.blockTimeEnd) 1400 pirep.flightTimeStart = \ 1401 self._flightTimeStart.getTimestampFrom(pirep.flightTimeStart) 1402 pirep.flightTimeEnd = \ 1403 self._flightTimeEnd.getTimestampFrom(pirep.flightTimeEnd) 1404 1405 pirep.fuelUsed = self._fuelUsed.get_value() 1406 1407 pirep.numCrew = self._flownNumCrew.get_value() 1408 pirep.numPassengers = self._flownNumPassengers.get_value() 1409 pirep.bagWeight = self._flownBagWeight.get_value() 1410 pirep.cargoWeight = self._flownCargoWeight.get_value() 1411 pirep.mailWeight = self._flownMailWeight.get_value() 1412 1413 pirep.flightType = flightTypes[self._flightType.get_active()] 1414 pirep.online = self._online.get_active() 1415 1416 pirep.delayCodes = self._flightInfo.delayCodes 1417 pirep.comments = self._flightInfo.comments 1418 pirep.flightDefects = self._flightInfo.faultsAndExplanations 1419 1420 self.response(RESPONSETYPE_OK) 1421 1422 1365 1423 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.