source: src/mlx/const.py@ 664:59eaa8243831

Last change on this file since 664:59eaa8243831 was 657:02dbe9fe9d87, checked in by István Váradi <ivaradi@…>, 9 years ago

Added constant for P3D as well as a check for the version (re #273).

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