Changeset 513:0884206a9344 for src/mlx/gui
- Timestamp:
- 05/29/13 18:00:50 (12 years ago)
- Branch:
- xplane
- Parents:
-
509:77b730a1b092 (diff), 512:46bd71540346 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 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 #----------------------------------------------------------------------------- -
src/mlx/gui/flight.py
r512 r513 880 880 completedHelp = xstr("connect_chelp")) 881 881 882 self._selectSimulator = os.name=="nt" or "FORCE_SELECT_SIM" in os.environ 883 882 884 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 883 885 xscale = 0.0, yscale = 0.0) 884 886 885 table = gtk.Table( 5, 2)887 table = gtk.Table(7 if self._selectSimulator else 5, 2) 886 888 table.set_row_spacings(4) 887 889 table.set_col_spacings(16) … … 949 951 labelAlignment.add(self._departureGate) 950 952 table.attach(labelAlignment, 1, 2, 4, 5) 953 954 if self._selectSimulator: 955 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0, yalign=0.5) 956 label = gtk.Label(xstr("connect_sim")) 957 labelAlignment.add(label) 958 table.attach(labelAlignment, 0, 1, 5, 7) 959 960 selectAlignment = gtk.Alignment(xalign=0.0, xscale=0.0, yalign=0.5) 961 962 selectBox = gtk.HBox() 963 if pygobject: 964 self._selectMSFS = \ 965 gtk.RadioButton.new_with_mnemonic_from_widget(None, 966 xstr("connect_sim_msfs")) 967 else: 968 self._selectMSFS = gtk.RadioButton(None, 969 xstr("connect_sim_msfs")) 970 971 selectBox.pack_start(self._selectMSFS, False, False, 0); 972 973 if pygobject: 974 self._selectXPlane = \ 975 gtk.RadioButton.new_with_mnemonic_from_widget(self._selectMSFS, 976 xstr("connect_sim_xplane")) 977 else: 978 self._selectXPlane = gtk.RadioButton(self._selectMSFS, 979 xstr("connect_sim_xplane")) 980 981 selectBox.pack_start(self._selectXPlane, False, False, 8); 982 983 selectAlignment.add(selectBox) 984 table.attach(selectAlignment, 1, 2, 5, 7) 985 951 986 952 987 self.addCancelFlightButton() … … 982 1017 self._departureGate.set_markup(gate) 983 1018 1019 if self._selectSimulator: 1020 config = self._wizard.gui.config 1021 self._selectMSFS.set_active(config.defaultMSFS) 1022 self._selectXPlane.set_active(not config.defaultMSFS) 1023 984 1024 def finalize(self): 985 1025 """Finalize the page.""" … … 996 1036 def _connectClicked(self, button): 997 1037 """Called when the Connect button is pressed.""" 998 self._wizard._connectSimulator() 1038 if self._selectSimulator: 1039 simulatorType = const.SIM_MSFS9 if self._selectMSFS.get_active() \ 1040 else const.SIM_XPLANE10 1041 else: 1042 simulatorType = const.SIM_MSFS9 if os.name=="nt" \ 1043 else const.SIM_XPLANE10 1044 1045 config = self._wizard.gui.config 1046 config.defaultMSFS = simulatorType == const.SIM_MSFS9 1047 config.save() 1048 1049 self._wizard._connectSimulator(simulatorType) 999 1050 1000 1051 def _forwardClicked(self, button): … … 3573 3624 self.gui.rtoToggled(indicated) 3574 3625 3575 def _connectSimulator(self ):3626 def _connectSimulator(self, simulatorType): 3576 3627 """Connect to the simulator.""" 3577 self.gui.connectSimulator(self._bookedFlight.aircraftType) 3628 self.gui.connectSimulator(self._bookedFlight.aircraftType, 3629 simulatorType) 3578 3630 3579 3631 def _arrivalMETARCallback(self, returned, result):
Note:
See TracChangeset
for help on using the changeset viewer.