Ignore:
Timestamp:
05/21/17 07:42:48 (7 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

PIREP modifications can be saved (re #307)

File:
1 edited

Legend:

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

    r845 r853  
    12661266        self._pirepEditor.setPIREP(pirep)
    12671267        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
    12691311        self._pirepEditor.hide()
    12701312
Note: See TracChangeset for help on using the changeset viewer.