source: src/mlx/const.py@ 880:86104bcc20f1

Last change on this file since 880:86104bcc20f1 was 880:86104bcc20f1, checked in by István Váradi <ivaradi@…>, 7 years ago

Stepped version

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