Changeset 391:0f2e90eae832 for src/mlx


Ignore:
Timestamp:
12/22/12 08:42:13 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added support for logging the state of the anti-ice system (re #159)

Location:
src/mlx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r384 r391  
    7676        self._v1r2LineIndex = None
    7777        self._derateLineID = None
     78        self._takeoffAntiIceLineID = None
    7879        self._vrefLineIndex = None
     80        self._landingAntiIceLineID = None
    7981
    8082        self.humanWeight = 82.0
     
    294296                self._logV1R2(aircraftState)
    295297                self._logDerate(aircraftState)
     298                self._logTakeoffAntiIce(aircraftState)
    296299            elif newStage==const.STAGE_DESCENT or newStage==const.STAGE_LANDING:
    297300                self._logRadios(aircraftState)
     
    351354                            (self._aircraftState.altimeter,))
    352355        self._logVRef()
     356        self._logLandingAntiIce(self._aircraftState)
    353357        self.flight.flareStarted(flareStart, flareStartFS)
    354358        fs.sendMessage(const.MESSAGETYPE_INFORMATION, "Flare-time", 3)
     
    409413            self._logDerate()
    410414
     415    def updateTakeoffAntiIce(self):
     416        """Update the take-off anti-ice setting."""
     417        if self._takeoffAntiIceLineID is not None:
     418            self._logTakeoffAntiIce()
     419
    411420    def _appendLightsLoggers(self):
    412421        """Append the loggers needed for the lights.
     
    475484        else:
    476485            self.logger.updateLine(self._derateLineID, message)
     486
     487    def _logTakeoffAntiIce(self, state = None):
     488        """Log the take-off anti-ice setting either newly or by updating the
     489        corresponding line."""
     490        antiIceOn = self._flight.takeoffAntiIceOn
     491        if state is not None:
     492            antiIceOn = antiIceOn or state.antiIceOn is True
     493            self._flight.takeoffAntiIceOn = antiIceOn
     494
     495        message = "Anti-ice was turned %s" % \
     496                  ("ON" if antiIceOn else "OFF")
     497
     498        if self._takeoffAntiIceLineID is None:
     499            if state is None:
     500                state = self._aircraftState
     501            self._takeoffAntiIceLineID = \
     502                self.logger.message(state.timestamp, message)
     503        else:
     504            self.logger.updateLine(self._takeoffAntiIceLineID, message)
    477505
    478506    def updateVRef(self):
     
    492520        else:
    493521            self.logger.updateLine(self._vrefLineIndex, message)
     522
     523    def updateLandingAntiIce(self):
     524        """Update the landing anti-ice setting."""
     525        if self._landingAntiIceLineID is not None:
     526            self._logLandingAntiIce()
     527
     528    def _logLandingAntiIce(self, state = None):
     529        """Log the landing anti-ice setting either newly or by updating the
     530        corresponding line."""
     531        antiIceOn = self._flight.landingAntiIceOn
     532        if state is not None:
     533            antiIceOn = antiIceOn or state.antiIceOn is True
     534            self._flight.landingAntiIceOn = antiIceOn
     535
     536        message = "Anti-ice was turned %s" % \
     537                  ("ON" if antiIceOn else "OFF")
     538
     539        if self._landingAntiIceLineID is None:
     540            if state is None:
     541                state = self._aircraftState
     542            self._landingAntiIceLineID = \
     543                self.logger.message(state.timestamp, message)
     544        else:
     545            self.logger.updateLine(self._landingAntiIceLineID, message)
    494546
    495547    def _fleetRetrieved(self, fleet):
  • src/mlx/flight.py

    r384 r391  
    183183
    184184    @property
     185    def takeoffAntiIceOn(self):
     186        """Get whether the anti-ice system was on during takeoff."""
     187        return self._gui.takeoffAntiIceOn
     188
     189    @takeoffAntiIceOn.setter
     190    def takeoffAntiIceOn(self, value):
     191        """Set whether the anti-ice system was on during takeoff."""
     192        self._gui.takeoffAntiIceOn = value
     193
     194    @property
    185195    def derate(self):
    186196        """Get the derate value of the flight."""
     
    211221        """Get the VRef speed of the flight."""
    212222        return self._gui.vref
     223
     224    @property
     225    def landingAntiIceOn(self):
     226        """Get whether the anti-ice system was on during landing."""
     227        return self._gui.landingAntiIceOn
     228
     229    @landingAntiIceOn.setter
     230    def landingAntiIceOn(self, value):
     231        """Set whether the anti-ice system was on during landing."""
     232        self._gui.landingAntiIceOn = value
    213233
    214234    @property
  • src/mlx/gui/flight.py

    r384 r391  
    19991999                                  xscale = 0.0, yscale = 0.0)
    20002000
    2001         table = gtk.Table(7, 4)
     2001        table = gtk.Table(8, 4)
    20022002        table.set_row_spacings(4)
    20032003        table.set_col_spacings(16)
     
    21022102        table.attach(self._derateUnit, 3, 4, 5, 6)
    21032103
     2104        self._antiIceOn = gtk.CheckButton(xstr("takeoff_antiice"))
     2105        self._antiIceOn.set_use_underline(True)
     2106        self._antiIceOn.set_tooltip_text(xstr("takeoff_antiice_tooltip"))
     2107        table.attach(self._antiIceOn, 2, 4, 6, 7)
     2108
    21042109        self._rto = gtk.CheckButton(xstr("takeoff_rto"))
    21052110        self._rto.set_use_underline(True)
    21062111        self._rto.set_tooltip_text(xstr("takeoff_rto_tooltip"))
    21072112        self._rto.connect("toggled", self._rtoToggled)
    2108         table.attach(self._rto, 2, 4, 6, 7, ypadding = 8)
     2113        table.attach(self._rto, 2, 4, 7, 8, ypadding = 8)
    21092114
    21102115        self.addCancelFlightButton()
     
    21472152        else:
    21482153            return None
     2154
     2155    @property
     2156    def antiIceOn(self):
     2157        """Get whether the anti-ice system has been turned on."""
     2158        return self._antiIceOn.get_active()
     2159
     2160    @antiIceOn.setter
     2161    def antiIceOn(self, value):
     2162        """Set the anti-ice indicator."""
     2163        self._antiIceOn.set_active(value)
    21492164
    21502165    @property
     
    22132228        self._vr.reset()
    22142229        self._v2.reset()
    2215 
    22162230        self._hasDerate = False
     2231        self._antiIceOn.set_active(False)
    22172232
    22182233    def setRTOEnabled(self, enabled):
     
    22592274    def _forwardClicked(self, button):
    22602275        """Called when the forward button is clicked."""
    2261         self._wizard.gui.flight.aircraft.updateV1R2()
     2276        aircraft = self._wizard.gui.flight.aircraft
     2277        aircraft.updateV1R2()
    22622278        if self._hasDerate:
    2263             self._wizard.gui.flight.aircraft.updateDerate()
     2279            aircraft.updateDerate()
     2280        aircraft.updateTakeoffAntiIce()
    22642281        self._wizard.nextPage()
    22652282
     
    23932410                                  xscale = 0.0, yscale = 0.0)
    23942411
    2395         table = gtk.Table(5, 5)
     2412        table = gtk.Table(6, 5)
    23962413        table.set_row_spacings(4)
    23972414        table.set_col_spacings(16)
     
    24622479        label.set_use_underline(True)
    24632480        label.set_alignment(0.0, 0.5)
    2464         table.attach(label, 1, 2, 5, 6)
     2481        table.attach(label, 1, 2, 4, 5)
    24652482
    24662483        self._vref = IntegerEntry()
     
    24682485        self._vref.set_tooltip_markup(xstr("landing_vref_tooltip_knots"))
    24692486        self._vref.connect("integer-changed", self._vrefChanged)
    2470         table.attach(self._vref, 3, 4, 5, 6)
     2487        table.attach(self._vref, 3, 4, 4, 5)
    24712488        label.set_mnemonic_widget(self._vref)
    24722489
    24732490        self._vrefUnit = gtk.Label(xstr("label_knots"))
    2474         table.attach(self._vrefUnit, 4, 5, 5, 6)
     2491        table.attach(self._vrefUnit, 4, 5, 4, 5)
     2492
     2493        self._antiIceOn = gtk.CheckButton(xstr("landing_antiice"))
     2494        self._antiIceOn.set_use_underline(True)
     2495        self._antiIceOn.set_tooltip_text(xstr("landing_antiice_tooltip"))
     2496        table.attach(self._antiIceOn, 3, 5, 5, 6)
    24752497
    24762498        self.addCancelFlightButton()
     
    25102532        return self._vref.get_int()
    25112533
     2534    @property
     2535    def antiIceOn(self):
     2536        """Get whether the anti-ice system has been turned on."""
     2537        return self._antiIceOn.get_active()
     2538
     2539    @antiIceOn.setter
     2540    def antiIceOn(self, value):
     2541        """Set the anti-ice indicator."""
     2542        self._antiIceOn.set_active(value)
     2543
    25122544    def reset(self):
    25132545        """Reset the page if the wizard is reset."""
    25142546        super(LandingPage, self).reset()
    25152547        self._vref.reset()
     2548        self._antiIceOn.set_active(False)
    25162549        self._flightEnded = False
    25172550
     
    25952628    def _forwardClicked(self, button):
    25962629        """Called when the forward button is clicked."""
    2597         self._wizard.gui.flight.aircraft.updateVRef()
     2630        aircraft = self._wizard.gui.flight.aircraft
     2631        aircraft.updateVRef()
     2632        aircraft.updateLandingAntiIce()
    25982633        if self._wizard.gui.config.onlineGateSystem and \
    25992634           self._wizard.loggedIn and not self._completed and \
     
    31873222
    31883223    @property
     3224    def takeoffAntiIceOn(self):
     3225        """Get whether the anti-ice system was on during take-off."""
     3226        return self._takeoffPage.antiIceOn
     3227
     3228    @takeoffAntiIceOn.setter
     3229    def takeoffAntiIceOn(self, value):
     3230        """Set anti-ice on indicator."""
     3231        self._takeoffPage.antiIceOn = value
     3232
     3233    @property
    31893234    def rtoIndicated(self):
    31903235        """Get whether the pilot has indicated that an RTO has occured."""
     
    32153260        """Get the Vref speed."""
    32163261        return self._landingPage.vref
     3262
     3263    @property
     3264    def landingAntiIceOn(self):
     3265        """Get whether the anti-ice system was on during landing."""
     3266        return self._landingPage.antiIceOn
     3267
     3268    @landingAntiIceOn.setter
     3269    def landingAntiIceOn(self, value):
     3270        """Set anti-ice on indicator."""
     3271        self._landingPage.antiIceOn = value
    32173272
    32183273    @property
  • src/mlx/gui/gui.py

    r384 r391  
    313313
    314314    @property
     315    def takeoffAntiIceOn(self):
     316        """Get whether the anti-ice system was on during take-off."""
     317        return self._wizard.takeoffAntiIceOn
     318
     319    @takeoffAntiIceOn.setter
     320    def takeoffAntiIceOn(self, value):
     321        """Set the anti-ice on indicator."""
     322        gobject.idle_add(self._setTakeoffAntiIceOn, value)
     323
     324    @property
    315325    def rtoIndicated(self):
    316326        """Get whether the pilot has indicated than an RTO has occured."""
     
    341351        """Get the Vref speed calculated for the flight."""
    342352        return self._wizard.vref
     353
     354    @property
     355    def landingAntiIceOn(self):
     356        """Get whether the anti-ice system was on during landing."""
     357        return self._wizard.landingAntiIceOn
     358
     359    @landingAntiIceOn.setter
     360    def landingAntiIceOn(self, value):
     361        """Set the anti-ice on indicator."""
     362        gobject.idle_add(self._setLandingAntiIceOn, value)
    343363
    344364    @property
     
    14381458        """Show the about URL."""
    14391459        webbrowser.open(url = link, new = 1)
     1460
     1461    def _setTakeoffAntiIceOn(self, value):
     1462        """Set the anti-ice on indicator."""
     1463        self._wizard.takeoffAntiIceOn = value
     1464
     1465    def _setLandingAntiIceOn(self, value):
     1466        """Set the anti-ice on indicator."""
     1467        self._wizard.landingAntiIceOn = value
Note: See TracChangeset for help on using the changeset viewer.