1 | # Various constants used in the logger
|
---|
2 |
|
---|
3 | #-------------------------------------------------------------------------------
|
---|
4 |
|
---|
5 | # The version of the program
|
---|
6 | VERSION="0.03"
|
---|
7 |
|
---|
8 | #-------------------------------------------------------------------------------
|
---|
9 |
|
---|
10 | # The ratio between lbs and kg
|
---|
11 | LBSTOKG=0.4536
|
---|
12 |
|
---|
13 | # The ratio between kgs and lbs
|
---|
14 | KGSTOLB=1/LBSTOKG
|
---|
15 |
|
---|
16 | # The ratio between feet and metre
|
---|
17 | FEETTOMETRES=0.3048
|
---|
18 |
|
---|
19 | #-------------------------------------------------------------------------------
|
---|
20 |
|
---|
21 | # Flight simulator type: MS Flight Simulator 2004
|
---|
22 | SIM_MSFS9 = 1
|
---|
23 |
|
---|
24 | # Flight simulator type: MS Flight Simulator X
|
---|
25 | SIM_MSFSX = 2
|
---|
26 |
|
---|
27 | # Flight simulator type: X-Plane 9
|
---|
28 | SIM_XPLANE9 = 3
|
---|
29 |
|
---|
30 | # Flight simulator type: X-Plane 10
|
---|
31 | SIM_XPLANE10 = 4
|
---|
32 |
|
---|
33 | #-------------------------------------------------------------------------------
|
---|
34 |
|
---|
35 | # Aircraft type: Boeing 737-600
|
---|
36 | AIRCRAFT_B736 = 1
|
---|
37 |
|
---|
38 | # Aircraft type: Boeing 737-700
|
---|
39 | AIRCRAFT_B737 = 2
|
---|
40 |
|
---|
41 | # Aircraft type: Boeing 737-800
|
---|
42 | AIRCRAFT_B738 = 3
|
---|
43 |
|
---|
44 | # Aircraft type: Boeing 737-300
|
---|
45 | AIRCRAFT_B733 = 4
|
---|
46 |
|
---|
47 | # Aircraft type: Boeing 737-400
|
---|
48 | AIRCRAFT_B734 = 5
|
---|
49 |
|
---|
50 | # Aircraft type: Boeing 737-500
|
---|
51 | AIRCRAFT_B735 = 6
|
---|
52 |
|
---|
53 | # Aircraft type: Dash-8 Q400
|
---|
54 | AIRCRAFT_DH8D = 7
|
---|
55 |
|
---|
56 | # Aircraft type: Boeing 767-200
|
---|
57 | AIRCRAFT_B762 = 8
|
---|
58 |
|
---|
59 | # Aircraft type: Boeing 767-300
|
---|
60 | AIRCRAFT_B763 = 9
|
---|
61 |
|
---|
62 | # Aircraft type: Canadair CRJ-200
|
---|
63 | AIRCRAFT_CRJ2 = 10
|
---|
64 |
|
---|
65 | # Aircraft type: Fokker F-70
|
---|
66 | AIRCRAFT_F70 = 11
|
---|
67 |
|
---|
68 | # Aircraft type: Lisunov Li-2
|
---|
69 | AIRCRAFT_DC3 = 12
|
---|
70 |
|
---|
71 | # Aircraft type: Tupolev Tu-134
|
---|
72 | AIRCRAFT_T134 = 13
|
---|
73 |
|
---|
74 | # Aircraft type: Tupolev Tu-154
|
---|
75 | AIRCRAFT_T154 = 14
|
---|
76 |
|
---|
77 | # Aircraft type: Yakovlev Yak-40
|
---|
78 | AIRCRAFT_YK40 = 15
|
---|
79 |
|
---|
80 | #-------------------------------------------------------------------------------
|
---|
81 |
|
---|
82 | # Flight stage: boarding
|
---|
83 | STAGE_BOARDING = 1
|
---|
84 |
|
---|
85 | # Flight stage: pushback, startup and taxi
|
---|
86 | STAGE_PUSHANDTAXI = 2
|
---|
87 |
|
---|
88 | # Flight stage: takeoff
|
---|
89 | STAGE_TAKEOFF = 3
|
---|
90 |
|
---|
91 | # Flight stage: RTO
|
---|
92 | STAGE_RTO = 4
|
---|
93 |
|
---|
94 | # Flight stage: climb
|
---|
95 | STAGE_CLIMB = 5
|
---|
96 |
|
---|
97 | # Flight stage: cruise
|
---|
98 | STAGE_CRUISE = 6
|
---|
99 |
|
---|
100 | # Flight stage: descent
|
---|
101 | STAGE_DESCENT = 7
|
---|
102 |
|
---|
103 | # Flight stage: landing
|
---|
104 | STAGE_LANDING = 8
|
---|
105 |
|
---|
106 | # Flight stage: taxi after landing
|
---|
107 | STAGE_TAXIAFTERLAND = 9
|
---|
108 |
|
---|
109 | # Flight stage: parking
|
---|
110 | STAGE_PARKING = 10
|
---|
111 |
|
---|
112 | # Flight stage: go-around
|
---|
113 | STAGE_GOAROUND = 11
|
---|
114 |
|
---|
115 | # Flight stage: end
|
---|
116 | STAGE_END = 12
|
---|
117 |
|
---|
118 | #-------------------------------------------------------------------------------
|
---|
119 |
|
---|
120 | _stageStrings = { STAGE_BOARDING : "boarding",
|
---|
121 | STAGE_PUSHANDTAXI : "pushback and taxi",
|
---|
122 | STAGE_TAKEOFF : "takeoff",
|
---|
123 | STAGE_RTO : "RTO",
|
---|
124 | STAGE_CLIMB : "climb",
|
---|
125 | STAGE_CRUISE : "cruise",
|
---|
126 | STAGE_DESCENT : "descent",
|
---|
127 | STAGE_LANDING : "landing",
|
---|
128 | STAGE_TAXIAFTERLAND : "taxi",
|
---|
129 | STAGE_PARKING : "parking",
|
---|
130 | STAGE_GOAROUND : "go-around",
|
---|
131 | STAGE_END : "end" }
|
---|
132 |
|
---|
133 | def stage2string(stage):
|
---|
134 | """Convert the given stage to a lower-case string."""
|
---|
135 | return _stageStrings[stage] if stage in _stageStrings else None
|
---|
136 |
|
---|
137 | #-------------------------------------------------------------------------------
|
---|
138 |
|
---|
139 | # Plane status: unknown
|
---|
140 | PLANE_UNKNOWN = 0
|
---|
141 |
|
---|
142 | # Plane status: at home, i.e. LHBP
|
---|
143 | PLANE_HOME = 1
|
---|
144 |
|
---|
145 | # Plane status: away
|
---|
146 | PLANE_AWAY = 2
|
---|
147 |
|
---|
148 | # Plane status: parking
|
---|
149 | PLANE_PARKING = 3
|
---|
150 |
|
---|
151 | #-------------------------------------------------------------------------------
|
---|
152 |
|
---|
153 | # Flight type: scheduled
|
---|
154 | FLIGHTTYPE_SCHEDULED = 0
|
---|
155 |
|
---|
156 | # Flight type: old-timer
|
---|
157 | FLIGHTTYPE_OLDTIMER = 1
|
---|
158 |
|
---|
159 | # Flight type: VIP
|
---|
160 | FLIGHTTYPE_VIP = 2
|
---|
161 |
|
---|
162 | # Flight type: charter
|
---|
163 | FLIGHTTYPE_CHARTER = 3
|
---|
164 |
|
---|
165 | #-------------------------------------------------------------------------------
|
---|
166 |
|
---|
167 | # Delay code: loading problems
|
---|
168 | DELAYCODE_LOADING = 0
|
---|
169 |
|
---|
170 | # Delay code: VATSIM problem
|
---|
171 | DELAYCODE_VATSIM = 1
|
---|
172 |
|
---|
173 | # Delay code: network problems
|
---|
174 | DELAYCODE_NETWORK = 2
|
---|
175 |
|
---|
176 | # Delay code: controller's fault
|
---|
177 | DELAYCODE_CONTROLLER = 3
|
---|
178 |
|
---|
179 | # Delay code: system crash or freeze
|
---|
180 | DELAYCODE_SYSTEM = 4
|
---|
181 |
|
---|
182 | # Delay code: navigation problem
|
---|
183 | DELAYCODE_NAVIGATION = 5
|
---|
184 |
|
---|
185 | # Delay code: traffic problems
|
---|
186 | DELAYCODE_TRAFFIC = 6
|
---|
187 |
|
---|
188 | # Delay code: apron navigation
|
---|
189 | DELAYCODE_APRON = 7
|
---|
190 |
|
---|
191 | # Delay code: weather problems
|
---|
192 | DELAYCODE_WEATHER = 8
|
---|
193 |
|
---|
194 | # Delay code: personal reasons
|
---|
195 | DELAYCODE_PERSONAL = 9
|
---|
196 |
|
---|
197 | #-------------------------------------------------------------------------------
|
---|
198 |
|
---|
199 | # Message type: logger error
|
---|
200 | # FIXME: cannot set the hotkey
|
---|
201 | MESSAGETYPE_LOGGER_ERROR = 1
|
---|
202 |
|
---|
203 | # Message type: information
|
---|
204 | MESSAGETYPE_INFORMATION = 2
|
---|
205 |
|
---|
206 | # Message type: fault messages
|
---|
207 | MESSAGETYPE_FAULT = 3
|
---|
208 |
|
---|
209 | # Message type: NO-GO fault messages
|
---|
210 | MESSAGETYPE_NOGO = 4
|
---|
211 |
|
---|
212 | # Message type: gate system messages
|
---|
213 | MESSAGETYPE_GATE_SYSTEM = 5
|
---|
214 |
|
---|
215 | # Message type: environment messages
|
---|
216 | # FIXME: flight plan closed (5 sec)
|
---|
217 | MESSAGETYPE_ENVIRONMENT = 6
|
---|
218 |
|
---|
219 | # Message type: help messages
|
---|
220 | MESSAGETYPE_HELP = 7
|
---|
221 |
|
---|
222 | # Message type: visibility messages
|
---|
223 | MESSAGETYPE_VISIBILITY = 8
|
---|
224 |
|
---|
225 | #-------------------------------------------------------------------------------
|
---|
226 |
|
---|
227 | messageTypes = [ MESSAGETYPE_LOGGER_ERROR,
|
---|
228 | MESSAGETYPE_INFORMATION,
|
---|
229 | MESSAGETYPE_FAULT,
|
---|
230 | MESSAGETYPE_NOGO,
|
---|
231 | MESSAGETYPE_GATE_SYSTEM,
|
---|
232 | MESSAGETYPE_ENVIRONMENT,
|
---|
233 | MESSAGETYPE_HELP,
|
---|
234 | MESSAGETYPE_VISIBILITY ]
|
---|
235 |
|
---|
236 | #-------------------------------------------------------------------------------
|
---|
237 |
|
---|
238 | _messageTypeStrings = { MESSAGETYPE_LOGGER_ERROR : "loggerError",
|
---|
239 | MESSAGETYPE_INFORMATION : "information",
|
---|
240 | MESSAGETYPE_FAULT : "fault",
|
---|
241 | MESSAGETYPE_NOGO : "nogo",
|
---|
242 | MESSAGETYPE_GATE_SYSTEM : "gateSystem",
|
---|
243 | MESSAGETYPE_ENVIRONMENT : "environment",
|
---|
244 | MESSAGETYPE_HELP : "help",
|
---|
245 | MESSAGETYPE_VISIBILITY : "visibility" }
|
---|
246 |
|
---|
247 | def messageType2string(messageType):
|
---|
248 | """Get the string equivalent of the given message type."""
|
---|
249 | return _messageTypeStrings[messageType] \
|
---|
250 | if messageType in _messageTypeStrings else None
|
---|
251 |
|
---|
252 | #-------------------------------------------------------------------------------
|
---|
253 |
|
---|
254 | # Message display level: none
|
---|
255 | MESSAGELEVEL_NONE = 0
|
---|
256 |
|
---|
257 | # Message display level: only message in the simulator
|
---|
258 | MESSAGELEVEL_FS = 1
|
---|
259 |
|
---|
260 | # Message display level: only sound
|
---|
261 | MESSAGELEVEL_SOUND = 2
|
---|
262 |
|
---|
263 | # Message display level: both
|
---|
264 | MESSAGELEVEL_BOTH = 3
|
---|
265 |
|
---|
266 | #-------------------------------------------------------------------------------
|
---|
267 |
|
---|
268 | messageLevels = [ MESSAGELEVEL_NONE,
|
---|
269 | MESSAGELEVEL_FS,
|
---|
270 | MESSAGELEVEL_SOUND,
|
---|
271 | MESSAGELEVEL_BOTH ]
|
---|
272 |
|
---|
273 | #-------------------------------------------------------------------------------
|
---|
274 |
|
---|
275 | _messageLevelStrings = { MESSAGELEVEL_NONE : "none",
|
---|
276 | MESSAGELEVEL_FS : "fs",
|
---|
277 | MESSAGELEVEL_SOUND : "sound",
|
---|
278 | MESSAGELEVEL_BOTH : "both" }
|
---|
279 |
|
---|
280 | def messageLevel2string(messageLevel):
|
---|
281 | """Get the string equivalent of the given message level."""
|
---|
282 | return _messageLevelStrings[messageLevel] \
|
---|
283 | if messageLevel in _messageLevelStrings else None
|
---|
284 |
|
---|
285 | def string2messageLevel(str):
|
---|
286 | """Get the message level for the given string."""
|
---|
287 | for (value, s) in _messageLevelStrings.iteritems():
|
---|
288 | if str==s:
|
---|
289 | return value
|
---|
290 | return MESSAGELEVEL_NONE
|
---|
291 |
|
---|
292 | #-------------------------------------------------------------------------------
|
---|
293 |
|
---|
294 | # Sound: ding
|
---|
295 | SOUND_DING = "ding.wav"
|
---|
296 |
|
---|
297 | #-------------------------------------------------------------------------------
|
---|
298 |
|
---|
299 | # Fuel tank: centre
|
---|
300 | FUELTANK_CENTRE = 1
|
---|
301 |
|
---|
302 | # Fuel tank: left
|
---|
303 | FUELTANK_LEFT = 2
|
---|
304 |
|
---|
305 | # Fuel tank: right
|
---|
306 | FUELTANK_RIGHT = 3
|
---|
307 |
|
---|
308 | # Fuel tank: left aux
|
---|
309 | FUELTANK_LEFT_AUX = 4
|
---|
310 |
|
---|
311 | # Fuel tank: right aux
|
---|
312 | FUELTANK_RIGHT_AUX = 5
|
---|
313 |
|
---|
314 | # Fuel tank: left tip
|
---|
315 | FUELTANK_LEFT_TIP = 6
|
---|
316 |
|
---|
317 | # Fuel tank: right tip
|
---|
318 | FUELTANK_RIGHT_TIP = 7
|
---|
319 |
|
---|
320 | # Fuel tank: external 1
|
---|
321 | FUELTANK_EXTERNAL1 = 8
|
---|
322 |
|
---|
323 | # Fuel tank: external 2
|
---|
324 | FUELTANK_EXTERNAL2 = 9
|
---|
325 |
|
---|
326 | # Fuel tank: centre2
|
---|
327 | FUELTANK_CENTRE2 = 10
|
---|
328 |
|
---|
329 | #-------------------------------------------------------------------------------
|
---|
330 |
|
---|
331 | fuelTanks = [ FUELTANK_CENTRE,
|
---|
332 | FUELTANK_LEFT,
|
---|
333 | FUELTANK_RIGHT,
|
---|
334 | FUELTANK_LEFT_AUX,
|
---|
335 | FUELTANK_RIGHT_AUX,
|
---|
336 | FUELTANK_LEFT_TIP,
|
---|
337 | FUELTANK_RIGHT_TIP,
|
---|
338 | FUELTANK_EXTERNAL1,
|
---|
339 | FUELTANK_EXTERNAL2,
|
---|
340 | FUELTANK_CENTRE2 ]
|
---|
341 |
|
---|
342 | #-------------------------------------------------------------------------------
|
---|
343 |
|
---|
344 | _fuelTankStrings = { FUELTANK_CENTRE : "centre",
|
---|
345 | FUELTANK_LEFT : "left",
|
---|
346 | FUELTANK_RIGHT : "right",
|
---|
347 | FUELTANK_LEFT_AUX : "left_aux",
|
---|
348 | FUELTANK_RIGHT_AUX : "right_aux",
|
---|
349 | FUELTANK_LEFT_TIP : "left_tip",
|
---|
350 | FUELTANK_RIGHT_TIP : "right_tip",
|
---|
351 | FUELTANK_EXTERNAL1 : "external1",
|
---|
352 | FUELTANK_EXTERNAL2 : "external2",
|
---|
353 | FUELTANK_CENTRE2 : "centre2" }
|
---|
354 |
|
---|
355 | def fuelTank2string(fuelTank):
|
---|
356 | """Get the string equivalent of the given fuelTank."""
|
---|
357 | return _fuelTankStrings[fuelTank] \
|
---|
358 | if fuelTank in _fuelTankStrings else None
|
---|
359 |
|
---|
360 | #-------------------------------------------------------------------------------
|
---|
361 |
|
---|
362 | # The available gates at LHBP
|
---|
363 | lhbpGateNumbers = []
|
---|
364 |
|
---|
365 | for i in range(1, 7):
|
---|
366 | lhbpGateNumbers.append(str(i))
|
---|
367 |
|
---|
368 | for i in range(10, 19):
|
---|
369 | lhbpGateNumbers.append(str(i))
|
---|
370 |
|
---|
371 | for i in range(24, 28):
|
---|
372 | lhbpGateNumbers.append(str(i))
|
---|
373 |
|
---|
374 | for i in range(31, 39):
|
---|
375 | lhbpGateNumbers.append(str(i))
|
---|
376 |
|
---|
377 | for i in range(42, 47):
|
---|
378 | lhbpGateNumbers.append(str(i))
|
---|
379 |
|
---|
380 | for i in range(60, 84):
|
---|
381 | if i!=70 and i!=80:
|
---|
382 | lhbpGateNumbers.append(str(i))
|
---|
383 |
|
---|
384 | #-------------------------------------------------------------------------------
|
---|
385 |
|
---|
386 | languages = ["$system", "en_GB", "hu_HU"]
|
---|
387 |
|
---|
388 | #-------------------------------------------------------------------------------
|
---|
389 |
|
---|