Changeset 384:97052bda0e22


Ignore:
Timestamp:
12/21/12 16:50:01 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented support for entering derate values (#158)

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r383 r384  
    768768msgstr "The takeoff safety speed in km/h."
    769769
     770msgid "takeoff_derate"
     771msgstr "Derate:"
     772
     773msgid "takeoff_derate_boeing"
     774msgstr "Der_ate:"
     775
     776msgid "takeoff_derate_tupolev"
     777msgstr "N_ominal/takeoff:"
     778
     779msgid "takeoff_derate_tooltip"
     780msgstr "Enter the takeoff derate parameter."
     781
    770782msgid "takeoff_rto"
    771783msgstr "R_ejected takeoff"
  • locale/hu/mlx.po

    r383 r384  
    769769msgstr "A biztonságos emelkedési sebesség km/órában."
    770770
     771msgid "takeoff_derate"
     772msgstr "Teljesítménycsökkentés:"
     773
     774msgid "takeoff_derate_boeing"
     775msgstr "Teljesítménycsökkentés:"
     776
     777msgid "takeoff_derate_tupolev"
     778msgstr "Névleges/felszállási:"
     779
     780msgid "takeoff_derate_tooltip"
     781msgstr "Írd be a felszállási teljesítménycsökkentés értékét."
     782
    771783msgid "takeoff_rto"
    772784msgstr "_Megszakított felszállás"
  • src/mlx/acft.py

    r369 r384  
    33import checks
    44import fs
     5from i18n import xstr
    56import util
    67
     
    7475
    7576        self._v1r2LineIndex = None
     77        self._derateLineID = None
    7678        self._vrefLineIndex = None
    7779
     
    197199        return None if self._aircraftState is None \
    198200               else self._aircraftState.timestamp
     201
     202    @property
     203    def derateLabels(self):
     204        """Get the strings related to the derate entry.
     205
     206        It returns a tuple of two items:
     207        - the label before the entry field,
     208        - the label after the entry field, which can be None.
     209
     210        If both labels are None, the derate value will not be logged or
     211        queried. This is the default."""
     212        return (None, None)
     213
     214    @property
     215    def derateTemplate(self):
     216        """Get the template for logging the derate value.
     217
     218        If it returns None (which is the default), no derate value will be
     219        logged."""
     220        return None
    199221
    200222    def getFlapsSpeedLimit(self, flaps):
     
    271293                self._logRadios(aircraftState)
    272294                self._logV1R2(aircraftState)
     295                self._logDerate(aircraftState)
    273296            elif newStage==const.STAGE_DESCENT or newStage==const.STAGE_LANDING:
    274297                self._logRadios(aircraftState)
     
    380403            self._logV1R2()
    381404
     405    def updateDerate(self):
     406        """Update the derate value from the flight, if the these values
     407        have already been logged."""
     408        if self._derateLineID is not None:
     409            self._logDerate()
     410
    382411    def _appendLightsLoggers(self):
    383412        """Append the loggers needed for the lights.
     
    429458        else:
    430459            self.logger.updateLine(self._v1r2LineIndex, message)
     460
     461    def _logDerate(self, state = None):
     462        """Log the derate values either newly or by updating the corresponding
     463        line."""
     464        derateTemplate = self.derateTemplate
     465        if derateTemplate is None:
     466            return
     467
     468        derate = self._flight.derate
     469        message = derateTemplate % ("-" if derate is None else derate)
     470        if self._derateLineID is None:
     471            if state is None:
     472                state = self._aircraftState
     473            self._derateLineID = \
     474                self.logger.message(state.timestamp, message)
     475        else:
     476            self.logger.updateLine(self._derateLineID, message)
    431477
    432478    def updateVRef(self):
     
    502548                                 40 : 162 }
    503549
     550    @property
     551    def derateLabels(self):
     552        """Get the derate strings for this type."""
     553        return (xstr("takeoff_derate_boeing"), "%")
     554
     555    @property
     556    def derateTemplate(self):
     557        """Get the derate template for this aicraft type."""
     558        return "Derate calculated by the pilot: %s %%"
     559
    504560    # def _appendSpeedChecker(self):
    505561    #     """Append the NoStrobeSpeedChecker to the checkers.
     
    626682                                 25 : 185,
    627683                                 30 : 175 }
     684
     685    @property
     686    def derateLabels(self):
     687        """Get the derate strings for this type."""
     688        return (xstr("takeoff_derate_boeing"), "%")
     689
     690    @property
     691    def derateTemplate(self):
     692        """Get the derate template for this aicraft type."""
     693        return "Derate calculated by the pilot: %s %%"
    628694
    629695#---------------------------------------------------------------------------------------
     
    697763        self.reverseMinSpeed = 50
    698764
     765    @property
     766    def derateLabels(self):
     767        """Get the derate strings for this type."""
     768        return ("EPR", None)
     769
     770    @property
     771    def derateTemplate(self):
     772        """Get the derate template for this aicraft type."""
     773        return "EPR calculated by the pilot: %s"
     774
    699775#---------------------------------------------------------------------------------------
    700776
     
    751827
    752828    @property
     829    def derateLabels(self):
     830        """Get the derate strings for this type."""
     831        return (xstr("takeoff_derate_tupolev"), None)
     832
     833    @property
     834    def derateTemplate(self):
     835        """Get the derate template for this aicraft type."""
     836        return "Nominal/takeoff power calculated by the pilot: %s"
     837
     838    @property
    753839    def speedInKnots(self):
    754840        """Indicate if the speed is in knots."""
     
    798884        return False
    799885
     886    @property
     887    def derateLabels(self):
     888        """Get the derate strings for this type."""
     889        return (xstr("takeoff_derate_tupolev"), None)
     890
     891    @property
     892    def derateTemplate(self):
     893        """Get the derate template for this aicraft type."""
     894        return "Nominal/takeoff power calculated by the pilot: %s"
     895
    800896    def _appendLightsLoggers(self):
    801897        """Append the loggers needed for the lights."""
     
    811907
    812908#---------------------------------------------------------------------------------------
    813 
    814909
    815910class YK40(Aircraft):
     
    836931        """Indicate if the speed is in knots."""
    837932        return False
     933
     934    @property
     935    def derateLabels(self):
     936        """Get the derate strings for this type."""
     937        return (xstr("takeoff_derate_tupolev"), None)
     938
     939    @property
     940    def derateTemplate(self):
     941        """Get the derate template for this aicraft type."""
     942        return "Nominal/takeoff power calculated by the pilot: %s"
    838943
    839944    def _appendLightsLoggers(self):
  • src/mlx/flight.py

    r383 r384  
    181181        """Get the V2 speed of the flight."""
    182182        return self._gui.v2
     183
     184    @property
     185    def derate(self):
     186        """Get the derate value of the flight."""
     187        return self._gui.derate
    183188
    184189    @property
  • src/mlx/gui/flight.py

    r383 r384  
    19991999                                  xscale = 0.0, yscale = 0.0)
    20002000
    2001         table = gtk.Table(6, 4)
     2001        table = gtk.Table(7, 4)
    20022002        table.set_row_spacings(4)
    20032003        table.set_col_spacings(16)
     
    20442044
    20452045        self._v1Unit = gtk.Label(xstr("label_knots"))
     2046        self._v1Unit.set_alignment(0.0, 0.5)
    20462047        table.attach(self._v1Unit, 3, 4, 2, 3)
    20472048
     
    20602061
    20612062        self._vrUnit = gtk.Label(xstr("label_knots"))
     2063        self._vrUnit.set_alignment(0.0, 0.5)
    20622064        table.attach(self._vrUnit, 3, 4, 3, 4)
    20632065
     
    20762078
    20772079        self._v2Unit = gtk.Label(xstr("label_knots"))
     2080        self._v2Unit.set_alignment(0.0, 0.5)
    20782081        table.attach(self._v2Unit, 3, 4, 4, 5)
     2082
     2083        self._hasDerate = False
     2084
     2085        self._derateLabel = gtk.Label()
     2086        self._derateLabel.set_use_underline(True)
     2087        self._derateLabel.set_markup(xstr("takeoff_derate_tupolev"))
     2088        self._derateLabel.set_alignment(0.0, 0.5)
     2089        table.attach(self._derateLabel, 0, 1, 5, 6)
     2090
     2091        self._derate = gtk.Entry()
     2092        self._derate.set_width_chars(10)
     2093        self._derate.set_tooltip_text(xstr("takeoff_derate_tooltip"))
     2094        self._derate.set_alignment(1.0)
     2095        self._derate.connect("changed", self._derateChanged)
     2096        table.attach(self._derate, 1, 3, 5, 6)
     2097        self._derateLabel.set_mnemonic_widget(self._derate)
     2098
     2099        self._derateUnit = gtk.Label("")
     2100        self._derateUnit.set_use_markup(True)
     2101        self._derateUnit.set_alignment(0.0, 0.5)
     2102        table.attach(self._derateUnit, 3, 4, 5, 6)
    20792103
    20802104        self._rto = gtk.CheckButton(xstr("takeoff_rto"))
     
    20822106        self._rto.set_tooltip_text(xstr("takeoff_rto_tooltip"))
    20832107        self._rto.connect("toggled", self._rtoToggled)
    2084         table.attach(self._rto, 2, 4, 5, 6, ypadding = 8)
     2108        table.attach(self._rto, 2, 4, 6, 7, ypadding = 8)
    20852109
    20862110        self.addCancelFlightButton()
     
    21142138        """Get the v2 speed."""
    21152139        return self._v2.get_int()
     2140
     2141    @property
     2142    def derate(self):
     2143        """Get the derate value, if any."""
     2144        if self._hasDerate:
     2145            derate = self._derate.get_text()
     2146            return derate if derate else None
     2147        else:
     2148            return None
    21162149
    21172150    @property
     
    21432176        self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit))
    21442177
     2178        (derateLabel, derateUnit) = \
     2179             self._wizard.gui.flight.aircraft.derateLabels
     2180
     2181        self._hasDerate = derateLabel is not None
     2182
     2183        if self._hasDerate:
     2184            self._derateLabel.set_markup(derateLabel)
     2185            self._derateLabel.set_use_underline(True)
     2186            self._derateUnit.set_markup("" if derateUnit is None
     2187                                        else derateUnit)
     2188        else:
     2189            self._derateLabel.set_markup(xstr("takeoff_derate"))
     2190            self._derateUnit.set_text("")
     2191
     2192        self._derate.set_text("")
     2193
     2194        self._derateLabel.set_sensitive(self._hasDerate)
     2195        self._derate.set_sensitive(self._hasDerate)
     2196        self._derateUnit.set_sensitive(self._hasDerate)
     2197
    21452198        self._rto.set_active(False)
    21462199        self._rto.set_sensitive(False)
     
    21602213        self._vr.reset()
    21612214        self._v2.reset()
     2215
     2216        self._hasDerate = False
    21622217
    21632218    def setRTOEnabled(self, enabled):
     
    21762231                    self.v2 is not None and \
    21772232                    self.v1 <= self.vr and \
    2178                     self.vr <= self.v2
     2233                    self.vr <= self.v2 and \
     2234                    (not self._hasDerate or self._derate.get_text()!="")
    21792235        self._button.set_sensitive(sensitive)
    21802236
     
    21892245        self._valueChanged(entry, arg)
    21902246
     2247    def _derateChanged(self, entry):
     2248        """Called when the value of the derate is changed."""
     2249        self._updateForwardButton()
     2250
    21912251    def _rtoToggled(self, button):
    21922252        """Called when the RTO check button is toggled."""
     
    22002260        """Called when the forward button is clicked."""
    22012261        self._wizard.gui.flight.aircraft.updateV1R2()
     2262        if self._hasDerate:
     2263            self._wizard.gui.flight.aircraft.updateDerate()
    22022264        self._wizard.nextPage()
    22032265
     
    31183180        """Get the V2 speed."""
    31193181        return self._takeoffPage.v2
     3182
     3183    @property
     3184    def derate(self):
     3185        """Get the derate value."""
     3186        return self._takeoffPage.derate
    31203187
    31213188    @property
  • src/mlx/gui/gui.py

    r383 r384  
    306306        """Get the V2 speed calculated for the flight."""
    307307        return self._wizard.v2
     308
     309    @property
     310    def derate(self):
     311        """Get the derate value calculated for the flight."""
     312        return self._wizard.derate
    308313
    309314    @property
Note: See TracChangeset for help on using the changeset viewer.