Changeset 830:d0e4741cda76


Ignore:
Timestamp:
12/30/16 15:39:17 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

A PIREP for a pending flight can be viewed (re #307)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r828 r830  
    383383msgid "flightsel_prehelp_rep_rej"
    384384msgstr ""
    385 "<span color=\"red\">You have %d rejected and %d reported flight(s).</span>\n\n "
     385"<span color=\"red\">You have %d reported and %d rejected flight(s).</span>\n\n "
    386386
    387387msgid "flightsel_help"
     
    24452445
    24462446msgid "pendflt_edit_reported"
    2447 msgstr "_View/Edit..."
     2447msgstr "_Edit..."
    24482448
    24492449msgid "pendflt_refly_reported"
     
    24562456msgstr "Rejected"
    24572457
    2458 msgid "pendflt_edit_rejected"
    2459 msgstr "V_iew/Edit..."
     2458msgid "pendflt_view_rejected"
     2459msgstr "_View..."
    24602460
    24612461msgid "pendflt_refly_rejected"
    2462 msgstr "R_efly"
     2462msgstr "Re_fly"
    24632463
    24642464msgid "pendflt_delete_rejected"
  • locale/hu/mlx.po

    r828 r830  
    383383msgid "flightsel_prehelp_rep_rej"
    384384msgstr ""
    385 "<span color=\"red\">%d visszautasított és %d jelentett járatod van.</span>\n\n "
     385"<span color=\"red\">%d jelentett és %d visszautasított járatod van.</span>\n\n "
    386386
    387387msgid "flightsel_help"
     
    24732473msgstr "Elutasított"
    24742474
    2475 msgid "pendflt_edit_rejected"
    2476 msgstr "S_zerkesztés..."
     2475msgid "pendflt_view_rejected"
     2476msgstr "_Megtekintés..."
    24772477
    24782478msgid "pendflt_refly_rejected"
  • src/mlx/gui/flightlist.py

    r828 r830  
    243243    ]
    244244
    245     def __init__(self, which, wizard, window):
     245    def __init__(self, which, wizard, window, pirepEditable = False):
    246246        """Construct the frame with the given title."""
    247247        super(PendingFlightsFrame, self).__init__(xstr("pendflt_title_" + which))
     
    250250        self._wizard = wizard
    251251        self._window = window
     252        self._pirepEditable = pirepEditable
    252253
    253254        alignment = gtk.Alignment(xscale = 1.0, yscale = 1.0)
     
    267268        buttonBox = gtk.VBox()
    268269
    269         self._editButton = gtk.Button(xstr("pendflt_edit_" + which))
     270        self._editButton = gtk.Button(xstr("pendflt_" +
     271                                           ("edit" if pirepEditable else
     272                                            "view") + "_" + which))
    270273        self._editButton.set_sensitive(False)
     274        self._editButton.connect("clicked", self._editClicked)
    271275        buttonBox.pack_start(self._editButton, False, False, 2)
    272276
     
    306310        self._reflyButton.set_sensitive(len(selectedIndexes)>0)
    307311        self._deleteButton.set_sensitive(len(selectedIndexes)>0)
     312
     313    def _editClicked(self, button):
     314        """Called when the Edit button is clicked."""
     315        gui = self._wizard.gui
     316        gui.beginBusy(xstr("pendflt_pirep_busy"))
     317        self.set_sensitive(False)
     318
     319        indexes = self._flightList.selectedIndexes
     320        assert(len(indexes)==1)
     321
     322        flightID = self._flights[indexes[0]].id
     323        gui.webHandler.getPIREP(self._pirepResultCallback, flightID)
     324
     325    def _pirepResultCallback(self, returned, result):
     326        """Called when the PIREP query result is available."""
     327        gobject.idle_add(self._handlePIREPResult, returned, result)
     328
     329    def _handlePIREPResult(self, returned, result):
     330        """Handle the refly result."""
     331
     332        self.set_sensitive(True)
     333        gui = self._wizard.gui
     334        gui.endBusy()
     335
     336        if returned:
     337            if self._pirepEditable:
     338                gui.editPIREP(result.pirep)
     339            else:
     340                gui.viewPIREP(result.pirep)
    308341
    309342    def _reflyClicked(self, button):
     
    408441        vbox = gtk.VBox()
    409442
    410         self._reportedFrame = PendingFlightsFrame("reported", wizard, self)
     443        self._reportedFrame = PendingFlightsFrame("reported", wizard, self,
     444                                                  True)
    411445        vbox.pack_start(self._reportedFrame, True, True, 2)
    412446
  • src/mlx/gui/gui.py

    r805 r830  
    12521252            else:
    12531253                simulator.disableTimeSync()
     1254
     1255    def viewPIREP(self, pirep):
     1256        """Display the PIREP viewer window with the given PIREP."""
     1257        self._pirepViewer.setPIREP(pirep)
     1258        self._pirepViewer.show_all()
     1259        self._pirepViewer.run()
     1260        self._pirepViewer.hide()
     1261
     1262    def editPIREP(self, pirep):
     1263        """Display the PIREP editor window and allow editing the PIREP."""
     1264        self.viewPIREP(pirep)
    12541265
    12551266    def _loadPIREP(self, menuItem):
Note: See TracChangeset for help on using the changeset viewer.