Ignore:
Timestamp:
12/10/12 19:28:32 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The basic strobe-less RTO handling logic works (#143)

File:
1 edited

Legend:

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

    r347 r349  
    20072007                                  xscale = 0.0, yscale = 0.0)
    20082008
    2009         table = gtk.Table(5, 4)
     2009        table = gtk.Table(6, 4)
    20102010        table.set_row_spacings(4)
    20112011        table.set_col_spacings(16)
     
    20862086        table.attach(self._v2Unit, 3, 4, 4, 5)
    20872087
     2088        self._rto = gtk.CheckButton(xstr("takeoff_rto"))
     2089        self._rto.set_use_underline(True)
     2090        self._rto.set_tooltip_text(xstr("takeoff_rto_tooltip"))
     2091        self._rto.connect("toggled", self._rtoToggled)
     2092        table.attach(self._rto, 2, 4, 5, 6, ypadding = 8)
     2093
    20882094        self.addCancelFlightButton()
    20892095
     
    21162122        """Get the v2 speed."""
    21172123        return self._v2.get_int()
     2124
     2125    @property
     2126    def rtoIndicated(self):
     2127        """Get whether the pilot has indicated if there was an RTO."""
     2128        return self._rto.get_active()
    21182129
    21192130    def activate(self):
     
    21402151        self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit))
    21412152
     2153        self._rto.set_active(False)
     2154        self._rto.set_sensitive(False)
     2155
    21422156        self._button.set_sensitive(False)
    21432157        self._forwardAllowed = False
     
    21542168        self._vr.reset()
    21552169        self._v2.reset()
     2170
     2171    def setRTOEnabled(self, enabled):
     2172        """Set the RTO checkbox enabled or disabled."""
     2173        if not enabled:
     2174            self._rto.set_active(False)
     2175        self._rto.set_sensitive(enabled)
    21562176
    21572177    def _updateForwardButton(self):
     
    21762196        entry.set_text(entry.get_text().upper())
    21772197        self._valueChanged(entry, arg)
     2198
     2199    def _rtoToggled(self, button):
     2200        """Called when the RTO check button is toggled."""
     2201        self._wizard.rtoToggled(button.get_active())
    21782202
    21792203    def _backClicked(self, button):
     
    29712995        """Get the V2 speed."""
    29722996        return self._takeoffPage.v2
     2997
     2998    @property
     2999    def rtoIndicated(self):
     3000        """Get whether the pilot has indicated that an RTO has occured."""
     3001        return self._takeoffPage.rtoIndicated
    29733002
    29743003    @property
     
    31623191                             callback = callback)
    31633192
     3193    def updateRTO(self):
     3194        """Update the RTO state.
     3195
     3196        The RTO checkbox will be enabled if the flight has an RTO state and the
     3197        comments field contains some text."""
     3198        flight = self.gui.flight
     3199        rtoEnabled = flight is not None and flight.hasRTO and \
     3200                     self.gui.hasComments
     3201        self._takeoffPage.setRTOEnabled(rtoEnabled)
     3202
     3203    def rtoToggled(self, indicated):
     3204        """Called when the RTO indication has changed."""
     3205        self.gui.rtoToggled(indicated)
     3206
    31643207    def _connectSimulator(self):
    31653208        """Connect to the simulator."""
     
    31793222
    31803223#-----------------------------------------------------------------------------
    3181 
Note: See TracChangeset for help on using the changeset viewer.