source: src/mlx/const.py@ 843:0256b22555cc

Last change on this file since 843:0256b22555cc was 835:253df5ee72c5, checked in by István Váradi <ivaradi@…>, 8 years ago

Function to extract the index of a flight type

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