Changeset 298:24c67ec5cdca
- Timestamp:
- 07/21/12 12:43:34 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acars.py
r139 r298 1 # Module for ACARS handling 1 2 import const 2 3 3 4 #------------------------------------------------------------------------------ 4 5 5 import const 6 ## @package mlx.acars 7 # 8 # The handling of the ACARS. 9 # 10 # This module defines the \ref ACARS class that is used to extract and contain 11 # the data needed to send ACARS information to the MAVA server. 6 12 7 13 #------------------------------------------------------------------------------ -
src/mlx/acft.py
r297 r298 1 2 import const 3 import checks 4 import fs 5 import util 6 7 import sys 8 import time 9 import traceback 10 11 from collections import deque 12 13 #--------------------------------------------------------------------------------------- 14 1 15 ## @package mlx.acft 2 16 # … … 14 28 # values in the \ref mlx.fs.AircraftState "aircraft state" when it is received 15 29 # from the simulator. 16 17 #---------------------------------------------------------------------------------------18 19 import const20 import checks21 import fs22 import util23 24 import sys25 import time26 import traceback27 28 from collections import deque29 30 30 31 #--------------------------------------------------------------------------------------- -
src/mlx/airports.py
r261 r298 1 # The mapping of ICAO codes to airport names2 1 # -*- coding: utf-8 -*- 2 3 import sys 3 4 4 5 #----------------------------------------------------------------------------- 5 6 7 ## @package mlx.airports 8 # 9 # The mapping of ICAO codes to airport names. 10 # 11 # This module contains the mapping of ICAO codes to airport cities and names, 12 # as well as a \ref getWelcomeMessage "function" to produce a welcome message 13 # for a certain airport. 14 15 #----------------------------------------------------------------------------- 16 17 ## The mapping of the ICAO codes 6 18 airportNames = { 7 19 "VTBS" : ("Bangkok", "Suvarnabhumi"), -
src/mlx/checks.py
r297 r298 1 2 import fs 3 import const 4 import util 5 from acars import ACARS 6 from sound import startSound 7 8 import time 9 10 #--------------------------------------------------------------------------------------- 11 1 12 ## @package mlx.checks 2 13 # … … 13 24 # transitions from one stage of the flight to the next one. Or \ref ACARSSender 14 25 # which sends the ACARS periodically 15 16 #---------------------------------------------------------------------------------------17 18 import fs19 import const20 import util21 from acars import ACARS22 from sound import startSound23 24 import time25 26 26 27 #--------------------------------------------------------------------------------------- -
src/mlx/config.py
r273 r298 1 # Configuration and related stuff2 1 # -*- encoding: utf-8 -*- 3 4 #-------------------------------------------------------------------------------5 2 6 3 import const … … 9 6 import sys 10 7 import ConfigParser 8 9 ## @package mlx.config 10 # 11 # The handling of the configuration. 12 # 13 # The \ref Config class contains the main configuration and is capable of 14 # loading and saving the configuration. It contains getters and setters for the 15 # configuration options. 16 # 17 # Some parts of the configuration are not simple data items, like strings or 18 # booleans, but more complicated data. These have their own class, like \ref 19 # ApproachCallouts or \ref Checklist. 11 20 12 21 #------------------------------------------------------------------------------- -
src/mlx/const.py
r274 r298 1 # Various constants used in the logger 2 3 #------------------------------------------------------------------------------- 4 5 # The version of the program 1 2 import 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 6 13 VERSION="0.6" 7 14 8 15 #------------------------------------------------------------------------------- 9 16 10 # The ratio between lbs and kg17 ## The ratio between lbs and kg 11 18 LBSTOKG=0.4536 12 19 13 # The ratio between kgs and lbs20 ## The ratio between kgs and lbs 14 21 KGSTOLB=1/LBSTOKG 15 22 16 # The ratio between feet and metre23 ## The ratio between feet and metre 17 24 FEETTOMETRES=0.3048 18 25 19 26 #------------------------------------------------------------------------------- 20 27 21 # The ratio between knots and km/h28 ## The ratio between knots and km/h 22 29 KNOTSTOKMPH=1.852 23 30 24 # The ratio between km/h and knots31 ## The ratio between km/h and knots 25 32 KMPHTOKNOTS=1/1.852 26 33 27 34 #------------------------------------------------------------------------------- 28 35 29 # Flight simulator type: MS Flight Simulator 200436 ## Flight simulator type: MS Flight Simulator 2004 30 37 SIM_MSFS9 = 1 31 38 32 # Flight simulator type: MS Flight Simulator X39 ## Flight simulator type: MS Flight Simulator X 33 40 SIM_MSFSX = 2 34 41 35 # Flight simulator type: X-Plane 942 ## Flight simulator type: X-Plane 9 36 43 SIM_XPLANE9 = 3 37 44 38 # Flight simulator type: X-Plane 1045 ## Flight simulator type: X-Plane 10 39 46 SIM_XPLANE10 = 4 40 47 41 48 #------------------------------------------------------------------------------- 42 49 43 # Aircraft type: Boeing 737-60050 ## Aircraft type: Boeing 737-600 44 51 AIRCRAFT_B736 = 1 45 52 46 # Aircraft type: Boeing 737-70053 ## Aircraft type: Boeing 737-700 47 54 AIRCRAFT_B737 = 2 48 55 49 # Aircraft type: Boeing 737-80056 ## Aircraft type: Boeing 737-800 50 57 AIRCRAFT_B738 = 3 51 58 52 # Aircraft type: Boeing 737-800 (charter configuration)59 ## Aircraft type: Boeing 737-800 (charter configuration) 53 60 AIRCRAFT_B738C = 16 54 61 55 # Aircraft type: Boeing 737-30062 ## Aircraft type: Boeing 737-300 56 63 AIRCRAFT_B733 = 4 57 64 58 # Aircraft type: Boeing 737-40065 ## Aircraft type: Boeing 737-400 59 66 AIRCRAFT_B734 = 5 60 67 61 # Aircraft type: Boeing 737-50068 ## Aircraft type: Boeing 737-500 62 69 AIRCRAFT_B735 = 6 63 70 64 # Aircraft type: Dash-8 Q40071 ## Aircraft type: Dash-8 Q400 65 72 AIRCRAFT_DH8D = 7 66 73 67 # Aircraft type: Boeing 767-20074 ## Aircraft type: Boeing 767-200 68 75 AIRCRAFT_B762 = 8 69 76 70 # Aircraft type: Boeing 767-30077 ## Aircraft type: Boeing 767-300 71 78 AIRCRAFT_B763 = 9 72 79 73 # Aircraft type: Canadair CRJ-20080 ## Aircraft type: Canadair CRJ-200 74 81 AIRCRAFT_CRJ2 = 10 75 82 76 # Aircraft type: Fokker F-7083 ## Aircraft type: Fokker F-70 77 84 AIRCRAFT_F70 = 11 78 85 79 # Aircraft type: Lisunov Li-286 ## Aircraft type: Lisunov Li-2 80 87 AIRCRAFT_DC3 = 12 81 88 82 # Aircraft type: Tupolev Tu-13489 ## Aircraft type: Tupolev Tu-134 83 90 AIRCRAFT_T134 = 13 84 91 85 # Aircraft type: Tupolev Tu-15492 ## Aircraft type: Tupolev Tu-154 86 93 AIRCRAFT_T154 = 14 87 94 88 # Aircraft type: Yakovlev Yak-4095 ## Aircraft type: Yakovlev Yak-40 89 96 AIRCRAFT_YK40 = 15 90 97 91 98 #------------------------------------------------------------------------------- 92 99 93 # The list of aircraft types that we know of100 ## The list of aircraft types that we know of 94 101 # The order is mostly from most recent to oldest considering 95 102 # Malev's history … … 105 112 #------------------------------------------------------------------------------- 106 113 107 # A mapping of aircraft types to their 'internal' ICAO codes (which are114 ## A mapping of aircraft types to their 'internal' ICAO codes (which are 108 115 # the same as the real ICAO codes, except in a few cases) 109 116 icaoCodes = { AIRCRAFT_B736 : "B736", … … 126 133 #------------------------------------------------------------------------------- 127 134 128 # Flight stage: boarding135 ## Flight stage: boarding 129 136 STAGE_BOARDING = 1 130 137 131 # Flight stage: pushback, startup and taxi138 ## Flight stage: pushback, startup and taxi 132 139 STAGE_PUSHANDTAXI = 2 133 140 134 # Flight stage: takeoff141 ## Flight stage: takeoff 135 142 STAGE_TAKEOFF = 3 136 143 137 # Flight stage: RTO144 ## Flight stage: RTO 138 145 STAGE_RTO = 4 139 146 140 # Flight stage: climb147 ## Flight stage: climb 141 148 STAGE_CLIMB = 5 142 149 143 # Flight stage: cruise150 ## Flight stage: cruise 144 151 STAGE_CRUISE = 6 145 152 146 # Flight stage: descent153 ## Flight stage: descent 147 154 STAGE_DESCENT = 7 148 155 149 # Flight stage: landing156 ## Flight stage: landing 150 157 STAGE_LANDING = 8 151 158 152 # Flight stage: taxi after landing159 ## Flight stage: taxi after landing 153 160 STAGE_TAXIAFTERLAND = 9 154 161 155 # Flight stage: parking162 ## Flight stage: parking 156 163 STAGE_PARKING = 10 157 164 158 # Flight stage: go-around165 ## Flight stage: go-around 159 166 STAGE_GOAROUND = 11 160 167 161 # Flight stage: end168 ## Flight stage: end 162 169 STAGE_END = 12 163 170 … … 183 190 #------------------------------------------------------------------------------- 184 191 185 # Plane status: unknown192 ## Plane status: unknown 186 193 PLANE_UNKNOWN = 0 187 194 188 # Plane status: at home, i.e. LHBP195 ## Plane status: at home, i.e. LHBP 189 196 PLANE_HOME = 1 190 197 191 # Plane status: away198 ## Plane status: away 192 199 PLANE_AWAY = 2 193 200 194 # Plane status: parking201 ## Plane status: parking 195 202 PLANE_PARKING = 3 196 203 197 204 #------------------------------------------------------------------------------- 198 205 199 # Flight type: scheduled206 ## Flight type: scheduled 200 207 FLIGHTTYPE_SCHEDULED = 0 201 208 202 # Flight type: old-timer209 ## Flight type: old-timer 203 210 FLIGHTTYPE_OLDTIMER = 1 204 211 205 # Flight type: VIP212 ## Flight type: VIP 206 213 FLIGHTTYPE_VIP = 2 207 214 208 # Flight type: charter215 ## Flight type: charter 209 216 FLIGHTTYPE_CHARTER = 3 210 217 … … 230 237 #------------------------------------------------------------------------------- 231 238 232 # Delay code: loading problems239 ## Delay code: loading problems 233 240 DELAYCODE_LOADING = 0 234 241 235 # Delay code: VATSIM problem242 ## Delay code: VATSIM problem 236 243 DELAYCODE_VATSIM = 1 237 244 238 # Delay code: network problems245 ## Delay code: network problems 239 246 DELAYCODE_NETWORK = 2 240 247 241 # Delay code: controller's fault248 ## Delay code: controller's fault 242 249 DELAYCODE_CONTROLLER = 3 243 250 244 # Delay code: system crash or freeze251 ## Delay code: system crash or freeze 245 252 DELAYCODE_SYSTEM = 4 246 253 247 # Delay code: navigation problem254 ## Delay code: navigation problem 248 255 DELAYCODE_NAVIGATION = 5 249 256 250 # Delay code: traffic problems257 ## Delay code: traffic problems 251 258 DELAYCODE_TRAFFIC = 6 252 259 253 # Delay code: apron navigation260 ## Delay code: apron navigation 254 261 DELAYCODE_APRON = 7 255 262 256 # Delay code: weather problems263 ## Delay code: weather problems 257 264 DELAYCODE_WEATHER = 8 258 265 259 # Delay code: personal reasons266 ## Delay code: personal reasons 260 267 DELAYCODE_PERSONAL = 9 261 268 262 269 #------------------------------------------------------------------------------- 263 270 264 # Message type: logger error271 ## Message type: logger error 265 272 # FIXME: cannot set the hotkey 266 273 MESSAGETYPE_LOGGER_ERROR = 1 267 274 268 # Message type: information275 ## Message type: information 269 276 MESSAGETYPE_INFORMATION = 2 270 277 271 # Message type: fault messages278 ## Message type: fault messages 272 279 MESSAGETYPE_FAULT = 3 273 280 274 # Message type: NO-GO fault messages281 ## Message type: NO-GO fault messages 275 282 MESSAGETYPE_NOGO = 4 276 283 277 # Message type: gate system messages284 ## Message type: gate system messages 278 285 MESSAGETYPE_GATE_SYSTEM = 5 279 286 280 # Message type: environment messages287 ## Message type: environment messages 281 288 # FIXME: flight plan closed (5 sec) 282 289 MESSAGETYPE_ENVIRONMENT = 6 283 290 284 # Message type: help messages291 ## Message type: help messages 285 292 MESSAGETYPE_HELP = 7 286 293 287 # Message type: visibility messages294 ## Message type: visibility messages 288 295 MESSAGETYPE_VISIBILITY = 8 289 296 … … 317 324 #------------------------------------------------------------------------------- 318 325 319 # Message display level: none326 ## Message display level: none 320 327 MESSAGELEVEL_NONE = 0 321 328 322 # Message display level: only message in the simulator329 ## Message display level: only message in the simulator 323 330 MESSAGELEVEL_FS = 1 324 331 325 # Message display level: only sound332 ## Message display level: only sound 326 333 MESSAGELEVEL_SOUND = 2 327 334 328 # Message display level: both335 ## Message display level: both 329 336 MESSAGELEVEL_BOTH = 3 330 337 … … 357 364 #------------------------------------------------------------------------------- 358 365 359 # Sound: ding366 ## Sound: ding 360 367 SOUND_DING = "ding.wav" 361 368 362 # Sound: notify369 ## Sound: notify 363 370 SOUND_NOTIFY = "notify.wav" 364 371 365 # Sound: NOTAM372 ## Sound: NOTAM 366 373 SOUND_NOTAM = "notam.mp3" 367 374 368 # Sound: scream375 ## Sound: scream 369 376 SOUND_SCREAM = "sikoly.mp3" 370 377 371 # Sound: boarding378 ## Sound: boarding 372 379 SOUND_BOARDING = "board.mp3" 373 380 374 # Sound: Malev theme381 ## Sound: Malev theme 375 382 SOUND_MALEV = "malev.mp3" 376 383 377 # Sound: taxi: Boeing 737 NG384 ## Sound: taxi: Boeing 737 NG 378 385 SOUND_TAXI_BOEING737NG = "737taxi.mp3" 379 386 380 # Sound: taxi: Boeing 767387 ## Sound: taxi: Boeing 767 381 388 SOUND_TAXI_BOEING767 = "767taxi.mp3" 382 389 383 # Sound: taxi: Fokker F70390 ## Sound: taxi: Fokker F70 384 391 SOUND_TAXI_F70 = "F70taxi.mp3" 385 392 386 # Sound: takeoff preparation request from the captain393 ## Sound: takeoff preparation request from the captain 387 394 SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3" 388 395 389 # Sound: cruise396 ## Sound: cruise 390 397 SOUND_CRUISE = "TOC.mp3" 391 398 392 # Sound: descent399 ## Sound: descent 393 400 SOUND_DESCENT = "TOD.mp3" 394 401 395 # Sound: applause402 ## Sound: applause 396 403 SOUND_APPLAUSE = "taps.mp3" 397 404 398 # Sound: speedbrake405 ## Sound: speedbrake 399 406 SOUND_SPEEDBRAKE = "speed.mp3" 400 407 401 # Sound: taxi after landing408 ## Sound: taxi after landing 402 409 SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3" 403 410 … … 405 412 #------------------------------------------------------------------------------- 406 413 407 # Fuel tank: centre414 ## Fuel tank: centre 408 415 FUELTANK_CENTRE = 1 409 416 410 # Fuel tank: left417 ## Fuel tank: left 411 418 FUELTANK_LEFT = 2 412 419 413 # Fuel tank: right420 ## Fuel tank: right 414 421 FUELTANK_RIGHT = 3 415 422 416 # Fuel tank: left aux423 ## Fuel tank: left aux 417 424 FUELTANK_LEFT_AUX = 4 418 425 419 # Fuel tank: right aux426 ## Fuel tank: right aux 420 427 FUELTANK_RIGHT_AUX = 5 421 428 422 # Fuel tank: left tip429 ## Fuel tank: left tip 423 430 FUELTANK_LEFT_TIP = 6 424 431 425 # Fuel tank: right tip432 ## Fuel tank: right tip 426 433 FUELTANK_RIGHT_TIP = 7 427 434 428 # Fuel tank: external 1435 ## Fuel tank: external 1 429 436 FUELTANK_EXTERNAL1 = 8 430 437 431 # Fuel tank: external 2438 ## Fuel tank: external 2 432 439 FUELTANK_EXTERNAL2 = 9 433 440 434 # Fuel tank: centre2441 ## Fuel tank: centre2 435 442 FUELTANK_CENTRE2 = 10 436 443 … … 486 493 #------------------------------------------------------------------------------- 487 494 488 # The available gates at LHBP495 ## The available gates at LHBP 489 496 lhbpGateNumbers = [] 490 497 -
src/mlx/flight.py
r274 r298 1 # Module related to the high-level tracking of the flight2 3 #---------------------------------------------------------------------------------------4 1 5 2 from soundsched import SoundScheduler, ChecklistScheduler … … 9 6 10 7 import threading 8 9 #--------------------------------------------------------------------------------------- 10 11 ## @package mlx.flight 12 # 13 # The global flight state. 14 # 15 # This module defines a single class, \ref Flight, which represents the flight 16 # in progress. 11 17 12 18 #--------------------------------------------------------------------------------------- -
src/mlx/fs.py
r295 r298 1 2 import const 3 from sound import startSound 4 5 import fsuipc 6 import threading 7 import time 8 9 #------------------------------------------------------------------------------- 10 1 11 ## @package mlx.fs 2 12 # … … 11 21 # simulated aircraft. Instances of class \ref AircraftState are used for this 12 22 # purpose. 13 14 #------------------------------------------------------------------------------- 15 16 import const 17 from sound import startSound 18 19 import fsuipc 20 import threading 21 import time 23 # 24 # This module also contains some definitions for message sending and implements 25 # the timing logic itself. 22 26 23 27 #------------------------------------------------------------------------------- -
src/mlx/fsuipc.py
r290 r298 1 # Module handling the connection to FSUIPC2 3 #------------------------------------------------------------------------------4 1 5 2 import fs … … 22 19 #------------------------------------------------------------------------------ 23 20 24 # The mapping of tank types to FSUIPC offsets 21 ## @package mlx.fsuipc 22 # 23 # The module towards FSUIPC. 24 # 25 # This module implements the simulator interface to FSUIPC. 26 # 27 # The \ref Handler class is thread handling the FSUIPC requests. It can be 28 # given read, periodic read and write, requests, that are executed 29 # asynchronously, and a callback function is called with the result. This class 30 # is used internally within the module. 31 # 32 # The \ref Simulator class is the actual interface to the flight simulator, and 33 # an instance of it is returned by \ref mlx.fs.createSimulator. This object can 34 # be used to connect to the simulator and disconnect from it, to query various 35 # data and to start and stop the monitoring of the data. 36 # 37 # \ref AircraftModel is the base class of the aircraft models. A "model" is a 38 # particular implementation of an aircraft, such as the PMDG Boeing 737NG in 39 # Flight Simulator 2004. Since each type and each model has its peculiarities 40 # (e.g. the different engine and fuel tank configurations), each aircraft type 41 # has a generic model, that should work for most of the time. However, certain 42 # models may implement various controls, gauges, etc. differently, and such 43 # peculiarites can be handled in a specific subclass of \ref 44 # AircraftModel. These subclasses should be registered as special ones, and if 45 # the simulator detects that the aircraft's model became known or has changed, 46 # it will check these special models before resorting to the generic ones. 47 # 48 # The models are responsible also for querying certain parameters, such as the 49 # fuel tank configuration. While ideally it should be specific to a type only, 50 # it is possible that the model contains different tanks, in which case some 51 # tricks may be needed. See the \ref DC3Model "DC-3 (Li-2)" aircraft as an 52 # example. 53 54 #------------------------------------------------------------------------------ 55 56 ## The mapping of tank types to FSUIPC offsets 25 57 _tank2offset = { const.FUELTANK_CENTRE : 0x0b74, 26 58 const.FUELTANK_LEFT : 0x0b7c, -
src/mlx/i18n.py
r276 r298 1 # Internationalization support2 1 # -*- coding: utf-8 -*- 3 4 #------------------------------------------------------------------------------5 2 6 3 import gettext 7 4 import os 8 5 import traceback 6 7 #------------------------------------------------------------------------------ 8 9 ## @package mlx.i18n 10 # 11 # Internationalization support. 12 # 13 # This module handles the internationalization support in the logger. It is 14 # based on the GNU gettext library, and exports the \ref xstr function that 15 # returns the translation for a certain key. 9 16 10 17 #------------------------------------------------------------------------------ -
src/mlx/logger.py
r225 r298 1 # Module for the logging.2 3 #--------------------------------------------------------------------------------------4 1 5 2 from fs import sendMessage … … 9 6 import sys 10 7 import time 8 9 #-------------------------------------------------------------------------------------- 10 11 ## @package mlx.logger 12 # 13 # The module for the logger. 14 # 15 # While the program itself is "logger", it contains an internal logger, which 16 # maintains the textual log containing information on the various events and is 17 # the reason why the program is called "logger". 18 # 19 # The log is made up of lines containing an optional timestamp and the text of 20 # the message. A line can be updated after having been put into the log by 21 # referring to its index. 22 # 23 # The logger object also maintains a separate set of faults and ensures that 24 # one fault type has only one score, even if that fault has been reported 25 # multiple times. 11 26 12 27 #-------------------------------------------------------------------------------------- -
src/mlx/mlx.py
r276 r298 1 # The main program2 1 3 2 from config import Config … … 7 6 import os 8 7 import sys 8 9 #-------------------------------------------------------------------------------------- 10 11 ## @package mlx.mlx 12 # 13 # The main program. 14 # 15 # This module contains the main program of the logger as well as the \ref 16 # restart "restart" handling. 9 17 10 18 #-------------------------------------------------------------------------------------- -
src/mlx/pirep.py
r262 r298 1 # The PIREP class collecting all information needed for a PIREP 1 2 import const 3 import cPickle as pickle 2 4 3 5 #------------------------------------------------------------------------------ 4 6 5 import const 6 import cPickle as pickle 7 ## @package mlx.pirep 8 # 9 # The PIREP module. 10 # 11 # This module defines only one class, \ref PIREP. It is used to extract and 12 # store the information needed for a PIREP. The saved PIREPs are pickled 13 # instances of this class. 7 14 8 15 #------------------------------------------------------------------------------ -
src/mlx/pyuipc_emu.py
r27 r298 1 # Emulator for the pyuipc module2 #------------------------------------------------------------------------------3 1 4 2 import time … … 6 4 #------------------------------------------------------------------------------ 7 5 8 # The ratio between kg and lbs 6 ## @package mlx.pyuipc_emu 7 # 8 # A very simple PyUIPC emulator. 9 # 10 # This is not used currently. 11 12 #------------------------------------------------------------------------------ 13 14 ## The ratio between kg and lbs 9 15 KGTOLBS=1/0.4536 10 16 11 # Feet to metres17 ## Feet to metres 12 18 FEETTOMETRES=0.3048 13 19 … … 36 42 #------------------------------------------------------------------------------ 37 43 38 # Version constants44 ## Version constants 39 45 SIM_ANY=0 40 46 SIM_FS98=1 … … 48 54 #------------------------------------------------------------------------------ 49 55 50 # Error constants56 ## Error constants 51 57 ERR_OK=0 52 58 ERR_OPEN=1 … … 68 74 #------------------------------------------------------------------------------ 69 75 70 # The version of FSUIPC76 ## The version of FSUIPC 71 77 fsuipc_version=0x0401 72 78 lib_version=0x0302 -
src/mlx/pyuipc_sim.py
r273 r298 1 # Simulator for the pyuipc module2 #------------------------------------------------------------------------------3 1 4 2 import const … … 16 14 #------------------------------------------------------------------------------ 17 15 18 # Version constants 16 ## @package mlx.pyuipc_sim 17 # 18 # Simulator of the PyUIPC module. 19 # 20 # This is a simulation of the PyUIPC module emulating offsets that are needed 21 # by the logger. 22 # 23 # This module can also be run as a program, in which case it connects to an 24 # already running logger (that uses this module in place of the real pyuipc), 25 # and various commands can be given to query or modify the values of the 26 # offsets. There is a 'help' command and completion also works. 27 # 28 # This module is used instead of the real PyUIPC module, if the program is not 29 # running on Windows or the FORCE_PYUIPC_SIM environment variable is present. 30 31 #------------------------------------------------------------------------------ 32 #------------------------------------------------------------------------------ 33 34 ## Version constants 19 35 SIM_ANY=0 20 36 SIM_FS98=1 … … 29 45 #------------------------------------------------------------------------------ 30 46 31 # Error constants47 ## Error constants 32 48 ERR_OK=0 33 49 ERR_OPEN=1 … … 49 65 #------------------------------------------------------------------------------ 50 66 51 # The version of FSUIPC67 ## The version of FSUIPC 52 68 fsuipc_version=0x0401 53 69 lib_version=0x0302 … … 100 116 class Values(object): 101 117 """The values that can be read from 'FSUIPC'.""" 102 # Fuel data index: centre tank118 ## Fuel data index: centre tank 103 119 FUEL_CENTRE = 0 104 120 105 # Fuel data index: left main tank121 ## Fuel data index: left main tank 106 122 FUEL_LEFT = 1 107 123 108 # Fuel data index: right main tank124 ## Fuel data index: right main tank 109 125 FUEL_RIGHT = 2 110 126 111 # Fuel data index: left aux tank127 ## Fuel data index: left aux tank 112 128 FUEL_LEFT_AUX = 3 113 129 114 # Fuel data index: right aux tank130 ## Fuel data index: right aux tank 115 131 FUEL_RIGHT_AUX = 4 116 132 117 # Fuel data index: left tip tank133 ## Fuel data index: left tip tank 118 134 FUEL_LEFT_TIP = 5 119 135 120 # Fuel data index: right tip tank136 ## Fuel data index: right tip tank 121 137 FUEL_RIGHT_TIP = 6 122 138 123 # Fuel data index: external 1 tank139 ## Fuel data index: external 1 tank 124 140 FUEL_EXTERNAL_1 = 7 125 141 126 # Fuel data index: external 2 tank142 ## Fuel data index: external 2 tank 127 143 FUEL_EXTERNAL_2 = 8 128 144 129 # Fuel data index: centre 2 tank145 ## Fuel data index: centre 2 tank 130 146 FUEL_CENTRE_2 = 9 131 147 132 # The number of fuel tank entries148 ## The number of fuel tank entries 133 149 NUM_FUEL = FUEL_CENTRE_2 + 1 134 150 135 # Engine index: engine #1151 ## Engine index: engine #1 136 152 ENGINE_1 = 0 137 153 138 # Engine index: engine #2154 ## Engine index: engine #2 139 155 ENGINE_2 = 1 140 156 141 # Engine index: engine #3157 ## Engine index: engine #3 142 158 ENGINE_3 = 2 143 159 144 # The number of hotkey entries160 ## The number of hotkey entries 145 161 HOTKEY_SIZE = 56 146 162 -
src/mlx/singleton.py
r247 r298 1 # Module to allow for a single instance of an application to run2 1 3 2 import os 4 3 import time 4 5 #---------------------------------------------------------------------------- 6 7 ## @package mlx.singleton 8 # 9 # Allow a single instance of an application to run. 10 # 11 # This module implements the logic needed to detect that an instance of the 12 # application is already running, and if so, notifying that instance. 13 # 14 # On Windows, a mutex is used to ensure that only a single instance is running, 15 # since a mutex with a certain name can be created by one process only. If the 16 # current process is the only instance, a named pipe is created and a thread is 17 # started to listen for messages. Otherwise a message is sent to that pipe, 18 # which results in calling a callback function. 19 # 20 # On Linux a Unix socket is created protected by a lock file, and the messages 21 # from other instances are received via this socket. 22 # 23 # The main window is raised if another instance is started. 5 24 6 25 #---------------------------------------------------------------------------- -
src/mlx/sound.py
r180 r298 1 # Module to handle sound playback2 3 #------------------------------------------------------------------------------4 1 5 2 import os 6 3 import traceback 4 5 #------------------------------------------------------------------------------ 6 7 ## @package mlx.sound 8 # 9 # Sound playback handling. 10 # 11 # This is the low level sound playback handling. The \ref initializeSound 12 # function should be called to initialize the sound handling with the directory 13 # containing the sound files. Then the \startSound function should be called to 14 # start the playback of a certain sound file. A callback may be called when the 15 # playback of a certain file has finished. 16 # 17 # See also the \ref mlx.soundsched module. 7 18 8 19 #------------------------------------------------------------------------------ -
src/mlx/soundsched.py
r229 r298 1 # Module to schedule the sounds to be played2 3 #------------------------------------------------------------------------------4 1 5 2 from sound import startSound … … 8 5 9 6 import threading 7 8 #------------------------------------------------------------------------------ 9 10 ## @package mlx.soundsched 11 # 12 # Sound playback scheduling. 13 # 14 # The logger may play certain sound files when certain conditions hold. For 15 # example, if the landing or the strobe lights are switched on during taxi, and 16 # we go to the takeoff state, a voice says "Cabin crew, please take your seats 17 # for takeoff". Some sounds are played only when the pilot presses a hotkey, if 18 # the program is set up that way. 19 # 20 # Each sound is represented by an instance of a subclass of \ref Sound. If a 21 # new \ref mlx.fs.AircraftState "aircraft state" comes in from the simulator, 22 # the \ref Sound.shouldPlay "shouldPlay" functions of the registered sound 23 # objects are called with that state, and if the function returns \c True, the 24 # corresponding sound file is played. 25 # 26 # The \ref ChecklistScheduler class handles the playback of the checklists, 27 # which are basically sequences of sound files played back one-by-one when a 28 # certain hotkey is pressed. 10 29 11 30 #------------------------------------------------------------------------------ -
src/mlx/update.py
r189 r298 1 # Module handling the download of updates2 3 #------------------------------------------------------------------------------4 1 5 2 from config import Config … … 15 12 if os.name=="nt": 16 13 import win32api 14 15 #------------------------------------------------------------------------------ 16 17 ## @package mlx.update 18 # 19 # Automatic update handling. 20 # 21 # The program can update itself automatically. For this purpose it maintains a 22 # manifest of the files installed containing the relative paths, sizes and 23 # checksums of each files. When the program starts up, this manifest file is 24 # downloaded from the update server and is compared to the local one. Then the 25 # updated and new files are downloaded with names that are created by appending 26 # the checksum to the actual name, so as not to overwrite any existing files at 27 # this stage. If all files are downloaded, the downloaded files are renamed to 28 # their real names. On Windows, the old file is removed first to avoid trouble 29 # with 'busy' files. If removing a file fails, the file will be moved to a 30 # temporary directory, that will be removed when the program starts the next 31 # time. 17 32 18 33 #------------------------------------------------------------------------------ -
src/mlx/util.py
r134 r298 1 # Various utilities2 1 3 2 import math … … 6 5 #------------------------------------------------------------------------------ 7 6 8 # The average of the radius at the poles and a the equator, in metres 7 ## @package mlx.util 8 # 9 # Utilities. 10 11 #------------------------------------------------------------------------------ 12 13 ## The average of the radius at the poles and a the equator, in metres 9 14 #EARTH_RADIUS=6367467.4 10 15 EARTH_RADIUS=6371000 -
src/mlx/web.py
r214 r298 1 # Interface towards the websites used2 3 #------------------------------------------------------------------------------4 1 5 2 import const … … 16 13 import traceback 17 14 import xml.sax 15 16 #--------------------------------------------------------------------------------------- 17 18 ## @package mlx.web 19 # 20 # Web interface. 21 # 22 # This module implements a thread that can perform (HTTP) requests 23 # asynchronously. When the request is performed, a callback is called. The main 24 # interface is the \ref Handler class. Each of its functions creates a \ref 25 # Request subclass instance and puts it to the request queue. The handler 26 # thread then takes the requests one by one, and executes them. 27 # 28 # This module also defines some data classes the contents of which are 29 # retrieved or sent via HTTP. \ref BookedFlight contains data of a flight 30 # booked on the MAVA website, \ref Fleet and \ref Plane represents the MAVA 31 # fleet and the gates at Ferihegy and \ref NOTAM is a NOTAM. 18 32 19 33 #---------------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.