source: src/mlx/const.py@ 805:41c3bffe8a25

Last change on this file since 805:41c3bffe8a25 was 804:afbbd0132506, checked in by István Váradi <ivaradi@…>, 8 years ago

Stepped version

File size: 13.0 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
249#-------------------------------------------------------------------------------
250
251## Message type: logger error
252# FIXME: cannot set the hotkey
253MESSAGETYPE_LOGGER_ERROR = 1
254
255## Message type: information
256MESSAGETYPE_INFORMATION = 2
257
258## Message type: in-flight information
259MESSAGETYPE_INFLIGHT = 3
260
261## Message type: fault messages
262MESSAGETYPE_FAULT = 4
263
264## Message type: NO-GO fault messages
265MESSAGETYPE_NOGO = 5
266
267## Message type: gate system messages
268MESSAGETYPE_GATE_SYSTEM = 6
269
270## Message type: environment messages
271# FIXME: flight plan closed (5 sec)
272MESSAGETYPE_ENVIRONMENT = 7
273
274## Message type: help messages
275MESSAGETYPE_HELP = 8
276
277## Message type: visibility messages
278MESSAGETYPE_VISIBILITY = 9
279
280#-------------------------------------------------------------------------------
281
282messageTypes = [ 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
304def 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
312MESSAGELEVEL_NONE = 0
313
314## Message display level: only message in the simulator
315MESSAGELEVEL_FS = 1
316
317## Message display level: only sound
318MESSAGELEVEL_SOUND = 2
319
320## Message display level: both
321MESSAGELEVEL_BOTH = 3
322
323#-------------------------------------------------------------------------------
324
325messageLevels = [ 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
337def messageLevel2string(messageLevel):
338 """Get the string equivalent of the given message level."""
339 return _messageLevelStrings[messageLevel] \
340 if messageLevel in _messageLevelStrings else None
341
342def 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
352SOUND_DING = "ding.wav"
353
354## Sound: notify
355SOUND_NOTIFY = "notify.wav"
356
357## Sound: NOTAM
358SOUND_NOTAM = "notam.mp3"
359
360## Sound: scream
361SOUND_SCREAM = "sikoly.mp3"
362
363## Sound: boarding
364SOUND_BOARDING = "board.mp3"
365
366## Sound: Malev theme
367SOUND_MALEV = "malev.mp3"
368
369## Sound: taxi: Boeing 737 NG
370SOUND_TAXI_BOEING737NG = "737taxi.mp3"
371
372## Sound: taxi: Boeing 767
373SOUND_TAXI_BOEING767 = "767taxi.mp3"
374
375## Sound: taxi: Fokker F70
376SOUND_TAXI_F70 = "F70taxi.mp3"
377
378## Sound: takeoff preparation request from the captain
379SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
380
381## Sound: cruise
382SOUND_CRUISE = "TOC.mp3"
383
384## Sound: descent
385SOUND_DESCENT = "TOD.mp3"
386
387## Sound: applause
388SOUND_APPLAUSE = "taps.mp3"
389
390## Sound: speedbrake
391SOUND_SPEEDBRAKE = "speed.mp3"
392
393## Sound: taxi after landing
394SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
395
396
397#-------------------------------------------------------------------------------
398
399## Fuel tank: centre
400FUELTANK_CENTRE = 1
401
402## Fuel tank: left
403FUELTANK_LEFT = 2
404
405## Fuel tank: right
406FUELTANK_RIGHT = 3
407
408## Fuel tank: left aux
409FUELTANK_LEFT_AUX = 4
410
411## Fuel tank: right aux
412FUELTANK_RIGHT_AUX = 5
413
414## Fuel tank: left tip
415FUELTANK_LEFT_TIP = 6
416
417## Fuel tank: right tip
418FUELTANK_RIGHT_TIP = 7
419
420## Fuel tank: external 1
421FUELTANK_EXTERNAL1 = 8
422
423## Fuel tank: external 2
424FUELTANK_EXTERNAL2 = 9
425
426## Fuel tank: centre2
427FUELTANK_CENTRE2 = 10
428
429#-------------------------------------------------------------------------------
430
431fuelTanks = [ 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
455def 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
473def 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
480languages = ["$system", "en_GB", "hu_HU"]
481
482#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.