Changeset 117:af3d52b9adc4
- Timestamp:
- 04/28/12 12:25:48 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r101 r117 28 28 self._v1r2LineIndex = None 29 29 self._vrefLineIndex = None 30 31 self.humanWeight = 82.0 30 32 31 33 self._checkers = [] -
src/mlx/fsuipc.py
r97 r117 531 531 self._handler.requestRead([(0x3bfc, "d")], self._handleZFW, extra = callback) 532 532 533 def requestWeights(self, callback): 534 """Request the following weights: DOW, ZFW, payload. 535 536 These values will be passed to the callback function in this order, as 537 separate arguments.""" 538 self._handler.requestRead([(0x13fc, "d")], self._handlePayloadCount, 539 extra = callback) 540 533 541 def requestTime(self, callback): 534 542 """Request the time from the simulator.""" … … 737 745 """Callback for a time retrieval request.""" 738 746 callback(Simulator._getTimestamp(data)) 747 748 def _handlePayloadCount(self, data, callback): 749 """Callback for the payload count retrieval request.""" 750 payloadCount = data[0] 751 data = [(0x3bfc, "d"), (0x30c0, "f")] 752 for i in range(0, payloadCount): 753 data.append((0x1400 + i*48, "f")) 754 755 self._handler.requestRead(data, self._handleWeights, 756 extra = callback) 757 758 def _handleWeights(self, data, callback): 759 """Callback for the weights retrieval request.""" 760 zfw = data[0] * const.LBSTOKG / 256.0 761 grossWeight = data[1] * const.LBSTOKG 762 payload = sum(data[2:]) * const.LBSTOKG 763 dow = zfw - payload 764 callback(dow, payload, zfw, grossWeight) 739 765 740 766 #------------------------------------------------------------------------------ -
src/mlx/gui/flight.py
r107 r117 799 799 """Finalize the payload page.""" 800 800 self._cargoWeight.set_sensitive(False) 801 self._wizard.gui.initializeWeightHelp() 801 802 802 803 def calculateZFW(self): … … 1908 1909 self._payloadPage = PayloadPage(self) 1909 1910 self._pages.append(self._payloadPage) 1911 self._payloadIndex = len(self._pages) 1910 1912 self._pages.append(TimePage(self)) 1911 1913 self._routePage = RoutePage(self) … … 1915 1917 self._arrivalBriefingPage = BriefingPage(self, False) 1916 1918 self._pages.append(self._arrivalBriefingPage) 1919 self._arrivalBriefingIndex = len(self._pages) 1917 1920 self._takeoffPage = TakeoffPage(self) 1918 1921 self._pages.append(self._takeoffPage) -
src/mlx/gui/gui.py
r110 r117 8 8 from mlx.gui.flight import Wizard 9 9 from mlx.gui.monitor import MonitorWindow 10 from mlx.gui.weighthelp import WeightHelp 10 11 11 12 import mlx.const as const … … 88 89 self._flightInfo.disable() 89 90 91 self._weightHelp = WeightHelp(self) 92 label = gtk.Label(xstr("tab_weight_help")) 93 label.set_use_underline(True) 94 label.set_tooltip_text(xstr("tab_weight_help_tooltip")) 95 self._notebook.append_page(self._weightHelp, label) 96 90 97 (logWidget, self._logView) = self._buildLogWidget() 91 98 label = gtk.Label(xstr("tab_log")) … … 112 119 window.show_all() 113 120 self._wizard.grabDefault() 121 self._weightHelp.reset() 122 self._weightHelp.disable() 114 123 115 124 self._mainWindow = window … … 353 362 self.resetFlightStatus() 354 363 364 self._weightHelp.reset() 365 self._weightHelp.disable() 355 366 self._wizard.reset() 356 367 self._notebook.set_current_page(0) … … 518 529 """Begin a period of background processing.""" 519 530 self._wizard.set_sensitive(False) 531 self._weightHelp.set_sensitive(False) 520 532 self._mainWindow.get_window().set_cursor(self._busyCursor) 521 533 self._statusbar.updateBusyState(message) … … 524 536 """End a period of background processing.""" 525 537 self._mainWindow.get_window().set_cursor(None) 538 self._weightHelp.set_sensitive(True) 526 539 self._wizard.set_sensitive(True) 527 540 self._statusbar.updateBusyState(None) 541 542 def initializeWeightHelp(self): 543 """Initialize the weight help tab.""" 544 self._weightHelp.reset() 545 self._weightHelp.enable() 528 546 529 547 def _writeStdIO(self): -
src/mlx/i18n.py
r115 r117 139 139 self.add("tab_flight_info", "Flight _info") 140 140 self.add("tab_flight_info_tooltip", "Further information regarding the flight") 141 self.add("tab_weight_help", "_Help") 142 self.add("tab_weight_help_tooltip", "Help to calculate the weights") 141 143 self.add("tab_log", "_Log") 142 144 self.add("tab_log_tooltip", 143 145 "The log of your flight that will be sent to the MAVA website") 146 self.add("tab_gates", "_Gates") 144 147 self.add("tab_debug_log", "_Debug log") 145 148 self.add("tab_debug_log_tooltip", "Log with debugging information.") 146 self.add("tab_help", "_Help")147 self.add("tab_gates", "_Gates")148 149 149 150 self.add("conn_failed", "Cannot connect to the simulator.") … … 475 476 self.add("update_nothing", "There was nothing to update") 476 477 self.add("update_failed", "Failed, see the debug log for details.") 478 479 self.add("weighthelp_usinghelp", "_Using help") 480 self.add("weighthelp_usinghelp_tooltip", 481 "If you check this, some help will be displayed on how " 482 "to calculate the payload weight for your flight. " 483 "Note, that the usage of this facility will be logged.") 484 self.add("weighthelp_header_calculated", "Requested/\ncalculated") 485 self.add("weighthelp_header_simulator", "Simulator\ndata") 486 self.add("weighthelp_header_simulator_tooltip", 487 "Click this button to retrieve the weight values from the " 488 "simulator, which will be displayed below. If a value is " 489 "within 10% of the tolerance, it is displayed in " 490 '<b><span foreground="darkgreen">green</span></b>, ' 491 "if it is out of the tolerance, it is displayed in " 492 '<b><span foreground="red">red</span></b>, ' 493 "otherwise in" 494 '<b><span foreground="orange">yellow</span></b>.') 495 self.add("weighthelp_crew", "Crew (%s):") 496 self.add("weighthelp_pax", "Passengers (%s):") 497 self.add("weighthelp_baggage", "Baggage:") 498 self.add("weighthelp_cargo", "Cargo:") 499 self.add("weighthelp_mail", "Mail:") 500 self.add("weighthelp_payload", "Payload:") 501 self.add("weighthelp_dow", "DOW:") 502 self.add("weighthelp_zfw", "ZFW:") 503 self.add("weighthelp_gross", "Gross weight:") 504 self.add("weighthelp_mzfw", "MZFW:") 505 self.add("weighthelp_mtow", "MTOW:") 506 self.add("weighthelp_mlw", "MLW:") 507 self.add("weighthelp_busy", "Querying weight data...") 477 508 478 509 #------------------------------------------------------------------------------ … … 501 532 self.add("tab_flight_info", "Járat _info") 502 533 self.add("tab_flight_info_tooltip", "Egyéb információk a járat teljesítésével kapcsolatban") 534 self.add("tab_weight_help", "_Segítség") 535 self.add("tab_weight_help_tooltip", "Segítség a súlyszámításhoz") 503 536 self.add("tab_log", "_Napló") 504 537 self.add("tab_log_tooltip", … … 507 540 self.add("tab_debug_log_tooltip", 508 541 "Hibakereséshez használható információkat tartalmazó napló.") 509 self.add("tab_help", "_Segítség")510 542 self.add("tab_gates", "_Kapuk") 511 543 … … 842 874 self.add("update_failed", "Nem sikerült, a részleteket lásd a debug naplóban.") 843 875 876 self.add("weighthelp_usinghelp", "_Használom a segítséget") 877 self.add("weighthelp_usinghelp_tooltip", 878 "Ha bejelölöd, az alábbiakban kapsz egy kis segítséget " 879 "a járathoz szükséges hasznos teher megállapításához. " 880 "Ha igénybe veszed ezt a szolgáltatást, ez a tény " 881 "a naplóba bekerül.") 882 self.add("weighthelp_header_calculated", "Elvárt/\nszámított") 883 self.add("weighthelp_header_simulator", "Szimulátor\nadatok") 884 self.add("weighthelp_header_simulator_tooltip", 885 "Kattints erre a gombra a súlyadatoknak a szimulátortól " 886 "való lekérdezéséhez. Az értékek lent jelennek meg. Ha " 887 "egy érték a tűrés 10%-án belül van, akkor az " 888 '<b><span foreground="darkgreen">zöld</span></b> ' 889 "színnel jelenik meg. Ha nem fér bele a tűrésbe, akkor " 890 '<b><span foreground="red">piros</span></b>, ' 891 "egyébként " 892 '<b><span foreground="orange">sárga</span></b> ' 893 "színben olvasható.") 894 self.add("weighthelp_crew", "Legénység (%s):") 895 self.add("weighthelp_pax", "Utasok (%s):") 896 self.add("weighthelp_baggage", "Poggyász:") 897 self.add("weighthelp_cargo", "Teher:") 898 self.add("weighthelp_mail", "Posta:") 899 self.add("weighthelp_payload", "Hasznos teher:") 900 self.add("weighthelp_dow", "DOW:") 901 self.add("weighthelp_zfw", "ZFW:") 902 self.add("weighthelp_gross", "Teljes tömeg:") 903 self.add("weighthelp_mzfw", "MZFW:") 904 self.add("weighthelp_mtow", "MTOW:") 905 self.add("weighthelp_mlw", "MLW:") 906 self.add("weighthelp_busy", "A tömegadatok lekérdezése...") 907 844 908 #------------------------------------------------------------------------------ 845 909 -
src/mlx/pyuipc_sim.py
r89 r117 243 243 self.n1 = [0.0, 0.0, 0.0] 244 244 self.throttles = [0.0, 0.0, 0.0] 245 246 self.payloadCount = 1 247 self.payload = [] 248 for i in range(0, 61): self.payload.append(0.0) 245 249 246 250 def read(self, offset): … … 402 406 elif offset==0x1260: # External 2 tank capacity 403 407 return self._getFuelCapacity(self.FUEL_EXTERNAL_2) 408 elif offset==0x13fc: # The number of the payload stations 409 return self.payloadCount 410 elif offset>=0x1400 and offset<=0x1f40 and \ 411 ((offset-0x1400)%48)==0: # Payload 412 return self.payload[ (offset - 0x1400) / 48 ] 404 413 elif offset==0x2000: # Engine #1 N1 405 414 return self.n1[self.ENGINE_1] … … 581 590 elif offset==0x1260: # External 2 tank capacity 582 591 self._setFuelCapacity(self.FUEL_EXTERNAL_2, value) 592 elif offset==0x13fc: # The number of the payload stations 593 self.payloadCount = int(value) 594 elif offset>=0x1400 and offset<=0x1f40 and \ 595 ((offset-0x1400)%48)==0: # Payload 596 self.payload[ (offset - 0x1400) / 48 ] = value 583 597 elif offset==0x2000: # Engine #1 N1 584 598 self.n1[self.ENGINE_1] = value … … 1114 1128 100.0/1609.344)) 1115 1129 1130 self._valueHandlers["payloadCount"] = (0x13fc, "d", 1131 lambda value: value, 1132 lambda word: int(word)) 1133 for i in range(0, 61): 1134 self._valueHandlers["payload%d" % (i,)] = (0x1400 + i * 48, "f", 1135 lambda value: 1136 value * const.LBSTOKG, 1137 lambda word: 1138 float(word)*const.KGSTOLB) 1139 1116 1140 def default(self, line): 1117 1141 """Handle unhandle commands."""
Note:
See TracChangeset
for help on using the changeset viewer.