Changeset 512:46bd71540346 for src/mlx/gui
- Timestamp:
- 05/29/13 17:59:20 (11 years ago)
- Branch:
- default
- Children:
- 513:0884206a9344, 514:8c53fc09c941
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r436 r512 2090 2090 table.attach(self._v2Unit, 3, 4, 4, 5) 2091 2091 2092 self._ hasDerate = False2092 self._derateType = acft.DERATE_NONE 2093 2093 2094 2094 self._derateLabel = gtk.Label() … … 2098 2098 table.attach(self._derateLabel, 0, 1, 5, 6) 2099 2099 2100 self._derate = gtk.Entry() 2101 self._derate.set_width_chars(10) 2102 self._derate.set_tooltip_text(xstr("takeoff_derate_tooltip")) 2103 self._derate.set_alignment(1.0) 2104 self._derate.connect("changed", self._derateChanged) 2105 table.attach(self._derate, 1, 3, 5, 6) 2106 self._derateLabel.set_mnemonic_widget(self._derate) 2107 2108 self._derateUnit = gtk.Label("") 2109 self._derateUnit.set_use_markup(True) 2110 self._derateUnit.set_alignment(0.0, 0.5) 2111 table.attach(self._derateUnit, 3, 4, 5, 6) 2100 self._derate = gtk.Alignment() 2101 table.attach(self._derate, 2, 4, 5, 6) 2102 self._derateWidget = None 2103 self._derateEntry = None 2104 self._derateUnit = None 2105 self._derateButtons = None 2112 2106 2113 2107 self._antiIceOn = gtk.CheckButton(xstr("takeoff_antiice")) … … 2156 2150 def derate(self): 2157 2151 """Get the derate value, if any.""" 2158 if self._hasDerate: 2159 derate = self._derate.get_text() 2152 if self._derateWidget is None: 2153 return None 2154 if self._derateType==acft.DERATE_BOEING: 2155 derate = self._derateEntry.get_text() 2160 2156 return derate if derate else None 2157 elif self._derateType==acft.DERATE_EPR: 2158 derate = self._derateWidget.get_text() 2159 return derate if derate else None 2160 elif self._derateType==acft.DERATE_TUPOLEV: 2161 return acft.DERATE_TUPOLEV_NOMINAL \ 2162 if self._derateButtons[0].get_active() \ 2163 else acft.DERATE_TUPOLEV_TAKEOFF 2164 elif self._derateType==acft.DERATE_B462: 2165 return self._derateWidget.get_active() 2161 2166 else: 2162 2167 return None … … 2200 2205 self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit)) 2201 2206 2202 (derateLabel, derateUnit) = \ 2203 self._wizard.gui.flight.aircraft.derateLabels 2204 2205 self._hasDerate = derateLabel is not None 2206 2207 if self._hasDerate: 2208 self._derateLabel.set_markup(derateLabel) 2209 self._derateLabel.set_use_underline(True) 2210 self._derateUnit.set_markup("" if derateUnit is None 2211 else derateUnit) 2212 else: 2213 self._derateLabel.set_markup(xstr("takeoff_derate")) 2214 self._derateUnit.set_text("") 2215 2216 self._derate.set_text("") 2217 2218 self._derateLabel.set_sensitive(self._hasDerate) 2219 self._derate.set_sensitive(self._hasDerate) 2220 self._derateUnit.set_sensitive(self._hasDerate) 2207 self._derateType = self._wizard.gui.flight.aircraft.derateType 2208 2209 self._setupDerateWidget() 2221 2210 2222 2211 self._rto.set_active(False) … … 2256 2245 self.v1 <= self.vr and \ 2257 2246 self.vr <= self.v2 and \ 2258 (not self._hasDerate or self._derate.get_text()!="") 2247 (self._derateType==acft.DERATE_NONE or 2248 self.derate is not None) 2259 2249 self._button.set_sensitive(sensitive) 2260 2250 … … 2285 2275 aircraft = self._wizard.gui.flight.aircraft 2286 2276 aircraft.updateV1R2() 2287 if self. _hasDerate:2277 if self.derate is not None: 2288 2278 aircraft.updateDerate() 2289 2279 aircraft.updateTakeoffAntiIce() 2290 2280 self._wizard.nextPage() 2281 2282 def _setupDerateWidget(self): 2283 """Setup the derate widget.""" 2284 if self._derateWidget is not None: 2285 self._derate.remove(self._derateWidget) 2286 2287 if self._derateType==acft.DERATE_BOEING: 2288 self._derateLabel.set_text(xstr("takeoff_derate_boeing")) 2289 self._derateLabel.set_use_underline(True) 2290 self._derateLabel.set_sensitive(True) 2291 2292 self._derateEntry = gtk.Entry() 2293 self._derateEntry.set_width_chars(7) 2294 self._derateEntry.set_tooltip_text(xstr("takeoff_derate_boeing_tooltip")) 2295 self._derateEntry.set_alignment(1.0) 2296 self._derateEntry.connect("changed", self._derateChanged) 2297 self._derateLabel.set_mnemonic_widget(self._derateEntry) 2298 2299 self._derateUnit = gtk.Label("%") 2300 self._derateUnit.set_alignment(0.0, 0.5) 2301 2302 self._derateWidget = gtk.Table(3, 1) 2303 self._derateWidget.set_row_spacings(4) 2304 self._derateWidget.set_col_spacings(16) 2305 self._derateWidget.set_homogeneous(False) 2306 2307 self._derateWidget.attach(self._derateEntry, 0, 2, 0, 1) 2308 self._derateWidget.attach(self._derateUnit, 2, 3, 0, 1) 2309 2310 self._derate.add(self._derateWidget) 2311 elif self._derateType==acft.DERATE_EPR: 2312 self._derateLabel.set_text("_EPR:") 2313 self._derateLabel.set_use_underline(True) 2314 self._derateLabel.set_sensitive(True) 2315 2316 self._derateWidget = gtk.Entry() 2317 self._derateWidget.set_width_chars(7) 2318 self._derateWidget.set_tooltip_text(xstr("takeoff_derate_epr_tooltip")) 2319 self._derateWidget.set_alignment(1.0) 2320 self._derateWidget.connect("changed", self._derateChanged) 2321 self._derateLabel.set_mnemonic_widget(self._derateWidget) 2322 2323 self._derate.add(self._derateWidget) 2324 elif self._derateType==acft.DERATE_TUPOLEV: 2325 self._derateLabel.set_text(xstr("takeoff_derate_tupolev")) 2326 self._derateLabel.set_use_underline(True) 2327 self._derateLabel.set_sensitive(True) 2328 2329 if pygobject: 2330 nominal = gtk.RadioButton.\ 2331 new_with_label_from_widget(None, 2332 xstr("takeoff_derate_tupolev_nominal")) 2333 else: 2334 nominal = gtk.RadioButton(None, 2335 xstr("takeoff_derate_tupolev_nominal")) 2336 nominal.set_use_underline(True) 2337 nominal.set_tooltip_text(xstr("takeoff_derate_tupolev_nominal_tooltip")) 2338 nominal.connect("toggled", self._derateChanged) 2339 2340 if pygobject: 2341 takeoff = gtk.RadioButton.\ 2342 new_with_label_from_widget(nominal, 2343 xstr("takeoff_derate_tupolev_takeoff")) 2344 else: 2345 takeoff = gtk.RadioButton(nominal, 2346 xstr("takeoff_derate_tupolev_takeoff")) 2347 2348 takeoff.set_use_underline(True) 2349 takeoff.set_tooltip_text(xstr("takeoff_derate_tupolev_takeoff_tooltip")) 2350 takeoff.connect("toggled", self._derateChanged) 2351 2352 self._derateButtons = [nominal, takeoff] 2353 2354 self._derateWidget = gtk.HBox() 2355 self._derateWidget.pack_start(nominal, False, False, 4) 2356 self._derateWidget.pack_start(takeoff, False, False, 4) 2357 2358 self._derate.add(self._derateWidget) 2359 elif self._derateType==acft.DERATE_B462: 2360 self._derateLabel.set_text("") 2361 2362 self._derateWidget = gtk.CheckButton(xstr("takeoff_derate_b462")) 2363 self._derateWidget.set_tooltip_text(xstr("takeoff_derate_b462_tooltip")) 2364 self._derateWidget.set_use_underline(True) 2365 self._derate.add(self._derateWidget) 2366 else: 2367 self._derateWidget = None 2368 self._derateLabel.set_text("") 2369 self._derateLabel.set_sensitive(False) 2291 2370 2292 2371 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.