- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r503 r513 2141 2141 table.attach(self._v2Unit, 3, 4, 4, 5) 2142 2142 2143 self._ hasDerate = False2143 self._derateType = acft.DERATE_NONE 2144 2144 2145 2145 self._derateLabel = gtk.Label() … … 2149 2149 table.attach(self._derateLabel, 0, 1, 5, 6) 2150 2150 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) 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 2163 2157 2164 2158 self._antiIceOn = gtk.CheckButton(xstr("takeoff_antiice")) … … 2207 2201 def derate(self): 2208 2202 """Get the derate value, if any.""" 2209 if self._hasDerate: 2210 derate = self._derate.get_text() 2203 if self._derateWidget is None: 2204 return None 2205 if self._derateType==acft.DERATE_BOEING: 2206 derate = self._derateEntry.get_text() 2211 2207 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() 2212 2217 else: 2213 2218 return None … … 2251 2256 self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit)) 2252 2257 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) 2258 self._derateType = self._wizard.gui.flight.aircraft.derateType 2259 2260 self._setupDerateWidget() 2272 2261 2273 2262 self._rto.set_active(False) … … 2307 2296 self.v1 <= self.vr and \ 2308 2297 self.vr <= self.v2 and \ 2309 (not self._hasDerate or self._derate.get_text()!="") 2298 (self._derateType==acft.DERATE_NONE or 2299 self.derate is not None) 2310 2300 self._button.set_sensitive(sensitive) 2311 2301 … … 2336 2326 aircraft = self._wizard.gui.flight.aircraft 2337 2327 aircraft.updateV1R2() 2338 if self. _hasDerate:2328 if self.derate is not None: 2339 2329 aircraft.updateDerate() 2340 2330 aircraft.updateTakeoffAntiIce() 2341 2331 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) 2342 2421 2343 2422 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.