source: src/mlx/const.py@ 531:f8ffb59d8112

Last change on this file since 531:f8ffb59d8112 was 524:5f4ec56d1bc2, checked in by István Váradi <ivaradi@…>, 11 years ago

Stepped version

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