Ignore:
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • .hgtags

    r511 r495  
    12125758776ce06206050a8c93cf36d15f8ccfb05097 version_0.17.1
    1313d83a928b8161308064c2521f70fea23ea4cf8cd6 version_0.18
    14 8590198176ae8b5ca5f20dfd71537c7a91016c0c version_0.19
  • locale/en/mlx.po

    r513 r509  
    795795msgstr "Der_ated thrust:"
    796796
    797 msgid "takeoff_derate_boeing_tooltip"
    798 msgstr "Enter the percentage of the takeoff power."
    799 
    800 msgid "takeoff_derate_epr_tooltip"
    801 msgstr "Enter the EPR value used for takeoff."
    802 
    803797msgid "takeoff_derate_tupolev"
    804 msgstr "Thrust setting:"
    805 
    806 msgid "takeoff_derate_tupolev_nominal"
    807 msgstr "_nominal"
    808 
    809 msgid "takeoff_derate_tupolev_nominal_tooltip"
    810 msgstr "Select this if the takeoff thrust setting is nominal."
    811 
    812 msgid "takeoff_derate_tupolev_takeoff"
    813 msgstr "_takeoff"
    814 
    815 msgid "takeoff_derate_tupolev_takeoff_tooltip"
    816 msgstr "Select this if the takeoff thrust setting is takeoff."
     798msgstr "N_ominal/takeoff:"
    817799
    818800msgid "takeoff_derate_b462"
    819 msgstr "Der_ate enabled"
    820 
    821 msgid "takeoff_derate_b462_tooltip"
    822 msgstr "Check this if derate is enabled for takeoff."
     801msgstr "Der_ate (yes/no):"
     802
     803msgid "takeoff_derate_tooltip"
     804msgstr "Enter the takeoff derate parameter."
    823805
    824806msgid "takeoff_antiice"
  • locale/hu/mlx.po

    r513 r509  
    791791
    792792msgid "takeoff_derate"
    793 msgstr "Teljesítmény:"
     793msgstr "Teljesítménycsökkentés:"
    794794
    795795msgid "takeoff_derate_boeing"
    796 msgstr "_Teljesítmény:"
    797 
    798 msgid "takeoff_derate_boeing_tooltip"
    799 msgstr "Írd be, hogy hány százalék a felszállási teljesítmény."
    800 
    801 msgid "takeoff_derate_epr_tooltip"
    802 msgstr "Írd be a felszálláskor használt EPR értéket."
     796msgstr "Csökkentett teljesítmény:"
    803797
    804798msgid "takeoff_derate_tupolev"
    805 msgstr "Üzemmód:"
    806 
    807 msgid "takeoff_derate_tupolev_nominal"
    808 msgstr "n_ominális"
    809 
    810 msgid "takeoff_derate_tupolev_nominal_tooltip"
    811 msgstr "Ha a felszálláshoz használt üzemmód beállítása nominális, válaszd ezt."
    812 
    813 msgid "takeoff_derate_tupolev_takeoff"
    814 msgstr "f_elszállási"
    815 
    816 msgid "takeoff_derate_tupolev_takeoff_tooltip"
    817 msgstr "Ha a felszálláshoz használt üzemmód beállítása felszállási, válaszd ezt."
     799msgstr "Névleges/felszállási:"
    818800
    819801msgid "takeoff_derate_b462"
    820 msgstr "_Csökkentett teljesítmény"
    821 
    822 msgid "takeoff_derate_b462_tooltip"
    823 msgstr "Jelöld ezt be, ha a felszállás csökkentett teljesítménnyel történik."
     802msgstr "Teljesítménycsökkentés (yes/no):"
     803
     804msgid "takeoff_derate_tooltip"
     805msgstr "Írd be a felszállási teljesítménycsökkentés értékét."
    824806
    825807msgid "takeoff_antiice"
  • src/mlx/acft.py

    r512 r447  
    3232#---------------------------------------------------------------------------------------
    3333
    34 # Derate type: no derate possible
    35 DERATE_NONE = 0
    36 
    37 # Derate type: Boeing, i.e. a percentage value.
    38 # For logging, the percentage value is expected as a string (i.e. whatever the
    39 # pilot enters into the text field).
    40 DERATE_BOEING = 1
    41 
    42 # Derate type: EPR, i.e. an EPR value.
    43 # For logging, the EPR value is expected as a string (i.e. whatever the pilot
    44 # enters into the text field).
    45 DERATE_EPR = 2
    46 
    47 # Derate type: Tupolev, i.e. nominal or takeoff
    48 # For logging, one of the DERATE_TUPOLEV_xxx values are expected.
    49 DERATE_TUPOLEV = 3
    50 
    51 # Tupolev derate value: nominal
    52 DERATE_TUPOLEV_NOMINAL = 1
    53 
    54 # Tupolev derate value: takeoff
    55 DERATE_TUPOLEV_TAKEOFF = 2
    56 
    57 # Derate type: BAe-146, i.e. enabled or not
    58 # For logging, a boolean is expected.
    59 DERATE_B462 = 4
    60 
    61 #---------------------------------------------------------------------------------------
    62 
    6334class SmoothedValue(object):
    6435    """A smoothed value."""
     
    232203
    233204    @property
    234     def derateType(self):
    235         """Get the derate type for this aircraft.
    236 
    237         This default implementation returns DERATE_NONE."""
    238         return DERATE_NONE
    239 
    240     def getDerateLine(self, value):
    241         """Get the log line for the given derate value.
    242 
    243         It uses the the derate type and produces the standard message for
    244         each. This children need not override it, although they can."""
    245         dt = self.derateType
    246 
    247         if dt==DERATE_BOEING:
    248             return "Derate calculated by the pilot: %s %%" % \
    249               ("-" if value is None else value,)
    250         elif dt==DERATE_EPR:
    251             return "EPR calculated by the pilot: %s" % \
    252               ("-" if value is None else value,)
    253         elif dt==DERATE_TUPOLEV:
    254             return "Thrust setting calculated by the pilot: %s" % \
    255               ("-" if value is None else
    256                "nominal" if value==DERATE_TUPOLEV_NOMINAL else "takeoff",)
    257         elif dt==DERATE_B462:
    258             return "Derate setting: %s" % \
    259               ("-" if value is None else "enabled" if value else "disabled",)
    260         elif dt!=DERATE_NONE:
    261             print "mlx.acft.getDerateLine: invalid derate type: " + dt
    262 
     205    def derateLabels(self):
     206        """Get the strings related to the derate entry.
     207
     208        It returns a tuple of two items:
     209        - the label before the entry field,
     210        - the label after the entry field, which can be None.
     211
     212        If both labels are None, the derate value will not be logged or
     213        queried. This is the default."""
     214        return (None, None)
     215
     216    @property
     217    def derateTemplate(self):
     218        """Get the template for logging the derate value.
     219
     220        If it returns None (which is the default), no derate value will be
     221        logged."""
    263222        return None
    264223
     
    513472        """Log the derate values either newly or by updating the corresponding
    514473        line."""
    515         dt = self.derateType
    516         if dt==DERATE_NONE:
     474        derateTemplate = self.derateTemplate
     475        if derateTemplate is None:
    517476            return
    518477
    519         message = self.getDerateLine(self._flight.derate)
    520         if message is not None:
    521             if self._derateLineID is None:
    522                 if state is None:
    523                     state = self._aircraftState
    524                 self._derateLineID = \
    525                   self.logger.message(state.timestamp, message)
    526             else:
    527                 self.logger.updateLine(self._derateLineID, message)
     478        derate = self._flight.derate
     479        message = derateTemplate % ("-" if derate is None else derate)
     480        if self._derateLineID is None:
     481            if state is None:
     482                state = self._aircraftState
     483            self._derateLineID = \
     484                self.logger.message(state.timestamp, message)
     485        else:
     486            self.logger.updateLine(self._derateLineID, message)
    528487
    529488    def _logTakeoffAntiIce(self, state = None):
     
    648607
    649608    @property
    650     def derateType(self):
    651         """Get the derate type for this type."""
    652         return DERATE_BOEING
     609    def derateLabels(self):
     610        """Get the derate strings for this type."""
     611        return (xstr("takeoff_derate_boeing"), "%")
     612
     613    @property
     614    def derateTemplate(self):
     615        """Get the derate template for this aicraft type."""
     616        return "Derate calculated by the pilot: %s %%"
    653617
    654618    # def _appendSpeedChecker(self):
     
    777741
    778742    @property
    779     def derateType(self):
    780         """Get the derate type for this type."""
    781         return DERATE_BOEING
     743    def derateLabels(self):
     744        """Get the derate strings for this type."""
     745        return (xstr("takeoff_derate_boeing"), "%")
     746
     747    @property
     748    def derateTemplate(self):
     749        """Get the derate template for this aicraft type."""
     750        return "Derate calculated by the pilot: %s %%"
    782751
    783752#---------------------------------------------------------------------------------------
     
    850819
    851820    @property
    852     def derateType(self):
    853         """Get the derate type for this type."""
    854         return DERATE_EPR
     821    def derateLabels(self):
     822        """Get the derate strings for this type."""
     823        return ("EPR", None)
     824
     825    @property
     826    def derateTemplate(self):
     827        """Get the derate template for this aicraft type."""
     828        return "EPR calculated by the pilot: %s"
    855829
    856830#---------------------------------------------------------------------------------------
     
    907881
    908882    @property
    909     def derateType(self):
    910         """Get the derate type for this type."""
    911         return DERATE_TUPOLEV
     883    def derateLabels(self):
     884        """Get the derate strings for this type."""
     885        return (xstr("takeoff_derate_tupolev"), None)
     886
     887    @property
     888    def derateTemplate(self):
     889        """Get the derate template for this aicraft type."""
     890        return "Nominal/takeoff power calculated by the pilot: %s"
    912891
    913892    @property
     
    960939
    961940    @property
    962     def derateType(self):
    963         """Get the derate type for this type."""
    964         return DERATE_TUPOLEV
     941    def derateLabels(self):
     942        """Get the derate strings for this type."""
     943        return (xstr("takeoff_derate_tupolev"), None)
     944
     945    @property
     946    def derateTemplate(self):
     947        """Get the derate template for this aicraft type."""
     948        return "Nominal/takeoff power calculated by the pilot: %s"
    965949
    966950    def _appendLightsLoggers(self):
     
    1006990
    1007991    @property
    1008     def derateType(self):
    1009         """Get the derate type for this type."""
    1010         return DERATE_TUPOLEV
     992    def derateLabels(self):
     993        """Get the derate strings for this type."""
     994        return (xstr("takeoff_derate_tupolev"), None)
     995
     996    @property
     997    def derateTemplate(self):
     998        """Get the derate template for this aicraft type."""
     999        return "Nominal/takeoff power calculated by the pilot: %s"
    10111000
    10121001    def _appendLightsLoggers(self):
     
    10491038
    10501039    @property
    1051     def derateType(self):
    1052         """Get the derate type for this type."""
    1053         return DERATE_B462
     1040    def derateLabels(self):
     1041        """Get the derate strings for this type."""
     1042        return (xstr("takeoff_derate_b462"), None)
     1043
     1044    @property
     1045    def derateTemplate(self):
     1046        """Get the derate template for this aicraft type."""
     1047        return "Derate enabled: %s"
    10541048
    10551049#---------------------------------------------------------------------------------------
  • src/mlx/gui/flight.py

    r513 r503  
    21412141        table.attach(self._v2Unit, 3, 4, 4, 5)
    21422142
    2143         self._derateType = acft.DERATE_NONE
     2143        self._hasDerate = False
    21442144
    21452145        self._derateLabel = gtk.Label()
     
    21492149        table.attach(self._derateLabel, 0, 1, 5, 6)
    21502150
    2151         self._derate = gtk.Alignment()
    2152         table.attach(self._derate, 2, 4, 5, 6)
    2153         self._derateWidget = None
    2154         self._derateEntry = None
    2155         self._derateUnit = None
    2156         self._derateButtons = None
     2151        self._derate = gtk.Entry()
     2152        self._derate.set_width_chars(10)
     2153        self._derate.set_tooltip_text(xstr("takeoff_derate_tooltip"))
     2154        self._derate.set_alignment(1.0)
     2155        self._derate.connect("changed", self._derateChanged)
     2156        table.attach(self._derate, 1, 3, 5, 6)
     2157        self._derateLabel.set_mnemonic_widget(self._derate)
     2158
     2159        self._derateUnit = gtk.Label("")
     2160        self._derateUnit.set_use_markup(True)
     2161        self._derateUnit.set_alignment(0.0, 0.5)
     2162        table.attach(self._derateUnit, 3, 4, 5, 6)
    21572163
    21582164        self._antiIceOn = gtk.CheckButton(xstr("takeoff_antiice"))
     
    22012207    def derate(self):
    22022208        """Get the derate value, if any."""
    2203         if self._derateWidget is None:
    2204             return None
    2205         if self._derateType==acft.DERATE_BOEING:
    2206             derate = self._derateEntry.get_text()
     2209        if self._hasDerate:
     2210            derate = self._derate.get_text()
    22072211            return derate if derate else None
    2208         elif self._derateType==acft.DERATE_EPR:
    2209             derate = self._derateWidget.get_text()
    2210             return derate if derate else None
    2211         elif self._derateType==acft.DERATE_TUPOLEV:
    2212             return acft.DERATE_TUPOLEV_NOMINAL \
    2213                    if self._derateButtons[0].get_active() \
    2214                    else acft.DERATE_TUPOLEV_TAKEOFF
    2215         elif self._derateType==acft.DERATE_B462:
    2216             return self._derateWidget.get_active()
    22172212        else:
    22182213            return None
     
    22562251        self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit))
    22572252
    2258         self._derateType = self._wizard.gui.flight.aircraft.derateType
    2259 
    2260         self._setupDerateWidget()
     2253        (derateLabel, derateUnit) = \
     2254             self._wizard.gui.flight.aircraft.derateLabels
     2255
     2256        self._hasDerate = derateLabel is not None
     2257
     2258        if self._hasDerate:
     2259            self._derateLabel.set_markup(derateLabel)
     2260            self._derateLabel.set_use_underline(True)
     2261            self._derateUnit.set_markup("" if derateUnit is None
     2262                                        else derateUnit)
     2263        else:
     2264            self._derateLabel.set_markup(xstr("takeoff_derate"))
     2265            self._derateUnit.set_text("")
     2266
     2267        self._derate.set_text("")
     2268
     2269        self._derateLabel.set_sensitive(self._hasDerate)
     2270        self._derate.set_sensitive(self._hasDerate)
     2271        self._derateUnit.set_sensitive(self._hasDerate)
    22612272
    22622273        self._rto.set_active(False)
     
    22962307                    self.v1 <= self.vr and \
    22972308                    self.vr <= self.v2 and \
    2298                     (self._derateType==acft.DERATE_NONE or
    2299                      self.derate is not None)
     2309                    (not self._hasDerate or self._derate.get_text()!="")
    23002310        self._button.set_sensitive(sensitive)
    23012311
     
    23262336        aircraft = self._wizard.gui.flight.aircraft
    23272337        aircraft.updateV1R2()
    2328         if self.derate is not None:
     2338        if self._hasDerate:
    23292339            aircraft.updateDerate()
    23302340        aircraft.updateTakeoffAntiIce()
    23312341        self._wizard.nextPage()
    2332 
    2333     def _setupDerateWidget(self):
    2334         """Setup the derate widget."""
    2335         if self._derateWidget is not None:
    2336             self._derate.remove(self._derateWidget)
    2337 
    2338         if self._derateType==acft.DERATE_BOEING:
    2339             self._derateLabel.set_text(xstr("takeoff_derate_boeing"))
    2340             self._derateLabel.set_use_underline(True)
    2341             self._derateLabel.set_sensitive(True)
    2342 
    2343             self._derateEntry = gtk.Entry()
    2344             self._derateEntry.set_width_chars(7)
    2345             self._derateEntry.set_tooltip_text(xstr("takeoff_derate_boeing_tooltip"))
    2346             self._derateEntry.set_alignment(1.0)
    2347             self._derateEntry.connect("changed", self._derateChanged)
    2348             self._derateLabel.set_mnemonic_widget(self._derateEntry)
    2349 
    2350             self._derateUnit = gtk.Label("%")
    2351             self._derateUnit.set_alignment(0.0, 0.5)
    2352 
    2353             self._derateWidget = gtk.Table(3, 1)
    2354             self._derateWidget.set_row_spacings(4)
    2355             self._derateWidget.set_col_spacings(16)
    2356             self._derateWidget.set_homogeneous(False)
    2357 
    2358             self._derateWidget.attach(self._derateEntry, 0, 2, 0, 1)
    2359             self._derateWidget.attach(self._derateUnit, 2, 3, 0, 1)
    2360 
    2361             self._derate.add(self._derateWidget)
    2362         elif self._derateType==acft.DERATE_EPR:
    2363             self._derateLabel.set_text("_EPR:")
    2364             self._derateLabel.set_use_underline(True)
    2365             self._derateLabel.set_sensitive(True)
    2366 
    2367             self._derateWidget = gtk.Entry()
    2368             self._derateWidget.set_width_chars(7)
    2369             self._derateWidget.set_tooltip_text(xstr("takeoff_derate_epr_tooltip"))
    2370             self._derateWidget.set_alignment(1.0)
    2371             self._derateWidget.connect("changed", self._derateChanged)
    2372             self._derateLabel.set_mnemonic_widget(self._derateWidget)
    2373 
    2374             self._derate.add(self._derateWidget)
    2375         elif self._derateType==acft.DERATE_TUPOLEV:
    2376             self._derateLabel.set_text(xstr("takeoff_derate_tupolev"))
    2377             self._derateLabel.set_use_underline(True)
    2378             self._derateLabel.set_sensitive(True)
    2379 
    2380             if pygobject:
    2381                 nominal = gtk.RadioButton.\
    2382                   new_with_label_from_widget(None,
    2383                                              xstr("takeoff_derate_tupolev_nominal"))
    2384             else:
    2385                 nominal = gtk.RadioButton(None,
    2386                                           xstr("takeoff_derate_tupolev_nominal"))
    2387             nominal.set_use_underline(True)
    2388             nominal.set_tooltip_text(xstr("takeoff_derate_tupolev_nominal_tooltip"))
    2389             nominal.connect("toggled", self._derateChanged)
    2390 
    2391             if pygobject:
    2392                 takeoff = gtk.RadioButton.\
    2393                   new_with_label_from_widget(nominal,
    2394                                              xstr("takeoff_derate_tupolev_takeoff"))
    2395             else:
    2396                 takeoff = gtk.RadioButton(nominal,
    2397                                           xstr("takeoff_derate_tupolev_takeoff"))
    2398 
    2399             takeoff.set_use_underline(True)
    2400             takeoff.set_tooltip_text(xstr("takeoff_derate_tupolev_takeoff_tooltip"))
    2401             takeoff.connect("toggled", self._derateChanged)
    2402 
    2403             self._derateButtons = [nominal, takeoff]
    2404 
    2405             self._derateWidget = gtk.HBox()
    2406             self._derateWidget.pack_start(nominal, False, False, 4)
    2407             self._derateWidget.pack_start(takeoff, False, False, 4)
    2408 
    2409             self._derate.add(self._derateWidget)
    2410         elif self._derateType==acft.DERATE_B462:
    2411             self._derateLabel.set_text("")
    2412 
    2413             self._derateWidget = gtk.CheckButton(xstr("takeoff_derate_b462"))
    2414             self._derateWidget.set_tooltip_text(xstr("takeoff_derate_b462_tooltip"))
    2415             self._derateWidget.set_use_underline(True)
    2416             self._derate.add(self._derateWidget)
    2417         else:
    2418             self._derateWidget = None
    2419             self._derateLabel.set_text("")
    2420             self._derateLabel.set_sensitive(False)
    24212342
    24222343#-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.