- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r872 r908 32 32 # 33 33 # This module implements the main tab of the application, the flight 34 # wizard. The wizard consists of \ref Page "pages", that come one after the34 # wizard. The wizard consists of \ref Page "pages", that come one yafter the 35 35 # other. As some pages might be skipped, the pages dynamically store the index 36 36 # of the previous page so that going back to it is simpler. The \ref … … 2125 2125 xscale = 0.0, yscale = 0.0) 2126 2126 2127 table = gtk.Table( 7, 3)2127 table = gtk.Table(8, 3) 2128 2128 table.set_row_spacings(4) 2129 2129 table.set_col_spacings(16) … … 2132 2132 self.setMainWidget(alignment) 2133 2133 2134 label = gtk.Label(xstr("payload_c rew"))2134 label = gtk.Label(xstr("payload_cockpit_crew")) 2135 2135 label.set_use_underline(True) 2136 2136 label.set_alignment(0.0, 0.5) 2137 2137 table.attach(label, 0, 1, 0, 1) 2138 2138 2139 self._numCrew = IntegerEntry(defaultValue = 0) 2140 self._numCrew.set_width_chars(6) 2141 self._numCrew.connect("integer-changed", self._weightChanged) 2142 self._numCrew.set_tooltip_text(xstr("payload_crew_tooltip")) 2143 table.attach(self._numCrew, 1, 2, 0, 1) 2144 label.set_mnemonic_widget(self._numCrew) 2139 self._numCockpitCrew = IntegerEntry(defaultValue = 0) 2140 self._numCockpitCrew.set_width_chars(6) 2141 self._numCockpitCrew.connect("integer-changed", self._weightChanged) 2142 self._numCockpitCrew.set_tooltip_text(xstr("payload_cockpit_crew_tooltip")) 2143 table.attach(self._numCockpitCrew, 1, 2, 0, 1) 2144 label.set_mnemonic_widget(self._numCockpitCrew) 2145 2146 label = gtk.Label(xstr("payload_cabin_crew")) 2147 label.set_use_underline(True) 2148 label.set_alignment(0.0, 0.5) 2149 table.attach(label, 0, 1, 1, 2) 2150 2151 self._numCabinCrew = IntegerEntry(defaultValue = 0) 2152 self._numCabinCrew.set_width_chars(6) 2153 self._numCabinCrew.connect("integer-changed", self._weightChanged) 2154 self._numCabinCrew.set_tooltip_text(xstr("payload_cabin_crew_tooltip")) 2155 table.attach(self._numCabinCrew, 1, 2, 1, 2) 2156 label.set_mnemonic_widget(self._numCabinCrew) 2145 2157 2146 2158 label = gtk.Label(xstr("payload_pax")) 2147 2159 label.set_use_underline(True) 2148 2160 label.set_alignment(0.0, 0.5) 2149 table.attach(label, 0, 1, 1, 2)2161 table.attach(label, 0, 1, 2, 3) 2150 2162 2151 2163 self._numPassengers = IntegerEntry(defaultValue = 0) … … 2153 2165 self._numPassengers.connect("integer-changed", self._weightChanged) 2154 2166 self._numPassengers.set_tooltip_text(xstr("payload_pax_tooltip")) 2155 table.attach(self._numPassengers, 1, 2, 1, 2)2167 table.attach(self._numPassengers, 1, 2, 2, 3) 2156 2168 label.set_mnemonic_widget(self._numPassengers) 2157 2169 … … 2159 2171 label.set_use_underline(True) 2160 2172 label.set_alignment(0.0, 0.5) 2161 table.attach(label, 0, 1, 2, 3)2173 table.attach(label, 0, 1, 3, 4) 2162 2174 2163 2175 self._bagWeight = IntegerEntry(defaultValue = 0) … … 2165 2177 self._bagWeight.connect("integer-changed", self._weightChanged) 2166 2178 self._bagWeight.set_tooltip_text(xstr("payload_bag_tooltip")) 2167 table.attach(self._bagWeight, 1, 2, 2, 3)2179 table.attach(self._bagWeight, 1, 2, 3, 4) 2168 2180 label.set_mnemonic_widget(self._bagWeight) 2169 2181 2170 table.attach(gtk.Label("kg"), 2, 3, 2, 3)2182 table.attach(gtk.Label("kg"), 2, 3, 3, 4) 2171 2183 2172 2184 label = gtk.Label(xstr("payload_cargo")) 2173 2185 label.set_use_underline(True) 2174 2186 label.set_alignment(0.0, 0.5) 2175 table.attach(label, 0, 1, 3, 4)2187 table.attach(label, 0, 1, 4, 5) 2176 2188 2177 2189 self._cargoWeight = IntegerEntry(defaultValue = 0) … … 2179 2191 self._cargoWeight.connect("integer-changed", self._weightChanged) 2180 2192 self._cargoWeight.set_tooltip_text(xstr("payload_cargo_tooltip")) 2181 table.attach(self._cargoWeight, 1, 2, 3, 4)2193 table.attach(self._cargoWeight, 1, 2, 4, 5) 2182 2194 label.set_mnemonic_widget(self._cargoWeight) 2183 2195 2184 table.attach(gtk.Label("kg"), 2, 3, 3, 4)2196 table.attach(gtk.Label("kg"), 2, 3, 4, 5) 2185 2197 2186 2198 label = gtk.Label(xstr("payload_mail")) 2187 2199 label.set_use_underline(True) 2188 2200 label.set_alignment(0.0, 0.5) 2189 table.attach(label, 0, 1, 4, 5)2201 table.attach(label, 0, 1, 5, 6) 2190 2202 2191 2203 self._mailWeight = IntegerEntry(defaultValue = 0) … … 2193 2205 self._mailWeight.connect("integer-changed", self._weightChanged) 2194 2206 self._mailWeight.set_tooltip_text(xstr("payload_mail_tooltip")) 2195 table.attach(self._mailWeight, 1, 2, 4, 5)2207 table.attach(self._mailWeight, 1, 2, 5, 6) 2196 2208 label.set_mnemonic_widget(self._mailWeight) 2197 2209 2198 table.attach(gtk.Label("kg"), 2, 3, 4, 5)2210 table.attach(gtk.Label("kg"), 2, 3, 5, 6) 2199 2211 2200 2212 label = gtk.Label("<b>" + xstr("payload_zfw") + "</b>") 2201 2213 label.set_alignment(0.0, 0.5) 2202 2214 label.set_use_markup(True) 2203 table.attach(label, 0, 1, 5, 6)2215 table.attach(label, 0, 1, 6, 7) 2204 2216 2205 2217 self._calculatedZFW = gtk.Label() 2206 2218 self._calculatedZFW.set_width_chars(6) 2207 2219 self._calculatedZFW.set_alignment(1.0, 0.5) 2208 table.attach(self._calculatedZFW, 1, 2, 5, 6)2209 2210 table.attach(gtk.Label("kg"), 2, 3, 5, 6)2220 table.attach(self._calculatedZFW, 1, 2, 6, 7) 2221 2222 table.attach(gtk.Label("kg"), 2, 3, 6, 7) 2211 2223 2212 2224 self._zfwButton = gtk.Button(xstr("payload_fszfw")) … … 2214 2226 self._zfwButton.connect("clicked", self._zfwRequested) 2215 2227 self._zfwButton.set_tooltip_text(xstr("payload_fszfw_tooltip")) 2216 table.attach(self._zfwButton, 0, 1, 6, 7)2228 table.attach(self._zfwButton, 0, 1, 7, 8) 2217 2229 2218 2230 self._simulatorZFW = gtk.Label("-") 2219 2231 self._simulatorZFW.set_width_chars(6) 2220 2232 self._simulatorZFW.set_alignment(1.0, 0.5) 2221 table.attach(self._simulatorZFW, 1, 2, 6, 7)2233 table.attach(self._simulatorZFW, 1, 2, 7, 8) 2222 2234 self._simulatorZFWValue = None 2223 2235 2224 table.attach(gtk.Label("kg"), 2, 3, 6, 7)2236 table.attach(gtk.Label("kg"), 2, 3, 7, 8) 2225 2237 2226 2238 self.addCancelFlightButton() … … 2229 2241 2230 2242 @property 2231 def numCrew(self): 2232 """The number of the crew members on the flight.""" 2233 return self._numCrew.get_int() 2243 def numCockpitCrew(self): 2244 """The number of the cockpit crew members on the flight.""" 2245 return self._numCockpitCrew.get_int() 2246 2247 @property 2248 def numCabinCrew(self): 2249 """The number of the cabin crew members on the flight.""" 2250 return self._numCabinCrew.get_int() 2234 2251 2235 2252 @property … … 2256 2273 """Setup the information.""" 2257 2274 bookedFlight = self._wizard._bookedFlight 2258 2259 self._numCrew.set_int(bookedFlight.numCrew) 2260 self._numCrew.set_sensitive(True) 2275 aircraft = self._wizard.gui._flight.aircraft 2276 2277 numCockpitCrew = bookedFlight.numCockpitCrew 2278 numCabinCrew = bookedFlight.numCabinCrew 2279 numCrew = numCockpitCrew + numCabinCrew 2280 2281 self._numCockpitCrew.set_int(numCockpitCrew) 2282 self._numCockpitCrew.set_sensitive(True) 2283 self._numCabinCrew.set_int(numCabinCrew) 2284 self._numCabinCrew.set_sensitive(True) 2261 2285 self._numPassengers.set_int(bookedFlight.numPassengers) 2262 2286 self._numPassengers.set_sensitive(True) … … 2276 2300 def finalize(self): 2277 2301 """Finalize the payload page.""" 2278 self._numCrew.set_sensitive(False) 2302 self._numCockpitCrew.set_sensitive(False) 2303 self._numCabinCrew.set_sensitive(False) 2279 2304 self._numPassengers.set_sensitive(False) 2280 2305 self._bagWeight.set_sensitive(False) … … 2285 2310 def calculateZFW(self): 2286 2311 """Calculate the ZFW value.""" 2312 aircraft = self._wizard.gui._flight.aircraft 2287 2313 zfw = self._wizard.gui._flight.aircraft.dow 2288 zfw += (self._numCrew.get_int() + self._numPassengers.get_int()) * 82 2314 zfw += (self.numCockpitCrew - aircraft.dowCockpit) * aircraft.cockpitCrewWeight 2315 zfw += (self.numCabinCrew - aircraft.dowCabin) * aircraft.cabinCrewWeight 2316 zfw += (self._numPassengers.get_int()) * aircraft.humanWeight 2289 2317 zfw += self._bagWeight.get_int() 2290 2318 zfw += self._cargoWeight.get_int() 2291 2319 zfw += self._mailWeight.get_int() 2320 zfw = int(zfw) 2292 2321 return zfw 2293 2322 … … 5541 5570 5542 5571 @property 5543 def numCrew(self): 5544 """Get the number of crew members.""" 5545 return self._payloadPage.numCrew 5572 def numCockpitCrew(self): 5573 """Get the number of cockpit crew members.""" 5574 return self._payloadPage.numCockpitCrew 5575 5576 @property 5577 def numCabinCrew(self): 5578 """Get the number of cabin crew members.""" 5579 return self._payloadPage.numCabinCrew 5546 5580 5547 5581 @property … … 5891 5925 self._loginResult = result 5892 5926 self.gui.loginSuccessful() 5927 acft.setupTypes(result.aircraftTypes) 5893 5928 else: 5894 5929 if isReload:
Note:
See TracChangeset
for help on using the changeset viewer.