Changeset 384:97052bda0e22 for src
- Timestamp:
- 12/21/12 16:50:01 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r369 r384 3 3 import checks 4 4 import fs 5 from i18n import xstr 5 6 import util 6 7 … … 74 75 75 76 self._v1r2LineIndex = None 77 self._derateLineID = None 76 78 self._vrefLineIndex = None 77 79 … … 197 199 return None if self._aircraftState is None \ 198 200 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 199 221 200 222 def getFlapsSpeedLimit(self, flaps): … … 271 293 self._logRadios(aircraftState) 272 294 self._logV1R2(aircraftState) 295 self._logDerate(aircraftState) 273 296 elif newStage==const.STAGE_DESCENT or newStage==const.STAGE_LANDING: 274 297 self._logRadios(aircraftState) … … 380 403 self._logV1R2() 381 404 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 382 411 def _appendLightsLoggers(self): 383 412 """Append the loggers needed for the lights. … … 429 458 else: 430 459 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) 431 477 432 478 def updateVRef(self): … … 502 548 40 : 162 } 503 549 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 504 560 # def _appendSpeedChecker(self): 505 561 # """Append the NoStrobeSpeedChecker to the checkers. … … 626 682 25 : 185, 627 683 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 %%" 628 694 629 695 #--------------------------------------------------------------------------------------- … … 697 763 self.reverseMinSpeed = 50 698 764 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 699 775 #--------------------------------------------------------------------------------------- 700 776 … … 751 827 752 828 @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 753 839 def speedInKnots(self): 754 840 """Indicate if the speed is in knots.""" … … 798 884 return False 799 885 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 800 896 def _appendLightsLoggers(self): 801 897 """Append the loggers needed for the lights.""" … … 811 907 812 908 #--------------------------------------------------------------------------------------- 813 814 909 815 910 class YK40(Aircraft): … … 836 931 """Indicate if the speed is in knots.""" 837 932 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" 838 943 839 944 def _appendLightsLoggers(self): -
src/mlx/flight.py
r383 r384 181 181 """Get the V2 speed of the flight.""" 182 182 return self._gui.v2 183 184 @property 185 def derate(self): 186 """Get the derate value of the flight.""" 187 return self._gui.derate 183 188 184 189 @property -
src/mlx/gui/flight.py
r383 r384 1999 1999 xscale = 0.0, yscale = 0.0) 2000 2000 2001 table = gtk.Table( 6, 4)2001 table = gtk.Table(7, 4) 2002 2002 table.set_row_spacings(4) 2003 2003 table.set_col_spacings(16) … … 2044 2044 2045 2045 self._v1Unit = gtk.Label(xstr("label_knots")) 2046 self._v1Unit.set_alignment(0.0, 0.5) 2046 2047 table.attach(self._v1Unit, 3, 4, 2, 3) 2047 2048 … … 2060 2061 2061 2062 self._vrUnit = gtk.Label(xstr("label_knots")) 2063 self._vrUnit.set_alignment(0.0, 0.5) 2062 2064 table.attach(self._vrUnit, 3, 4, 3, 4) 2063 2065 … … 2076 2078 2077 2079 self._v2Unit = gtk.Label(xstr("label_knots")) 2080 self._v2Unit.set_alignment(0.0, 0.5) 2078 2081 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) 2079 2103 2080 2104 self._rto = gtk.CheckButton(xstr("takeoff_rto")) … … 2082 2106 self._rto.set_tooltip_text(xstr("takeoff_rto_tooltip")) 2083 2107 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) 2085 2109 2086 2110 self.addCancelFlightButton() … … 2114 2138 """Get the v2 speed.""" 2115 2139 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 2116 2149 2117 2150 @property … … 2143 2176 self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit)) 2144 2177 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 2145 2198 self._rto.set_active(False) 2146 2199 self._rto.set_sensitive(False) … … 2160 2213 self._vr.reset() 2161 2214 self._v2.reset() 2215 2216 self._hasDerate = False 2162 2217 2163 2218 def setRTOEnabled(self, enabled): … … 2176 2231 self.v2 is not None and \ 2177 2232 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()!="") 2179 2235 self._button.set_sensitive(sensitive) 2180 2236 … … 2189 2245 self._valueChanged(entry, arg) 2190 2246 2247 def _derateChanged(self, entry): 2248 """Called when the value of the derate is changed.""" 2249 self._updateForwardButton() 2250 2191 2251 def _rtoToggled(self, button): 2192 2252 """Called when the RTO check button is toggled.""" … … 2200 2260 """Called when the forward button is clicked.""" 2201 2261 self._wizard.gui.flight.aircraft.updateV1R2() 2262 if self._hasDerate: 2263 self._wizard.gui.flight.aircraft.updateDerate() 2202 2264 self._wizard.nextPage() 2203 2265 … … 3118 3180 """Get the V2 speed.""" 3119 3181 return self._takeoffPage.v2 3182 3183 @property 3184 def derate(self): 3185 """Get the derate value.""" 3186 return self._takeoffPage.derate 3120 3187 3121 3188 @property -
src/mlx/gui/gui.py
r383 r384 306 306 """Get the V2 speed calculated for the flight.""" 307 307 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 308 313 309 314 @property
Note:
See TracChangeset
for help on using the changeset viewer.