source: src/mlx/const.py@ 305:ddc2dfec2080

Last change on this file since 305:ddc2dfec2080 was 298:24c67ec5cdca, checked in by István Váradi <ivaradi@…>, 12 years ago

Documented the non-GUI modules

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