1 |
|
---|
2 | import sys
|
---|
3 |
|
---|
4 | #-------------------------------------------------------------------------------
|
---|
5 |
|
---|
6 | ## @package mlx.const
|
---|
7 | #
|
---|
8 | # The constants used by the program.
|
---|
9 |
|
---|
10 | #-------------------------------------------------------------------------------
|
---|
11 |
|
---|
12 | ## The version of the program
|
---|
13 | VERSION="0.38.2"
|
---|
14 |
|
---|
15 | #-------------------------------------------------------------------------------
|
---|
16 |
|
---|
17 | ## The ratio between lbs and kg
|
---|
18 | LBSTOKG=0.4536
|
---|
19 |
|
---|
20 | ## The ratio between kgs and lbs
|
---|
21 | KGSTOLB=1/LBSTOKG
|
---|
22 |
|
---|
23 | ## The ratio between feet and metre
|
---|
24 | FEETTOMETRES=0.3048
|
---|
25 |
|
---|
26 | #-------------------------------------------------------------------------------
|
---|
27 |
|
---|
28 | ## The ratio between knots and km/h
|
---|
29 | KNOTSTOKMPH=1.852
|
---|
30 |
|
---|
31 | ## The ratio between km/h and knots
|
---|
32 | KMPHTOKNOTS=1/1.852
|
---|
33 |
|
---|
34 | #-------------------------------------------------------------------------------
|
---|
35 |
|
---|
36 | ## Flight simulator type: MS Flight Simulator 2004
|
---|
37 | SIM_MSFS9 = 1
|
---|
38 |
|
---|
39 | ## Flight simulator type: MS Flight Simulator X
|
---|
40 | SIM_MSFSX = 2
|
---|
41 |
|
---|
42 | ## Flight simulator type: X-Plane 9
|
---|
43 | SIM_XPLANE9 = 3
|
---|
44 |
|
---|
45 | ## Flight simulator type: X-Plane 10
|
---|
46 | SIM_XPLANE10 = 4
|
---|
47 |
|
---|
48 | ## Flight simulator type: Prepar3D
|
---|
49 | SIM_P3D = 5
|
---|
50 |
|
---|
51 | #-------------------------------------------------------------------------------
|
---|
52 |
|
---|
53 | ## Aircraft type: Boeing 737-600
|
---|
54 | AIRCRAFT_B736 = 1
|
---|
55 |
|
---|
56 | ## Aircraft type: Boeing 737-700
|
---|
57 | AIRCRAFT_B737 = 2
|
---|
58 |
|
---|
59 | ## Aircraft type: Boeing 737-800
|
---|
60 | AIRCRAFT_B738 = 3
|
---|
61 |
|
---|
62 | ## Aircraft type: Boeing 737-800 (charter configuration)
|
---|
63 | AIRCRAFT_B738C = 16
|
---|
64 |
|
---|
65 | ## Aircraft type: Boeing 737-300
|
---|
66 | AIRCRAFT_B733 = 4
|
---|
67 |
|
---|
68 | ## Aircraft type: Boeing 737-400
|
---|
69 | AIRCRAFT_B734 = 5
|
---|
70 |
|
---|
71 | ## Aircraft type: Boeing 737-500
|
---|
72 | AIRCRAFT_B735 = 6
|
---|
73 |
|
---|
74 | ## Aircraft type: Dash-8 Q400
|
---|
75 | AIRCRAFT_DH8D = 7
|
---|
76 |
|
---|
77 | ## Aircraft type: Boeing 767-200
|
---|
78 | AIRCRAFT_B762 = 8
|
---|
79 |
|
---|
80 | ## Aircraft type: Boeing 767-300
|
---|
81 | AIRCRAFT_B763 = 9
|
---|
82 |
|
---|
83 | ## Aircraft type: Canadair CRJ-200
|
---|
84 | AIRCRAFT_CRJ2 = 10
|
---|
85 |
|
---|
86 | ## Aircraft type: Fokker F-70
|
---|
87 | AIRCRAFT_F70 = 11
|
---|
88 |
|
---|
89 | ## Aircraft type: Lisunov Li-2
|
---|
90 | AIRCRAFT_DC3 = 12
|
---|
91 |
|
---|
92 | ## Aircraft type: Tupolev Tu-134
|
---|
93 | AIRCRAFT_T134 = 13
|
---|
94 |
|
---|
95 | ## Aircraft type: Tupolev Tu-154
|
---|
96 | AIRCRAFT_T154 = 14
|
---|
97 |
|
---|
98 | ## Aircraft type: Yakovlev Yak-40
|
---|
99 | AIRCRAFT_YK40 = 15
|
---|
100 |
|
---|
101 | ## Aircraft type: British Aerospace BAe-146
|
---|
102 | AIRCRAFT_B462 = 17
|
---|
103 |
|
---|
104 | #-------------------------------------------------------------------------------
|
---|
105 |
|
---|
106 | ## The list of aircraft types that we know of
|
---|
107 | # The order is mostly from most recent to oldest considering
|
---|
108 | # Malev's history
|
---|
109 | aircraftTypes = [AIRCRAFT_B736, AIRCRAFT_B737,
|
---|
110 | AIRCRAFT_B738, AIRCRAFT_B738C,
|
---|
111 | AIRCRAFT_DH8D,
|
---|
112 | AIRCRAFT_F70, AIRCRAFT_CRJ2,
|
---|
113 | AIRCRAFT_B762, AIRCRAFT_B763,
|
---|
114 | AIRCRAFT_B733, AIRCRAFT_B734, AIRCRAFT_B735,
|
---|
115 | AIRCRAFT_T154, AIRCRAFT_T134,
|
---|
116 | AIRCRAFT_YK40, AIRCRAFT_DC3,
|
---|
117 | AIRCRAFT_B462]
|
---|
118 |
|
---|
119 | #-------------------------------------------------------------------------------
|
---|
120 |
|
---|
121 | ## A mapping of aircraft types to their 'internal' ICAO codes (which are
|
---|
122 | # the same as the real ICAO codes, except in a few cases)
|
---|
123 | icaoCodes = { AIRCRAFT_B736 : "B736",
|
---|
124 | AIRCRAFT_B737 : "B737",
|
---|
125 | AIRCRAFT_B738 : "B738",
|
---|
126 | AIRCRAFT_B738C : "B738C",
|
---|
127 | AIRCRAFT_B733 : "B733",
|
---|
128 | AIRCRAFT_B734 : "B734",
|
---|
129 | AIRCRAFT_B735 : "B735",
|
---|
130 | AIRCRAFT_DH8D : "DH8D",
|
---|
131 | AIRCRAFT_B762 : "B762",
|
---|
132 | AIRCRAFT_B763 : "B763",
|
---|
133 | AIRCRAFT_CRJ2 : "CRJ2",
|
---|
134 | AIRCRAFT_F70 : "F70",
|
---|
135 | AIRCRAFT_DC3 : "DC3",
|
---|
136 | AIRCRAFT_T134 : "T134",
|
---|
137 | AIRCRAFT_T154 : "T154",
|
---|
138 | AIRCRAFT_YK40 : "YK40",
|
---|
139 | AIRCRAFT_B462 : "B462" }
|
---|
140 |
|
---|
141 | #-------------------------------------------------------------------------------
|
---|
142 |
|
---|
143 | ## Flight stage: boarding
|
---|
144 | STAGE_BOARDING = 1
|
---|
145 |
|
---|
146 | ## Flight stage: pushback, startup and taxi
|
---|
147 | STAGE_PUSHANDTAXI = 2
|
---|
148 |
|
---|
149 | ## Flight stage: takeoff
|
---|
150 | STAGE_TAKEOFF = 3
|
---|
151 |
|
---|
152 | ## Flight stage: RTO
|
---|
153 | STAGE_RTO = 4
|
---|
154 |
|
---|
155 | ## Flight stage: climb
|
---|
156 | STAGE_CLIMB = 5
|
---|
157 |
|
---|
158 | ## Flight stage: cruise
|
---|
159 | STAGE_CRUISE = 6
|
---|
160 |
|
---|
161 | ## Flight stage: descent
|
---|
162 | STAGE_DESCENT = 7
|
---|
163 |
|
---|
164 | ## Flight stage: landing
|
---|
165 | STAGE_LANDING = 8
|
---|
166 |
|
---|
167 | ## Flight stage: taxi after landing
|
---|
168 | STAGE_TAXIAFTERLAND = 9
|
---|
169 |
|
---|
170 | ## Flight stage: parking
|
---|
171 | STAGE_PARKING = 10
|
---|
172 |
|
---|
173 | ## Flight stage: go-around
|
---|
174 | STAGE_GOAROUND = 11
|
---|
175 |
|
---|
176 | ## Flight stage: end
|
---|
177 | STAGE_END = 12
|
---|
178 |
|
---|
179 | #-------------------------------------------------------------------------------
|
---|
180 |
|
---|
181 | _stageStrings = { STAGE_BOARDING : "boarding",
|
---|
182 | STAGE_PUSHANDTAXI : "pushback and taxi",
|
---|
183 | STAGE_TAKEOFF : "takeoff",
|
---|
184 | STAGE_RTO : "RTO",
|
---|
185 | STAGE_CLIMB : "climb",
|
---|
186 | STAGE_CRUISE : "cruise",
|
---|
187 | STAGE_DESCENT : "descent",
|
---|
188 | STAGE_LANDING : "landing",
|
---|
189 | STAGE_TAXIAFTERLAND : "taxi",
|
---|
190 | STAGE_PARKING : "parking",
|
---|
191 | STAGE_GOAROUND : "go-around",
|
---|
192 | STAGE_END : "end" }
|
---|
193 |
|
---|
194 | def stage2string(stage):
|
---|
195 | """Convert the given stage to a lower-case string."""
|
---|
196 | return _stageStrings[stage] if stage in _stageStrings else None
|
---|
197 |
|
---|
198 | #-------------------------------------------------------------------------------
|
---|
199 |
|
---|
200 | ## Plane status: unknown
|
---|
201 | PLANE_UNKNOWN = 0
|
---|
202 |
|
---|
203 | ## Plane status: at home, i.e. LHBP
|
---|
204 | PLANE_HOME = 1
|
---|
205 |
|
---|
206 | ## Plane status: away
|
---|
207 | PLANE_AWAY = 2
|
---|
208 |
|
---|
209 | ## Plane status: parking
|
---|
210 | PLANE_PARKING = 3
|
---|
211 |
|
---|
212 | #-------------------------------------------------------------------------------
|
---|
213 |
|
---|
214 | ## Flight type: scheduled
|
---|
215 | FLIGHTTYPE_SCHEDULED = 0
|
---|
216 |
|
---|
217 | ## Flight type: old-timer
|
---|
218 | FLIGHTTYPE_OLDTIMER = 1
|
---|
219 |
|
---|
220 | ## Flight type: VIP
|
---|
221 | FLIGHTTYPE_VIP = 2
|
---|
222 |
|
---|
223 | ## Flight type: charter
|
---|
224 | FLIGHTTYPE_CHARTER = 3
|
---|
225 |
|
---|
226 | #-------------------------------------------------------------------------------
|
---|
227 |
|
---|
228 | flightTypes = [ FLIGHTTYPE_SCHEDULED,
|
---|
229 | FLIGHTTYPE_OLDTIMER,
|
---|
230 | FLIGHTTYPE_VIP,
|
---|
231 | FLIGHTTYPE_CHARTER ]
|
---|
232 |
|
---|
233 | #-------------------------------------------------------------------------------
|
---|
234 |
|
---|
235 | _flightTypeStrings = { FLIGHTTYPE_SCHEDULED : "scheduled",
|
---|
236 | FLIGHTTYPE_OLDTIMER : "ot",
|
---|
237 | FLIGHTTYPE_VIP : "vip",
|
---|
238 | FLIGHTTYPE_CHARTER : "charter" }
|
---|
239 |
|
---|
240 | def flightType2string(flightType):
|
---|
241 | """Get the string equivalent of the given flight type."""
|
---|
242 | return _flightTypeStrings[flightType] \
|
---|
243 | if flightType in _flightTypeStrings else None
|
---|
244 |
|
---|
245 | #-------------------------------------------------------------------------------
|
---|
246 |
|
---|
247 | ## Message type: logger error
|
---|
248 | # FIXME: cannot set the hotkey
|
---|
249 | MESSAGETYPE_LOGGER_ERROR = 1
|
---|
250 |
|
---|
251 | ## Message type: information
|
---|
252 | MESSAGETYPE_INFORMATION = 2
|
---|
253 |
|
---|
254 | ## Message type: in-flight information
|
---|
255 | MESSAGETYPE_INFLIGHT = 3
|
---|
256 |
|
---|
257 | ## Message type: fault messages
|
---|
258 | MESSAGETYPE_FAULT = 4
|
---|
259 |
|
---|
260 | ## Message type: NO-GO fault messages
|
---|
261 | MESSAGETYPE_NOGO = 5
|
---|
262 |
|
---|
263 | ## Message type: gate system messages
|
---|
264 | MESSAGETYPE_GATE_SYSTEM = 6
|
---|
265 |
|
---|
266 | ## Message type: environment messages
|
---|
267 | # FIXME: flight plan closed (5 sec)
|
---|
268 | MESSAGETYPE_ENVIRONMENT = 7
|
---|
269 |
|
---|
270 | ## Message type: help messages
|
---|
271 | MESSAGETYPE_HELP = 8
|
---|
272 |
|
---|
273 | ## Message type: visibility messages
|
---|
274 | MESSAGETYPE_VISIBILITY = 9
|
---|
275 |
|
---|
276 | #-------------------------------------------------------------------------------
|
---|
277 |
|
---|
278 | messageTypes = [ MESSAGETYPE_LOGGER_ERROR,
|
---|
279 | MESSAGETYPE_INFORMATION,
|
---|
280 | MESSAGETYPE_INFLIGHT,
|
---|
281 | MESSAGETYPE_FAULT,
|
---|
282 | MESSAGETYPE_NOGO,
|
---|
283 | MESSAGETYPE_GATE_SYSTEM,
|
---|
284 | MESSAGETYPE_ENVIRONMENT,
|
---|
285 | MESSAGETYPE_HELP,
|
---|
286 | MESSAGETYPE_VISIBILITY ]
|
---|
287 |
|
---|
288 | #-------------------------------------------------------------------------------
|
---|
289 |
|
---|
290 | _messageTypeStrings = { MESSAGETYPE_LOGGER_ERROR : "loggerError",
|
---|
291 | MESSAGETYPE_INFORMATION : "information",
|
---|
292 | MESSAGETYPE_INFLIGHT : "inflight",
|
---|
293 | MESSAGETYPE_FAULT : "fault",
|
---|
294 | MESSAGETYPE_NOGO : "nogo",
|
---|
295 | MESSAGETYPE_GATE_SYSTEM : "gateSystem",
|
---|
296 | MESSAGETYPE_ENVIRONMENT : "environment",
|
---|
297 | MESSAGETYPE_HELP : "help",
|
---|
298 | MESSAGETYPE_VISIBILITY : "visibility" }
|
---|
299 |
|
---|
300 | def messageType2string(messageType):
|
---|
301 | """Get the string equivalent of the given message type."""
|
---|
302 | return _messageTypeStrings[messageType] \
|
---|
303 | if messageType in _messageTypeStrings else None
|
---|
304 |
|
---|
305 | #-------------------------------------------------------------------------------
|
---|
306 |
|
---|
307 | ## Message display level: none
|
---|
308 | MESSAGELEVEL_NONE = 0
|
---|
309 |
|
---|
310 | ## Message display level: only message in the simulator
|
---|
311 | MESSAGELEVEL_FS = 1
|
---|
312 |
|
---|
313 | ## Message display level: only sound
|
---|
314 | MESSAGELEVEL_SOUND = 2
|
---|
315 |
|
---|
316 | ## Message display level: both
|
---|
317 | MESSAGELEVEL_BOTH = 3
|
---|
318 |
|
---|
319 | #-------------------------------------------------------------------------------
|
---|
320 |
|
---|
321 | messageLevels = [ MESSAGELEVEL_NONE,
|
---|
322 | MESSAGELEVEL_FS,
|
---|
323 | MESSAGELEVEL_SOUND,
|
---|
324 | MESSAGELEVEL_BOTH ]
|
---|
325 |
|
---|
326 | #-------------------------------------------------------------------------------
|
---|
327 |
|
---|
328 | _messageLevelStrings = { MESSAGELEVEL_NONE : "none",
|
---|
329 | MESSAGELEVEL_FS : "fs",
|
---|
330 | MESSAGELEVEL_SOUND : "sound",
|
---|
331 | MESSAGELEVEL_BOTH : "both" }
|
---|
332 |
|
---|
333 | def messageLevel2string(messageLevel):
|
---|
334 | """Get the string equivalent of the given message level."""
|
---|
335 | return _messageLevelStrings[messageLevel] \
|
---|
336 | if messageLevel in _messageLevelStrings else None
|
---|
337 |
|
---|
338 | def string2messageLevel(str):
|
---|
339 | """Get the message level for the given string."""
|
---|
340 | for (value, s) in _messageLevelStrings.iteritems():
|
---|
341 | if str==s:
|
---|
342 | return value
|
---|
343 | return MESSAGELEVEL_NONE
|
---|
344 |
|
---|
345 | #-------------------------------------------------------------------------------
|
---|
346 |
|
---|
347 | ## Sound: ding
|
---|
348 | SOUND_DING = "ding.wav"
|
---|
349 |
|
---|
350 | ## Sound: notify
|
---|
351 | SOUND_NOTIFY = "notify.wav"
|
---|
352 |
|
---|
353 | ## Sound: NOTAM
|
---|
354 | SOUND_NOTAM = "notam.mp3"
|
---|
355 |
|
---|
356 | ## Sound: scream
|
---|
357 | SOUND_SCREAM = "sikoly.mp3"
|
---|
358 |
|
---|
359 | ## Sound: boarding
|
---|
360 | SOUND_BOARDING = "board.mp3"
|
---|
361 |
|
---|
362 | ## Sound: Malev theme
|
---|
363 | SOUND_MALEV = "malev.mp3"
|
---|
364 |
|
---|
365 | ## Sound: taxi: Boeing 737 NG
|
---|
366 | SOUND_TAXI_BOEING737NG = "737taxi.mp3"
|
---|
367 |
|
---|
368 | ## Sound: taxi: Boeing 767
|
---|
369 | SOUND_TAXI_BOEING767 = "767taxi.mp3"
|
---|
370 |
|
---|
371 | ## Sound: taxi: Fokker F70
|
---|
372 | SOUND_TAXI_F70 = "F70taxi.mp3"
|
---|
373 |
|
---|
374 | ## Sound: takeoff preparation request from the captain
|
---|
375 | SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
|
---|
376 |
|
---|
377 | ## Sound: cruise
|
---|
378 | SOUND_CRUISE = "TOC.mp3"
|
---|
379 |
|
---|
380 | ## Sound: descent
|
---|
381 | SOUND_DESCENT = "TOD.mp3"
|
---|
382 |
|
---|
383 | ## Sound: applause
|
---|
384 | SOUND_APPLAUSE = "taps.mp3"
|
---|
385 |
|
---|
386 | ## Sound: speedbrake
|
---|
387 | SOUND_SPEEDBRAKE = "speed.mp3"
|
---|
388 |
|
---|
389 | ## Sound: taxi after landing
|
---|
390 | SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
|
---|
391 |
|
---|
392 |
|
---|
393 | #-------------------------------------------------------------------------------
|
---|
394 |
|
---|
395 | ## Fuel tank: centre
|
---|
396 | FUELTANK_CENTRE = 1
|
---|
397 |
|
---|
398 | ## Fuel tank: left
|
---|
399 | FUELTANK_LEFT = 2
|
---|
400 |
|
---|
401 | ## Fuel tank: right
|
---|
402 | FUELTANK_RIGHT = 3
|
---|
403 |
|
---|
404 | ## Fuel tank: left aux
|
---|
405 | FUELTANK_LEFT_AUX = 4
|
---|
406 |
|
---|
407 | ## Fuel tank: right aux
|
---|
408 | FUELTANK_RIGHT_AUX = 5
|
---|
409 |
|
---|
410 | ## Fuel tank: left tip
|
---|
411 | FUELTANK_LEFT_TIP = 6
|
---|
412 |
|
---|
413 | ## Fuel tank: right tip
|
---|
414 | FUELTANK_RIGHT_TIP = 7
|
---|
415 |
|
---|
416 | ## Fuel tank: external 1
|
---|
417 | FUELTANK_EXTERNAL1 = 8
|
---|
418 |
|
---|
419 | ## Fuel tank: external 2
|
---|
420 | FUELTANK_EXTERNAL2 = 9
|
---|
421 |
|
---|
422 | ## Fuel tank: centre2
|
---|
423 | FUELTANK_CENTRE2 = 10
|
---|
424 |
|
---|
425 | #-------------------------------------------------------------------------------
|
---|
426 |
|
---|
427 | fuelTanks = [ FUELTANK_CENTRE,
|
---|
428 | FUELTANK_LEFT,
|
---|
429 | FUELTANK_RIGHT,
|
---|
430 | FUELTANK_LEFT_AUX,
|
---|
431 | FUELTANK_RIGHT_AUX,
|
---|
432 | FUELTANK_LEFT_TIP,
|
---|
433 | FUELTANK_RIGHT_TIP,
|
---|
434 | FUELTANK_EXTERNAL1,
|
---|
435 | FUELTANK_EXTERNAL2,
|
---|
436 | FUELTANK_CENTRE2 ]
|
---|
437 |
|
---|
438 | #-------------------------------------------------------------------------------
|
---|
439 |
|
---|
440 | _fuelTankStrings = { FUELTANK_CENTRE : "centre",
|
---|
441 | FUELTANK_LEFT : "left",
|
---|
442 | FUELTANK_RIGHT : "right",
|
---|
443 | FUELTANK_LEFT_AUX : "left_aux",
|
---|
444 | FUELTANK_RIGHT_AUX : "right_aux",
|
---|
445 | FUELTANK_LEFT_TIP : "left_tip",
|
---|
446 | FUELTANK_RIGHT_TIP : "right_tip",
|
---|
447 | FUELTANK_EXTERNAL1 : "external1",
|
---|
448 | FUELTANK_EXTERNAL2 : "external2",
|
---|
449 | FUELTANK_CENTRE2 : "centre2" }
|
---|
450 |
|
---|
451 | def fuelTank2string(fuelTank):
|
---|
452 | """Get the string equivalent of the given fuelTank."""
|
---|
453 | return _fuelTankStrings[fuelTank] \
|
---|
454 | if fuelTank in _fuelTankStrings else None
|
---|
455 |
|
---|
456 | #-------------------------------------------------------------------------------
|
---|
457 |
|
---|
458 | _fuelTankLogStrings = { FUELTANK_CENTRE : "centre",
|
---|
459 | FUELTANK_LEFT : "left",
|
---|
460 | FUELTANK_RIGHT : "right",
|
---|
461 | FUELTANK_LEFT_AUX : "left aux",
|
---|
462 | FUELTANK_RIGHT_AUX : "right aux",
|
---|
463 | FUELTANK_LEFT_TIP : "left tip",
|
---|
464 | FUELTANK_RIGHT_TIP : "right tip",
|
---|
465 | FUELTANK_EXTERNAL1 : "external 1",
|
---|
466 | FUELTANK_EXTERNAL2 : "external 2",
|
---|
467 | FUELTANK_CENTRE2 : "centre 2" }
|
---|
468 |
|
---|
469 | def fuelTank2logString(fuelTank):
|
---|
470 | """Get the log string equivalent of the given fuelTank."""
|
---|
471 | return _fuelTankLogStrings[fuelTank] \
|
---|
472 | if fuelTank in _fuelTankLogStrings else "unknown"
|
---|
473 |
|
---|
474 | #-------------------------------------------------------------------------------
|
---|
475 |
|
---|
476 | languages = ["$system", "en_GB", "hu_HU"]
|
---|
477 |
|
---|
478 | #-------------------------------------------------------------------------------
|
---|