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