Changeset 1033:330058d37574
- Timestamp:
- 03/14/22 08:46:34 (3 years ago)
- Branch:
- python3
- Phase:
- public
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r869 r1033 636 636 "You can also query the ZFW reported by the simulator." 637 637 638 msgid "payload_help_few_crew" 639 msgstr "Too few cabin crew members (minimum: %d)." 640 641 msgid "payload_help_many_pax" 642 msgstr "Too many passengers (maximum: %d)." 643 638 644 msgid "payload_crew" 639 645 msgstr "C_rew:" 640 646 641 647 msgid "payload_crew_tooltip" 642 msgstr "The number of the crew members on your flight." 648 msgstr "The number of the cabin crew members on your flight." 649 650 msgid "payload_crew_info" 651 msgstr "cockpit + cabin" 643 652 644 653 msgid "payload_pax" … … 646 655 647 656 msgid "payload_pax_tooltip" 648 msgstr "The number of passengers on your flight." 657 msgstr "The number of adult passengers on your flight." 658 659 msgid "payload_pax_children_tooltip" 660 msgstr "The number of child passengers on your flight." 661 662 msgid "payload_pax_infants_tooltip" 663 msgstr "The number of infant passengers on your flight." 664 665 msgid "payload_pax_info" 666 msgstr "adults + children + infants" 649 667 650 668 msgid "payload_bag" -
locale/hu/mlx.po
r870 r1033 640 640 "Azt is ellenőrizheted, hogy a szimulátor milyen ZFW-t jelent." 641 641 642 msgid "payload_help_few_crew" 643 msgstr "Túl kevés kabinszemélyzet (legalább %d legyen)." 644 645 msgid "payload_help_many_pax" 646 msgstr "Túl sok utas (legfeljebb %d lehet)." 647 642 648 msgid "payload_crew" 643 649 msgstr "_Legénység:" 644 650 645 651 msgid "payload_crew_tooltip" 646 msgstr "A legénység létszáma." 652 msgstr "A kabin személyzet létszáma." 653 654 msgid "payload_crew_info" 655 msgstr "pilóta + kabin" 647 656 648 657 msgid "payload_pax" … … 650 659 651 660 msgid "payload_pax_tooltip" 652 msgstr "Az utasok száma." 661 msgstr "A felnőtt utasok száma." 662 663 msgid "payload_pax_children_tooltip" 664 msgstr "A gyermek utasok száma." 665 666 msgid "payload_pax_infants_tooltip" 667 msgstr "A csecsemőkorú utasok száma." 668 669 msgid "payload_pax_info" 670 msgstr "felnőtt + gyermek + csecsemő" 653 671 654 672 msgid "payload_bag" -
src/mlx/const.py
r1032 r1033 570 570 571 571 #------------------------------------------------------------------------------- 572 573 # The weight of a cabin crew member [kg] 574 WEIGHT_CABIN_CREW = 75 575 576 # The weight of an adult passenger [kg] 577 WEIGHT_PASSENGER = 84 578 579 # The weight of an adult passenger on charter flight [kg] 580 WEIGHT_PASSENGER_CHARTER = 76 581 582 # The weight of a child passenger [kg] 583 WEIGHT_CHILD = 35 584 585 # The weight of an infant passenger [kg] 586 WEIGHT_INFANT = 0 587 588 #------------------------------------------------------------------------------- -
src/mlx/flight.py
r919 r1033 152 152 153 153 @property 154 def numCrew(self): 155 """Get the number of crew members on the flight.""" 156 return self._gui.numCrew 154 def numCockpitCrew(self): 155 """Get the number of cockpit crew members on the flight.""" 156 return self._gui.numCockpitCrew 157 158 @property 159 def numCabinCrew(self): 160 """Get the number of cabin crew members on the flight.""" 161 return self._gui.numCabinCrew 157 162 158 163 @property … … 160 165 """Get the number of passengers on the flight.""" 161 166 return self._gui.numPassengers 167 168 @property 169 def numChildren(self): 170 """Get the number of child passengers on the flight.""" 171 return self._gui.numChildren 172 173 @property 174 def numInfants(self): 175 """Get the number of infant passengers on the flight.""" 176 return self._gui.numInfants 162 177 163 178 @property -
src/mlx/gui/flight.py
r1008 r1033 15 15 from mlx.i18n import xstr, getLanguage 16 16 from mlx.sound import startSound 17 from mlx.rpc import BookedFlight 17 18 import mlx.web as web 18 19 … … 2105 2106 super(PayloadPage, self).__init__(wizard, "payload", 2106 2107 xstr("payload_title"), 2107 xstr("payload_help") ,2108 xstr("payload_help") + "\n\n \n \n", 2108 2109 completedHelp = xstr("payload_chelp")) 2109 2110 … … 2118 2119 self.setMainWidget(alignment) 2119 2120 2120 label = Gtk.Label(xstr("payload_crew"))2121 self._crewLabel = label = Gtk.Label(xstr("payload_crew")) 2121 2122 label.set_use_underline(True) 2122 2123 label.set_alignment(0.0, 0.5) 2123 2124 table.attach(label, 0, 1, 0, 1) 2124 2125 2125 self._numCrew = IntegerEntry(defaultValue = 0) 2126 self._numCrew.set_width_chars(6) 2127 self._numCrew.connect("integer-changed", self._weightChanged) 2128 self._numCrew.set_tooltip_text(xstr("payload_crew_tooltip")) 2129 table.attach(self._numCrew, 1, 2, 0, 1) 2130 label.set_mnemonic_widget(self._numCrew) 2131 2132 label = Gtk.Label(xstr("payload_pax")) 2126 self._numCockpitCrew = Gtk.Label() 2127 2128 self._numCabinCrew = IntegerEntry(defaultValue = 0) 2129 self._numCabinCrew.set_width_chars(6) 2130 self._numCabinCrew.connect("integer-changed", self._weightChanged) 2131 self._numCabinCrew.set_tooltip_text(xstr("payload_crew_tooltip")) 2132 2133 crewBox = Gtk.HBox() 2134 crewBox.pack_start(self._numCockpitCrew, False, False, 0) 2135 crewBox.pack_start(Gtk.Label("+"), False, False, 4) 2136 crewBox.pack_start(self._numCabinCrew, False, False, 0) 2137 crewBox.set_halign(Gtk.Align.END) 2138 2139 table.attach(crewBox, 1, 2, 0, 1) 2140 label.set_mnemonic_widget(self._numCabinCrew) 2141 2142 label = Gtk.Label(xstr("payload_crew_info")) 2143 label.set_halign(Gtk.Align.START) 2144 table.attach(label, 2, 3, 0, 1) 2145 2146 self._paxLabel = label = Gtk.Label(xstr("payload_pax")) 2133 2147 label.set_use_underline(True) 2134 2148 label.set_alignment(0.0, 0.5) … … 2139 2153 self._numPassengers.connect("integer-changed", self._weightChanged) 2140 2154 self._numPassengers.set_tooltip_text(xstr("payload_pax_tooltip")) 2141 table.attach(self._numPassengers, 1, 2, 1, 2) 2155 2156 self._numChildren = IntegerEntry(defaultValue = 0) 2157 self._numChildren.set_width_chars(6) 2158 self._numChildren.connect("integer-changed", self._weightChanged) 2159 self._numChildren.set_tooltip_text(xstr("payload_pax_children_tooltip")) 2160 2161 self._numInfants = IntegerEntry(defaultValue = 0) 2162 self._numInfants.set_width_chars(6) 2163 self._numInfants.connect("integer-changed", self._weightChanged) 2164 self._numInfants.set_tooltip_text(xstr("payload_pax_infants_tooltip")) 2165 2166 paxBox = Gtk.HBox() 2167 paxBox.pack_start(self._numPassengers, False, False, 0) 2168 paxBox.pack_start(Gtk.Label("+"), False, False, 4) 2169 paxBox.pack_start(self._numChildren, False, False, 0) 2170 paxBox.pack_start(Gtk.Label("+"), False, False, 4) 2171 paxBox.pack_start(self._numInfants, False, False, 0) 2172 2173 table.attach(paxBox, 1, 2, 1, 2) 2142 2174 label.set_mnemonic_widget(self._numPassengers) 2175 2176 label = Gtk.Label(xstr("payload_pax_info")) 2177 label.set_halign(Gtk.Align.START) 2178 table.attach(label, 2, 3, 1, 2) 2143 2179 2144 2180 label = Gtk.Label(xstr("payload_bag")) … … 2151 2187 self._bagWeight.connect("integer-changed", self._weightChanged) 2152 2188 self._bagWeight.set_tooltip_text(xstr("payload_bag_tooltip")) 2189 self._bagWeight.set_hexpand(False) 2190 self._bagWeight.set_halign(Gtk.Align.END) 2153 2191 table.attach(self._bagWeight, 1, 2, 2, 3) 2154 2192 label.set_mnemonic_widget(self._bagWeight) 2155 2193 2156 table.attach(Gtk.Label("kg"), 2, 3, 2, 3) 2194 label = Gtk.Label("kg") 2195 label.set_halign(Gtk.Align.START) 2196 table.attach(label, 2, 3, 2, 3) 2157 2197 2158 2198 label = Gtk.Label(xstr("payload_cargo")) … … 2165 2205 self._cargoWeight.connect("integer-changed", self._weightChanged) 2166 2206 self._cargoWeight.set_tooltip_text(xstr("payload_cargo_tooltip")) 2207 self._cargoWeight.set_hexpand(False) 2208 self._cargoWeight.set_halign(Gtk.Align.END) 2167 2209 table.attach(self._cargoWeight, 1, 2, 3, 4) 2168 2210 label.set_mnemonic_widget(self._cargoWeight) 2169 2211 2170 table.attach(Gtk.Label("kg"), 2, 3, 3, 4) 2212 label = Gtk.Label("kg") 2213 label.set_halign(Gtk.Align.START) 2214 table.attach(label, 2, 3, 3, 4) 2171 2215 2172 2216 label = Gtk.Label(xstr("payload_mail")) … … 2179 2223 self._mailWeight.connect("integer-changed", self._weightChanged) 2180 2224 self._mailWeight.set_tooltip_text(xstr("payload_mail_tooltip")) 2225 self._mailWeight.set_hexpand(False) 2226 self._mailWeight.set_halign(Gtk.Align.END) 2181 2227 table.attach(self._mailWeight, 1, 2, 4, 5) 2182 2228 label.set_mnemonic_widget(self._mailWeight) 2183 2229 2184 table.attach(Gtk.Label("kg"), 2, 3, 4, 5) 2230 label = Gtk.Label("kg") 2231 label.set_halign(Gtk.Align.START) 2232 table.attach(label, 2, 3, 4, 5) 2185 2233 2186 2234 label = Gtk.Label("<b>" + xstr("payload_zfw") + "</b>") … … 2194 2242 table.attach(self._calculatedZFW, 1, 2, 5, 6) 2195 2243 2196 table.attach(Gtk.Label("kg"), 2, 3, 5, 6) 2244 label = Gtk.Label("kg") 2245 label.set_halign(Gtk.Align.START) 2246 table.attach(label, 2, 3, 5, 6) 2197 2247 2198 2248 self._zfwButton = Gtk.Button(xstr("payload_fszfw")) … … 2208 2258 self._simulatorZFWValue = None 2209 2259 2210 table.attach(Gtk.Label("kg"), 2, 3, 6, 7) 2260 label = Gtk.Label("kg") 2261 label.set_halign(Gtk.Align.START) 2262 table.attach(label, 2, 3, 6, 7) 2211 2263 2212 2264 self.addCancelFlightButton() … … 2215 2267 2216 2268 @property 2217 def numCrew(self): 2218 """The number of the crew members on the flight.""" 2219 return self._numCrew.get_int() 2269 def numCockpitCrew(self): 2270 """The number of the cockpit crew members on the flight.""" 2271 return self._wizard._bookedFlight.numCockpitCrew 2272 2273 @property 2274 def numCabinCrew(self): 2275 """The number of the cabin members on the flight.""" 2276 return self._numCabinCrew.get_int() 2220 2277 2221 2278 @property 2222 2279 def numPassengers(self): 2223 """The number of the passengers on the flight."""2280 """The number of the adult passengers on the flight.""" 2224 2281 return self._numPassengers.get_int() 2282 2283 @property 2284 def numChildren(self): 2285 """The number of the child passengers on the flight.""" 2286 return self._numChildren.get_int() 2287 2288 @property 2289 def numInfants(self): 2290 """The number of the infant passengers on the flight.""" 2291 return self._numInfants.get_int() 2225 2292 2226 2293 @property … … 2243 2310 bookedFlight = self._wizard._bookedFlight 2244 2311 2245 self._numCrew.set_int(bookedFlight.numCrew) 2246 self._numCrew.set_sensitive(True) 2312 self._numCockpitCrew.set_markup("<b>" + 2313 str(bookedFlight.numCockpitCrew) + 2314 "</b>") 2315 self._numCabinCrew.set_int(bookedFlight.numCabinCrew) 2316 self._numCabinCrew.set_sensitive(True) 2317 2318 2247 2319 self._numPassengers.set_int(bookedFlight.numPassengers) 2248 2320 self._numPassengers.set_sensitive(True) 2249 2321 2322 self._numChildren.set_int(bookedFlight.numChildren) 2323 self._numChildren.set_sensitive(True) 2324 2325 self._numInfants.set_int(bookedFlight.numInfants) 2326 self._numInfants.set_sensitive(True) 2327 2250 2328 self._bagWeight.set_int(bookedFlight.bagWeight) 2251 2329 self._bagWeight.set_sensitive(True) 2252 self._cargoWeight.set_int(bookedFlight.cargoWeight) 2253 self._cargoWeight.set_sensitive(True) 2254 self._mailWeight.set_int(bookedFlight.mailWeight) 2255 self._mailWeight.set_sensitive(True) 2330 2331 if bookedFlight.flightType==BookedFlight.FLIGHT_TYPE_CHARTER: 2332 self._cargoWeight.set_int(0) 2333 self._cargoWeight.set_sensitive(False) 2334 self._mailWeight.set_int(0) 2335 self._mailWeight.set_sensitive(False) 2336 else: 2337 self._cargoWeight.set_int(bookedFlight.cargoWeight) 2338 self._cargoWeight.set_sensitive(True) 2339 self._mailWeight.set_int(bookedFlight.mailWeight) 2340 self._mailWeight.set_sensitive(True) 2256 2341 2257 2342 self._simulatorZFW.set_text("-") … … 2262 2347 def finalize(self): 2263 2348 """Finalize the payload page.""" 2264 self._numC rew.set_sensitive(False)2349 self._numCabinCrew.set_sensitive(False) 2265 2350 self._numPassengers.set_sensitive(False) 2351 self._numChildren.set_sensitive(False) 2352 self._numInfants.set_sensitive(False) 2266 2353 self._bagWeight.set_sensitive(False) 2267 2354 self._cargoWeight.set_sensitive(False) … … 2271 2358 def calculateZFW(self): 2272 2359 """Calculate the ZFW value.""" 2273 zfw = self._wizard.gui._flight.aircraft.dow 2274 zfw += (self._numCrew.get_int() + self._numPassengers.get_int()) * 82 2360 bookedFlight = self._wizard._bookedFlight 2361 2362 zfw = bookedFlight.dow 2363 zfw += (self._numCabinCrew.get_int() - bookedFlight.dowNumCabinCrew) * \ 2364 const.WEIGHT_CABIN_CREW 2365 zfw += self._numPassengers.get_int() * \ 2366 (const.WEIGHT_PASSENGER_CHARTER 2367 if bookedFlight.flightType==BookedFlight.FLIGHT_TYPE_CHARTER 2368 else const.WEIGHT_PASSENGER) 2369 zfw += self._numChildren.get_int() * const.WEIGHT_CHILD 2370 zfw += self._numInfants.get_int() * const.WEIGHT_INFANT 2275 2371 zfw += self._bagWeight.get_int() 2276 2372 zfw += self._cargoWeight.get_int() … … 2291 2387 2292 2388 def _weightChanged(self, entry, weight): 2293 """Called when one of the weight values or humanm counts has changed.""" 2389 """Called when one of the weight values or humanm counts has 2390 changed.""" 2391 bookedFlight = self._wizard._bookedFlight 2392 numPassengers = \ 2393 self._numPassengers.get_int() + \ 2394 self._numChildren.get_int() + \ 2395 self._numInfants.get_int() 2396 minCabinCrew = 0 if numPassengers==0 else \ 2397 (bookedFlight.maxPassengers // 50) + 1 2398 2399 extraHelp = [] 2400 enoughCrew = self._numCabinCrew.get_int() >= minCabinCrew 2401 if enoughCrew: 2402 self._crewLabel.set_text(xstr("payload_crew")) 2403 self.setHelp(xstr("payload_help")) 2404 else: 2405 self._crewLabel.set_markup("<b><span foreground=\"red\">" + 2406 xstr("payload_crew") + 2407 "</span></b>") 2408 extraHelp.append(xstr("payload_help_few_crew") % (minCabinCrew,)) 2409 self._crewLabel.set_use_underline(True) 2410 2411 tooManyPassengers = numPassengers>bookedFlight.maxPassengers 2412 if tooManyPassengers: 2413 self._paxLabel.set_markup("<b><span foreground=\"red\">" + 2414 xstr("payload_pax") + 2415 "</span></b>") 2416 extraHelp.append(xstr("payload_help_many_pax") % (bookedFlight.maxPassengers,)) 2417 else: 2418 self._paxLabel.set_text(xstr("payload_pax")) 2419 self._paxLabel.set_use_underline(True) 2420 2421 hlp = xstr("payload_help") + "\n\n" 2422 for eh in extraHelp: 2423 hlp += "<b><span foreground=\"red\">" + eh + "</span></b>\n" 2424 hlp += " \n" * (2-len(extraHelp)) 2425 self.setHelp(hlp) 2426 2427 self._button.set_sensitive(enoughCrew and not tooManyPassengers) 2428 2429 2294 2430 self._updateCalculatedZFW() 2295 2431 … … 5539 5675 5540 5676 @property 5541 def numCrew(self): 5542 """Get the number of crew members.""" 5543 return self._payloadPage.numCrew 5677 def numCockpitCrew(self): 5678 """Get the number of cockpit crew members.""" 5679 return self._payloadPage.numCockpitCrew 5680 5681 @property 5682 def numCabinCrew(self): 5683 """Get the number of cabin crew members.""" 5684 return self._payloadPage.numCabinCrew 5544 5685 5545 5686 @property … … 5547 5688 """Get the number of passengers.""" 5548 5689 return self._payloadPage.numPassengers 5690 5691 @property 5692 def numChildren(self): 5693 """Get the number of child passengers.""" 5694 return self._payloadPage.numChildren 5695 5696 @property 5697 def numInfants(self): 5698 """Get the number of infant passengers.""" 5699 return self._payloadPage.numInfants 5549 5700 5550 5701 @property -
src/mlx/gui/flightlist.py
r999 r1033 610 610 extraColumnAttributes = 611 611 { "alignment": 0.5 } ), 612 ColumnDescriptor(" numPassengers", xstr("acceptedflt_num_pax"),612 ColumnDescriptor("totalNumPassengers", xstr("acceptedflt_num_pax"), 613 613 type = int, sortable = True, 614 614 extraColumnAttributes = -
src/mlx/gui/gui.py
r1010 r1033 263 263 264 264 @property 265 def numCrew(self): 266 """Get the number of crew members.""" 267 return self._wizard.numCrew 265 def numCockpitCrew(self): 266 """Get the number of cockpit crew members.""" 267 return self._wizard.numCockpitCrew 268 269 @property 270 def numCabinCrew(self): 271 """Get the number of cabin crew members.""" 272 return self._wizard.numCabinCrew 268 273 269 274 @property … … 271 276 """Get the number of passengers.""" 272 277 return self._wizard.numPassengers 278 279 @property 280 def numChildren(self): 281 """Get the number of child passengers.""" 282 return self._wizard.numChildren 283 284 @property 285 def numInfants(self): 286 """Get the number of infant passengers.""" 287 return self._wizard.numInfants 273 288 274 289 @property -
src/mlx/gui/pirep.py
r999 r1033 336 336 bookedFlight.arrivalTime.minute)) 337 337 338 self._numPassengers.set_text(str(bookedFlight.numPassengers)) 339 self._numCrew.set_text(str(bookedFlight.numCrew)) 338 self._numPassengers.set_text(str(bookedFlight.numPassengers) + " + " + 339 str(bookedFlight.numChildren) + " + " + 340 str(bookedFlight.numInfants)) 341 self._numCrew.set_text(str(bookedFlight.numCockpitCrew) + " + " + 342 str(bookedFlight.numCabinCrew)) 340 343 self._bagWeight.set_text(str(bookedFlight.bagWeight)) 341 344 self._cargoWeight.set_text(str(bookedFlight.cargoWeight)) … … 378 381 self._rating.set_text("%.1f %%" % (rating,)) 379 382 380 self._flownNumC rew.set_text("%d" % (pirep.numCrew,))383 self._flownNumCabinCrew.set_text("%d" % (pirep.numCabinCrew,)) 381 384 self._flownNumPassengers.set_text("%d" % (pirep.numPassengers,)) 382 385 self._flownBagWeight.set_text("%.0f" % (pirep.bagWeight,)) … … 696 699 width = 4) 697 700 698 self._flownNumC rew = \701 self._flownNumCabinCrew = \ 699 702 PIREPViewer.tableAttach(table, 1, 0, 700 703 xstr("pirepView_numCrew"), … … 898 901 bookedFlight.arrivalTime.minute)) 899 902 900 self._numPassengers.set_text(str(bookedFlight.numPassengers)) 901 self._numCrew.set_text(str(bookedFlight.numCrew)) 903 self._numPassengers.set_text(str(bookedFlight.numPassengers) + " + " + 904 str(bookedFlight.numChildren) + " + " + 905 str(bookedFlight.numInfants)) 906 self._numCrew.set_text(str(bookedFlight.numCockpitCrew) + " + " + 907 str(bookedFlight.numCabinCrew)) 902 908 self._bagWeight.set_text(str(bookedFlight.bagWeight)) 903 909 self._cargoWeight.set_text(str(bookedFlight.cargoWeight)) … … 943 949 self._rating.set_text("%.1f %%" % (rating,)) 944 950 945 self._flownNumC rew.set_value(pirep.numCrew)951 self._flownNumCabinCrew.set_value(pirep.numCabinCrew) 946 952 self._flownNumPassengers.set_value(pirep.numPassengers) 953 self._flownNumChildren.set_value(pirep.numChildren) 954 self._flownNumInfants.set_value(pirep.numInfants) 947 955 self._flownBagWeight.set_value(pirep.bagWeight) 948 956 self._flownCargoWeight.set_value(pirep.cargoWeight) … … 1362 1370 table.set_homogeneous(False) 1363 1371 1364 self._flownNumPassengers = \ 1365 PIREPEditor.tableAttachSpinButton(table, 0, 0, 1366 xstr("pirepView_numPassengers"), 1367 300) 1368 self._flownNumPassengers.connect("value-changed", self._updateButtons) 1369 self._flownNumPassengers.set_tooltip_text(xstr("payload_pax_tooltip")) 1370 1371 self._flownNumCrew = \ 1372 PIREPEditor.tableAttachSpinButton(table, 2, 0, 1372 label = Gtk.Label("<b>" + xstr("pirepView_numPassengers") + "</b>") 1373 label.set_use_markup(True) 1374 alignment = Gtk.Alignment(xalign = 0.0, yalign = 0.5, 1375 xscale = 0.0, yscale = 0.0) 1376 alignment.add(label) 1377 table.attach(alignment, 0, 1, 0, 1) 1378 1379 1380 1381 self._flownNumPassengers = button = Gtk.SpinButton() 1382 button.set_range(min = 0, max = 300) 1383 button.set_increments(step = 1, page = 10) 1384 button.set_numeric(True) 1385 button.set_width_chars(2) 1386 button.set_alignment(1.0) 1387 button.connect("value-changed", self._updateButtons) 1388 button.set_tooltip_text(xstr("payload_pax_tooltip")) 1389 1390 self._flownNumChildren = button = Gtk.SpinButton() 1391 button.set_range(min = 0, max = 300) 1392 button.set_increments(step = 1, page = 10) 1393 button.set_numeric(True) 1394 button.set_width_chars(2) 1395 button.set_alignment(1.0) 1396 button.connect("value-changed", self._updateButtons) 1397 button.set_tooltip_text(xstr("payload_pax_children_tooltip")) 1398 1399 self._flownNumInfants = button = Gtk.SpinButton() 1400 button.set_range(min = 0, max = 300) 1401 button.set_increments(step = 1, page = 10) 1402 button.set_numeric(True) 1403 button.set_width_chars(2) 1404 button.set_alignment(1.0) 1405 button.connect("value-changed", self._updateButtons) 1406 button.set_tooltip_text(xstr("payload_pax_infants_tooltip")) 1407 1408 paxBox = Gtk.HBox() 1409 paxBox.pack_start(self._flownNumPassengers, False, False, 0) 1410 paxBox.pack_start(Gtk.Label("+"), False, False, 4) 1411 paxBox.pack_start(self._flownNumChildren, False, False, 0) 1412 paxBox.pack_start(Gtk.Label("+"), False, False, 4) 1413 paxBox.pack_start(self._flownNumInfants, False, False, 0) 1414 paxBox.set_halign(Gtk.Align.END) 1415 1416 table.attach(paxBox, 1, 4, 0, 1) 1417 1418 self._flownNumCabinCrew = \ 1419 PIREPEditor.tableAttachSpinButton(table, 4, 0, 1373 1420 xstr("pirepView_numCrew"), 1374 1421 10) 1375 self._flownNumC rew.connect("value-changed", self._updateButtons)1376 self._flownNumC rew.set_tooltip_text(xstr("payload_crew_tooltip"))1422 self._flownNumCabinCrew.connect("value-changed", self._updateButtons) 1423 self._flownNumCabinCrew.set_tooltip_text(xstr("payload_crew_tooltip")) 1377 1424 1378 1425 self._flownBagWeight = \ … … 1493 1540 buffer.get_end_iter(), True) 1494 1541 1542 numPassengers = \ 1543 self._flownNumPassengers.get_value_as_int() + \ 1544 self._flownNumChildren.get_value_as_int() + \ 1545 self._flownNumInfants.get_value_as_int() 1546 1547 minCabinCrew = 0 if numPassengers==0 else \ 1548 (bookedFlight.maxPassengers // 50) + 1 1549 1495 1550 self._okButton.set_sensitive(self._modified and timesOK and 1496 1551 self._flightInfo.faultsFullyExplained and 1497 self._flownNumPassengers.get_value_as_int()>0and1498 self._flownNumC rew.get_value_as_int()>2and1552 numPassengers<=bookedFlight.maxPassengers and 1553 self._flownNumCabinCrew.get_value_as_int()>=minCabinCrew and 1499 1554 self._fuelUsed.get_value_as_int()>0 and 1500 1555 self._departureRunway.get_text_length()>0 and … … 1547 1602 pirep.fuelUsed = self._fuelUsed.get_value() 1548 1603 1549 pirep.numC rew = self._flownNumCrew.get_value()1604 pirep.numCabinCrew = self._flownNumCabinCrew.get_value() 1550 1605 pirep.numPassengers = self._flownNumPassengers.get_value() 1551 1606 pirep.bagWeight = self._flownBagWeight.get_value() -
src/mlx/gui/weighthelp.py
r996 r1033 4 4 from mlx.i18n import xstr 5 5 from mlx.checks import PayloadChecker 6 from mlx.rpc import BookedFlight 7 8 import mlx.const as const 6 9 7 10 #------------------------------------------------------------------------------- … … 319 322 self._usingHelp.set_sensitive(True) 320 323 self._weightsTable.set_sensitive(False) 321 322 self._crew = -1 324 325 self._flightType = -1 326 self._dowCabinCrew = -1 327 self._cockpitCrew = -1 328 self._cabinCrew = -1 323 329 self._pax = -1 324 self._humanWeight = 82.0 330 self._children = -1 331 self._infants = -1 325 332 self._bag = -1 326 333 self._cargo = -1 … … 341 348 def _setupCalculated(self): 342 349 """Setup the labels for the calculated values.""" 343 if self._crew<0: 350 crewWeight = self._getCrewWeight() 351 if crewWeight is None: 344 352 self._crewLabel.set_text(xstr("weighthelp_crew") % ("-",)) 345 353 self._crewWeight.set_text("-") 346 354 else: 347 self._crewLabel.set_text(xstr("weighthelp_crew") % (str(self._crew),)) 348 crewWeight = self._crew * self._humanWeight 355 self._crewLabel.set_text(xstr("weighthelp_crew") % 356 (str(self._cockpitCrew) + "+" + 357 str(self._cabinCrew),)) 349 358 self._crewWeight.set_text("%.0f" % (crewWeight,)) 350 351 if self._pax<0: 359 360 paxWeight = self._getPaxWeight() 361 if paxWeight<0: 352 362 self._paxLabel.set_text(xstr("weighthelp_pax") % ("-",)) 353 363 self._paxWeight.set_text("-") 354 364 else: 355 self._paxLabel.set_text(xstr("weighthelp_pax") % (str(self._pax),)) 356 paxWeight = self._pax * self._humanWeight 365 self._paxLabel.set_text(xstr("weighthelp_pax") % 366 (str(self._pax) + "+" + 367 str(self._children) + "+" + 368 str(self._infants),)) 357 369 self._paxWeight.set_text("%.0f" % (paxWeight,)) 358 370 … … 416 428 self._setWeightLabel(self._fsGross, self._fsGrossValue) 417 429 430 def _getCrewWeight(self): 431 """Get the crew weight for the flight.""" 432 if self._cockpitCrew>=0 and self._dowCabinCrew>=0 and self._cabinCrew>=0: 433 return (self._cabinCrew - self._dowCabinCrew) * const.WEIGHT_CABIN_CREW 434 else: 435 return None 436 437 def _getPaxWeight(self): 438 """Get the passenger weight for the flight.""" 439 if self._flightType>=0 and self._pax>=0 and self._children>=0 and \ 440 self._infants>=0: 441 return self._pax * \ 442 (const.WEIGHT_PASSENGER_CHARTER 443 if self._flightType==BookedFlight.FLIGHT_TYPE_CHARTER 444 else const.WEIGHT_PASSENGER) + \ 445 self._children * const.WEIGHT_CHILD + \ 446 self._infants * const.WEIGHT_INFANT 447 else: 448 return -1 449 418 450 def _calculateWeights(self): 419 451 """Calculate the payload and the zero-fuel weight. … … 421 453 It returns a tuple with these two items. If any of the items cannot be 422 454 calculated, that is -1.""" 423 if self._crew<0 or self._pax<0 or \ 455 crewWeight = self._getCrewWeight() 456 paxWeight = self._getPaxWeight() 457 if crewWeight is None or paxWeight<0 or \ 424 458 self._bag<0 or self._cargo<0 or self._mail<0: 425 459 payload = -1 426 460 else: 427 payload = (self._crew + self._pax) * self._humanWeight + \ 428 self._bag + self._cargo + self._mail 461 payload = crewWeight + paxWeight + self._bag + self._cargo + self._mail 429 462 430 463 if payload<0 or self._dowValue<0: … … 442 475 self._gui.logger.untimedMessage("The weight calculation help function was used by the pilot") 443 476 444 self._crew = self._gui.numCrew 477 bookedFlight = self._gui.bookedFlight 478 self._flightType = bookedFlight.flightType 479 self._dowCabinCrew = bookedFlight.dowNumCabinCrew 480 self._cockpitCrew = self._gui.numCockpitCrew 481 self._cabinCrew = self._gui.numCabinCrew 445 482 self._pax = self._gui.numPassengers 483 self._children = self._gui.numChildren 484 self._infants = self._gui.numInfants 446 485 self._bag = self._gui.bagWeight 447 486 self._cargo = self._gui.cargoWeight 448 487 self._mail = self._gui.mailWeight 488 self._dowValue = bookedFlight.dow 449 489 450 490 aircraft = self._gui.flight.aircraft 451 self._humanWeight = aircraft.humanWeight452 self._dowValue = aircraft.dow453 491 self._mzfwValue = aircraft.mzfw 454 492 self._mtowValue = aircraft.mtow -
src/mlx/pirep.py
r955 r1033 116 116 with open(path, "rb") as f: 117 117 pirep = pickle.load(f, fix_imports = True, encoding = "bytes") 118 if "numCrew" not in dir(pirep): 119 pirep.numCrew = pirep.bookedFlight.numCrew 118 if "numCabinCrew" not in dir(pirep): 119 if "numCrew" not in dir(pirep): 120 pirep.numCabinCrew = pirep.bookedFlight.numCabinCrew 121 else: 122 pirep.numCabinCrew = pirep.bookedFlight.numCrew 120 123 if "numPassengers" not in dir(pirep): 121 124 pirep.numPassengers = pirep.bookedFlight.numPassengers 125 if "numChildren" not in dir(pirep): 126 pirep.numChildren = 0 127 if "numInfants" not in dir(pirep): 128 pirep.numInfants = 0 122 129 if "bagWeight" not in dir(pirep): 123 130 pirep.bagWeight = pirep.bookedFlight.bagWeight … … 137 144 self.bookedFlight = flight.bookedFlight 138 145 139 self.numC rew = flight.numCrew146 self.numCabinCrew = flight.numCabinCrew 140 147 self.numPassengers = flight.numPassengers 148 self.numChildren = flight.numChildren 149 self.numInfants = flight.numInfants 141 150 self.bagWeight = flight.bagWeight 142 151 self.cargoWeight = flight.cargoWeight … … 183 192 self.bookedFlight = bookedFlight 184 193 185 self.numC rew = int(pirepData["numCrew"])194 self.numCabinCrew = int(pirepData["numCabinCrew"]) 186 195 self.numPassengers = int(pirepData["numPassengers"]) 196 self.numChildren = int(pirepData["numChildren"]) 197 self.numInfants = int(pirepData["numInfants"]) 187 198 self.bagWeight = int(pirepData["bagWeight"]) 188 199 self.cargoWeight = int(pirepData["cargoWeight"]) … … 382 393 attrs["arrivalICAO"] = self.bookedFlight.arrivalICAO 383 394 attrs["numPassengers"] = self.numPassengers 384 attrs["numCrew"] = self.numCrew 395 attrs["numChildren"] = self.numChildren 396 attrs["numInfants"] = self.numInfants 397 attrs["numCabinCrew"] = self.numCabinCrew 385 398 attrs["cargoWeight"] = self.cargoWeight 386 399 attrs["bagWeight"] = self.bagWeight -
src/mlx/rpc.py
r1032 r1033 276 276 STATUS_REJECTED = 4 277 277 278 # Flight type: scheduled 279 FLIGHT_TYPE_SCHEDULED = 0 280 281 # Flight type: VIP 282 FLIGHT_TYPE_VIP = 1 283 284 # Flight type: charter 285 FLIGHT_TYPE_CHARTER = 2 286 278 287 # The instructions for the construction 279 288 _instructions = { 280 289 "numPassengers" : int, 281 "numCrew" : int, 290 "numChildren" : int, 291 "numInfants" : int, 292 "numCabinCrew" : int, 293 "dowNumCabinCrew" : int, 294 "numCockpitCrew" : int, 282 295 "bagWeight" : int, 283 296 "cargoWeight" : int, 284 297 "mailWeight" : int, 298 "flightType" : int, 299 "dow": int, 300 "maxPassengers": int, 285 301 "aircraftType" : lambda value: BookedFlight._decodeAircraftType(value), 286 302 "status" : lambda value: BookedFlight._decodeStatus(value) … … 342 358 "bookedFlight" : lambda value: BookedFlight(value), 343 359 "numPassengers" : int, 360 "numChildren" : int, 361 "numInfants" : int, 344 362 "fuelUsed" : int, 345 363 "rating" : lambda value: float(value) if value else 0.0 … … 358 376 if self.flightTimeEnd<self.flightTimeStart: 359 377 self.flightTimeEnd += 24*60*60 378 379 self.totalNumPassengers = self.numPassengers + self.numChildren + self.numInfants 360 380 361 381 #--------------------------------------------------------------------------------------- -
src/mlx/web.py
r1032 r1033 286 286 self.tailNumber = bookedFlightData["tailNumber"] 287 287 self.numPassengers = int(bookedFlightData["numPassengers"]) 288 self.numCrew = int(bookedFlightData["numCrew"]) 288 self.numChildren = int(bookedFlightData["numChildren"]) 289 self.numInfants = int(bookedFlightData["numInfants"]) 290 self.maxPassengers = int(bookedFlightData["maxPassengers"]) 291 self.numCockpitCrew = int(bookedFlightData["numCockpitCrew"]) 292 self.numCabinCrew = int(bookedFlightData["numCabinCrew"]) 289 293 self.bagWeight = int(bookedFlightData["bagWeight"]) 290 294 self.cargoWeight = int(bookedFlightData["cargoWeight"])
Note:
See TracChangeset
for help on using the changeset viewer.