Changeset 298:24c67ec5cdca


Ignore:
Timestamp:
07/21/12 12:43:34 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Documented the non-GUI modules

Location:
src/mlx
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acars.py

    r139 r298  
    1 # Module for ACARS handling
     1
     2import const
    23
    34#------------------------------------------------------------------------------
    45
    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.
    612
    713#------------------------------------------------------------------------------
  • src/mlx/acft.py

    r297 r298  
     1
     2import const
     3import checks
     4import fs
     5import util
     6
     7import sys
     8import time
     9import traceback
     10
     11from collections import deque
     12
     13#---------------------------------------------------------------------------------------
     14
    115## @package mlx.acft
    216#
     
    1428# values in the \ref mlx.fs.AircraftState "aircraft state" when it is received
    1529# from the simulator.
    16 
    17 #---------------------------------------------------------------------------------------
    18 
    19 import const
    20 import checks
    21 import fs
    22 import util
    23 
    24 import sys
    25 import time
    26 import traceback
    27 
    28 from collections import deque
    2930
    3031#---------------------------------------------------------------------------------------
  • src/mlx/airports.py

    r261 r298  
    1 # The mapping of ICAO codes to airport names
    21# -*- coding: utf-8 -*-
     2
     3import sys
    34
    45#-----------------------------------------------------------------------------
    56
     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
    618airportNames = {
    719    "VTBS" : ("Bangkok", "Suvarnabhumi"),
  • src/mlx/checks.py

    r297 r298  
     1
     2import fs
     3import const
     4import util
     5from acars import ACARS
     6from sound import startSound
     7
     8import time
     9
     10#---------------------------------------------------------------------------------------
     11
    112## @package mlx.checks
    213#
     
    1324# transitions from one stage of the flight to the next one. Or \ref ACARSSender
    1425# which sends the ACARS periodically
    15 
    16 #---------------------------------------------------------------------------------------
    17 
    18 import fs
    19 import const
    20 import util
    21 from acars import ACARS
    22 from sound import startSound
    23 
    24 import time
    2526
    2627#---------------------------------------------------------------------------------------
  • src/mlx/config.py

    r273 r298  
    1 # Configuration and related stuff
    21# -*- encoding: utf-8 -*-
    3 
    4 #-------------------------------------------------------------------------------
    52
    63import const
     
    96import sys
    107import 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.
    1120
    1221#-------------------------------------------------------------------------------
  • src/mlx/const.py

    r274 r298  
    1 # Various constants used in the logger
    2 
    3 #-------------------------------------------------------------------------------
    4 
    5 # The version of the program
     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
    613VERSION="0.6"
    714
    815#-------------------------------------------------------------------------------
    916
    10 # The ratio between lbs and kg
     17## The ratio between lbs and kg
    1118LBSTOKG=0.4536
    1219
    13 # The ratio between kgs and lbs
     20## The ratio between kgs and lbs
    1421KGSTOLB=1/LBSTOKG
    1522
    16 # The ratio between feet and metre
     23## The ratio between feet and metre
    1724FEETTOMETRES=0.3048
    1825
    1926#-------------------------------------------------------------------------------
    2027
    21 # The ratio between knots and km/h
     28## The ratio between knots and km/h
    2229KNOTSTOKMPH=1.852
    2330
    24 # The ratio between km/h and knots
     31## The ratio between km/h and knots
    2532KMPHTOKNOTS=1/1.852
    2633
    2734#-------------------------------------------------------------------------------
    2835
    29 # Flight simulator type: MS Flight Simulator 2004
     36## Flight simulator type: MS Flight Simulator 2004
    3037SIM_MSFS9 = 1
    3138
    32 # Flight simulator type: MS Flight Simulator X
     39## Flight simulator type: MS Flight Simulator X
    3340SIM_MSFSX = 2
    3441
    35 # Flight simulator type: X-Plane 9
     42## Flight simulator type: X-Plane 9
    3643SIM_XPLANE9 = 3
    3744
    38 # Flight simulator type: X-Plane 10
     45## Flight simulator type: X-Plane 10
    3946SIM_XPLANE10 = 4
    4047
    4148#-------------------------------------------------------------------------------
    4249
    43 # Aircraft type: Boeing 737-600
     50## Aircraft type: Boeing 737-600
    4451AIRCRAFT_B736 = 1
    4552
    46 # Aircraft type: Boeing 737-700
     53## Aircraft type: Boeing 737-700
    4754AIRCRAFT_B737 = 2
    4855
    49 # Aircraft type: Boeing 737-800
     56## Aircraft type: Boeing 737-800
    5057AIRCRAFT_B738 = 3
    5158
    52 # Aircraft type: Boeing 737-800 (charter configuration)
     59## Aircraft type: Boeing 737-800 (charter configuration)
    5360AIRCRAFT_B738C = 16
    5461
    55 # Aircraft type: Boeing 737-300
     62## Aircraft type: Boeing 737-300
    5663AIRCRAFT_B733 = 4
    5764
    58 # Aircraft type: Boeing 737-400
     65## Aircraft type: Boeing 737-400
    5966AIRCRAFT_B734 = 5
    6067
    61 # Aircraft type: Boeing 737-500
     68## Aircraft type: Boeing 737-500
    6269AIRCRAFT_B735 = 6
    6370
    64 # Aircraft type: Dash-8 Q400
     71## Aircraft type: Dash-8 Q400
    6572AIRCRAFT_DH8D = 7
    6673
    67 # Aircraft type: Boeing 767-200
     74## Aircraft type: Boeing 767-200
    6875AIRCRAFT_B762 = 8
    6976
    70 # Aircraft type: Boeing 767-300
     77## Aircraft type: Boeing 767-300
    7178AIRCRAFT_B763 = 9
    7279
    73 # Aircraft type: Canadair CRJ-200
     80## Aircraft type: Canadair CRJ-200
    7481AIRCRAFT_CRJ2 = 10
    7582
    76 # Aircraft type: Fokker F-70
     83## Aircraft type: Fokker F-70
    7784AIRCRAFT_F70 = 11
    7885
    79 # Aircraft type: Lisunov Li-2
     86## Aircraft type: Lisunov Li-2
    8087AIRCRAFT_DC3 = 12
    8188
    82 # Aircraft type: Tupolev Tu-134
     89## Aircraft type: Tupolev Tu-134
    8390AIRCRAFT_T134 = 13
    8491
    85 # Aircraft type: Tupolev Tu-154
     92## Aircraft type: Tupolev Tu-154
    8693AIRCRAFT_T154 = 14
    8794
    88 # Aircraft type: Yakovlev Yak-40
     95## Aircraft type: Yakovlev Yak-40
    8996AIRCRAFT_YK40 = 15
    9097
    9198#-------------------------------------------------------------------------------
    9299
    93 # The list of aircraft types that we know of
     100## The list of aircraft types that we know of
    94101# The order is mostly from most recent to oldest considering
    95102# Malev's history
     
    105112#-------------------------------------------------------------------------------
    106113
    107 # A mapping of aircraft types to their 'internal' ICAO codes (which are
     114## A mapping of aircraft types to their 'internal' ICAO codes (which are
    108115# the same as the real ICAO codes, except in a few cases)
    109116icaoCodes = { AIRCRAFT_B736  : "B736",
     
    126133#-------------------------------------------------------------------------------
    127134
    128 # Flight stage: boarding
     135## Flight stage: boarding
    129136STAGE_BOARDING = 1
    130137
    131 # Flight stage: pushback, startup and taxi
     138## Flight stage: pushback, startup and taxi
    132139STAGE_PUSHANDTAXI = 2
    133140
    134 # Flight stage: takeoff
     141## Flight stage: takeoff
    135142STAGE_TAKEOFF = 3
    136143
    137 # Flight stage: RTO
     144## Flight stage: RTO
    138145STAGE_RTO = 4
    139146
    140 # Flight stage: climb
     147## Flight stage: climb
    141148STAGE_CLIMB = 5
    142149
    143 # Flight stage: cruise
     150## Flight stage: cruise
    144151STAGE_CRUISE = 6
    145152
    146 # Flight stage: descent
     153## Flight stage: descent
    147154STAGE_DESCENT = 7
    148155
    149 # Flight stage: landing
     156## Flight stage: landing
    150157STAGE_LANDING = 8
    151158
    152 # Flight stage: taxi after landing
     159## Flight stage: taxi after landing
    153160STAGE_TAXIAFTERLAND = 9
    154161
    155 # Flight stage: parking
     162## Flight stage: parking
    156163STAGE_PARKING = 10
    157164
    158 # Flight stage: go-around
     165## Flight stage: go-around
    159166STAGE_GOAROUND = 11
    160167
    161 # Flight stage: end
     168## Flight stage: end
    162169STAGE_END = 12
    163170
     
    183190#-------------------------------------------------------------------------------
    184191
    185 # Plane status: unknown
     192## Plane status: unknown
    186193PLANE_UNKNOWN = 0
    187194
    188 # Plane status: at home, i.e. LHBP
     195## Plane status: at home, i.e. LHBP
    189196PLANE_HOME = 1
    190197
    191 # Plane status: away
     198## Plane status: away
    192199PLANE_AWAY = 2
    193200
    194 # Plane status: parking
     201## Plane status: parking
    195202PLANE_PARKING = 3
    196203
    197204#-------------------------------------------------------------------------------
    198205
    199 # Flight type: scheduled
     206## Flight type: scheduled
    200207FLIGHTTYPE_SCHEDULED = 0
    201208
    202 # Flight type: old-timer
     209## Flight type: old-timer
    203210FLIGHTTYPE_OLDTIMER = 1
    204211
    205 # Flight type: VIP
     212## Flight type: VIP
    206213FLIGHTTYPE_VIP = 2
    207214
    208 # Flight type: charter
     215## Flight type: charter
    209216FLIGHTTYPE_CHARTER = 3
    210217
     
    230237#-------------------------------------------------------------------------------
    231238
    232 # Delay code: loading problems
     239## Delay code: loading problems
    233240DELAYCODE_LOADING = 0
    234241
    235 # Delay code: VATSIM problem
     242## Delay code: VATSIM problem
    236243DELAYCODE_VATSIM = 1
    237244
    238 # Delay code: network problems
     245## Delay code: network problems
    239246DELAYCODE_NETWORK = 2
    240247
    241 # Delay code: controller's fault
     248## Delay code: controller's fault
    242249DELAYCODE_CONTROLLER = 3
    243250
    244 # Delay code: system crash or freeze
     251## Delay code: system crash or freeze
    245252DELAYCODE_SYSTEM = 4
    246253
    247 # Delay code: navigation problem
     254## Delay code: navigation problem
    248255DELAYCODE_NAVIGATION = 5
    249256
    250 # Delay code: traffic problems
     257## Delay code: traffic problems
    251258DELAYCODE_TRAFFIC = 6
    252259
    253 # Delay code: apron navigation
     260## Delay code: apron navigation
    254261DELAYCODE_APRON = 7
    255262
    256 # Delay code: weather problems
     263## Delay code: weather problems
    257264DELAYCODE_WEATHER = 8
    258265
    259 # Delay code: personal reasons
     266## Delay code: personal reasons
    260267DELAYCODE_PERSONAL = 9
    261268
    262269#-------------------------------------------------------------------------------
    263270
    264 # Message type: logger error
     271## Message type: logger error
    265272# FIXME: cannot set the hotkey
    266273MESSAGETYPE_LOGGER_ERROR = 1
    267274
    268 # Message type: information
     275## Message type: information
    269276MESSAGETYPE_INFORMATION = 2
    270277
    271 # Message type: fault messages
     278## Message type: fault messages
    272279MESSAGETYPE_FAULT = 3
    273280
    274 # Message type: NO-GO fault messages
     281## Message type: NO-GO fault messages
    275282MESSAGETYPE_NOGO = 4
    276283
    277 # Message type: gate system messages
     284## Message type: gate system messages
    278285MESSAGETYPE_GATE_SYSTEM = 5
    279286
    280 # Message type: environment messages
     287## Message type: environment messages
    281288# FIXME: flight plan closed (5 sec)
    282289MESSAGETYPE_ENVIRONMENT = 6
    283290
    284 # Message type: help messages
     291## Message type: help messages
    285292MESSAGETYPE_HELP = 7
    286293
    287 # Message type: visibility messages
     294## Message type: visibility messages
    288295MESSAGETYPE_VISIBILITY = 8
    289296
     
    317324#-------------------------------------------------------------------------------
    318325
    319 # Message display level: none
     326## Message display level: none
    320327MESSAGELEVEL_NONE = 0
    321328
    322 # Message display level: only message in the simulator
     329## Message display level: only message in the simulator
    323330MESSAGELEVEL_FS = 1
    324331
    325 # Message display level: only sound
     332## Message display level: only sound
    326333MESSAGELEVEL_SOUND = 2
    327334
    328 # Message display level: both
     335## Message display level: both
    329336MESSAGELEVEL_BOTH = 3
    330337
     
    357364#-------------------------------------------------------------------------------
    358365
    359 # Sound: ding
     366## Sound: ding
    360367SOUND_DING = "ding.wav"
    361368
    362 # Sound: notify
     369## Sound: notify
    363370SOUND_NOTIFY = "notify.wav"
    364371
    365 # Sound: NOTAM
     372## Sound: NOTAM
    366373SOUND_NOTAM = "notam.mp3"
    367374
    368 # Sound: scream
     375## Sound: scream
    369376SOUND_SCREAM = "sikoly.mp3"
    370377
    371 # Sound: boarding
     378## Sound: boarding
    372379SOUND_BOARDING = "board.mp3"
    373380
    374 # Sound: Malev theme
     381## Sound: Malev theme
    375382SOUND_MALEV = "malev.mp3"
    376383
    377 # Sound: taxi: Boeing 737 NG
     384## Sound: taxi: Boeing 737 NG
    378385SOUND_TAXI_BOEING737NG = "737taxi.mp3"
    379386
    380 # Sound: taxi: Boeing 767
     387## Sound: taxi: Boeing 767
    381388SOUND_TAXI_BOEING767 = "767taxi.mp3"
    382389
    383 # Sound: taxi: Fokker F70
     390## Sound: taxi: Fokker F70
    384391SOUND_TAXI_F70 = "F70taxi.mp3"
    385392
    386 # Sound: takeoff preparation request from the captain
     393## Sound: takeoff preparation request from the captain
    387394SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
    388395
    389 # Sound: cruise
     396## Sound: cruise
    390397SOUND_CRUISE = "TOC.mp3"
    391398
    392 # Sound: descent
     399## Sound: descent
    393400SOUND_DESCENT = "TOD.mp3"
    394401
    395 # Sound: applause
     402## Sound: applause
    396403SOUND_APPLAUSE = "taps.mp3"
    397404
    398 # Sound: speedbrake
     405## Sound: speedbrake
    399406SOUND_SPEEDBRAKE = "speed.mp3"
    400407
    401 # Sound: taxi after landing
     408## Sound: taxi after landing
    402409SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
    403410
     
    405412#-------------------------------------------------------------------------------
    406413
    407 # Fuel tank: centre
     414## Fuel tank: centre
    408415FUELTANK_CENTRE = 1
    409416
    410 # Fuel tank: left
     417## Fuel tank: left
    411418FUELTANK_LEFT = 2
    412419
    413 # Fuel tank: right
     420## Fuel tank: right
    414421FUELTANK_RIGHT = 3
    415422
    416 # Fuel tank: left aux
     423## Fuel tank: left aux
    417424FUELTANK_LEFT_AUX = 4
    418425
    419 # Fuel tank: right aux
     426## Fuel tank: right aux
    420427FUELTANK_RIGHT_AUX = 5
    421428
    422 # Fuel tank: left tip
     429## Fuel tank: left tip
    423430FUELTANK_LEFT_TIP = 6
    424431
    425 # Fuel tank: right tip
     432## Fuel tank: right tip
    426433FUELTANK_RIGHT_TIP = 7
    427434
    428 # Fuel tank: external 1
     435## Fuel tank: external 1
    429436FUELTANK_EXTERNAL1 = 8
    430437
    431 # Fuel tank: external 2
     438## Fuel tank: external 2
    432439FUELTANK_EXTERNAL2 = 9
    433440
    434 # Fuel tank: centre2
     441## Fuel tank: centre2
    435442FUELTANK_CENTRE2 = 10
    436443
     
    486493#-------------------------------------------------------------------------------
    487494
    488 # The available gates at LHBP
     495## The available gates at LHBP
    489496lhbpGateNumbers = []
    490497
  • src/mlx/flight.py

    r274 r298  
    1 # Module related to the high-level tracking of the flight
    2 
    3 #---------------------------------------------------------------------------------------
    41
    52from soundsched import SoundScheduler, ChecklistScheduler
     
    96
    107import 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.
    1117
    1218#---------------------------------------------------------------------------------------
  • src/mlx/fs.py

    r295 r298  
     1
     2import const
     3from sound import startSound
     4
     5import fsuipc
     6import threading
     7import time
     8
     9#-------------------------------------------------------------------------------
     10
    111## @package mlx.fs
    212#
     
    1121# simulated aircraft. Instances of class \ref AircraftState are used for this
    1222# 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.
    2226
    2327#-------------------------------------------------------------------------------
  • src/mlx/fsuipc.py

    r290 r298  
    1 # Module handling the connection to FSUIPC
    2 
    3 #------------------------------------------------------------------------------
    41
    52import fs
     
    2219#------------------------------------------------------------------------------
    2320
    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
    2557_tank2offset = { const.FUELTANK_CENTRE : 0x0b74,
    2658                 const.FUELTANK_LEFT : 0x0b7c,
  • src/mlx/i18n.py

    r276 r298  
    1 # Internationalization support
    21# -*- coding: utf-8 -*-
    3 
    4 #------------------------------------------------------------------------------
    52
    63import gettext
    74import os
    85import 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.
    916
    1017#------------------------------------------------------------------------------
  • src/mlx/logger.py

    r225 r298  
    1 # Module for the logging.
    2 
    3 #--------------------------------------------------------------------------------------
    41
    52from fs import sendMessage
     
    96import sys
    107import 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.
    1126
    1227#--------------------------------------------------------------------------------------
  • src/mlx/mlx.py

    r276 r298  
    1 # The main program
    21
    32from config import Config
     
    76import os
    87import 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.
    917
    1018#--------------------------------------------------------------------------------------
  • src/mlx/pirep.py

    r262 r298  
    1 # The PIREP class collecting all information needed for a PIREP
     1
     2import const
     3import cPickle as pickle
    24
    35#------------------------------------------------------------------------------
    46
    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.
    714
    815#------------------------------------------------------------------------------
  • src/mlx/pyuipc_emu.py

    r27 r298  
    1 # Emulator for the pyuipc module
    2 #------------------------------------------------------------------------------
    31
    42import time
     
    64#------------------------------------------------------------------------------
    75
    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
    915KGTOLBS=1/0.4536
    1016
    11 # Feet to metres
     17## Feet to metres
    1218FEETTOMETRES=0.3048
    1319
     
    3642#------------------------------------------------------------------------------
    3743
    38 # Version constants
     44## Version constants
    3945SIM_ANY=0
    4046SIM_FS98=1
     
    4854#------------------------------------------------------------------------------
    4955
    50 # Error constants
     56## Error constants
    5157ERR_OK=0
    5258ERR_OPEN=1
     
    6874#------------------------------------------------------------------------------
    6975
    70 # The version of FSUIPC
     76## The version of FSUIPC
    7177fsuipc_version=0x0401
    7278lib_version=0x0302
  • src/mlx/pyuipc_sim.py

    r273 r298  
    1 # Simulator for the pyuipc module
    2 #------------------------------------------------------------------------------
    31
    42import const
     
    1614#------------------------------------------------------------------------------
    1715
    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
    1935SIM_ANY=0
    2036SIM_FS98=1
     
    2945#------------------------------------------------------------------------------
    3046
    31 # Error constants
     47## Error constants
    3248ERR_OK=0
    3349ERR_OPEN=1
     
    4965#------------------------------------------------------------------------------
    5066
    51 # The version of FSUIPC
     67## The version of FSUIPC
    5268fsuipc_version=0x0401
    5369lib_version=0x0302
     
    100116class Values(object):
    101117    """The values that can be read from 'FSUIPC'."""
    102     # Fuel data index: centre tank
     118    ## Fuel data index: centre tank
    103119    FUEL_CENTRE = 0
    104120
    105     # Fuel data index: left main tank
     121    ## Fuel data index: left main tank
    106122    FUEL_LEFT = 1
    107123
    108     # Fuel data index: right main tank
     124    ## Fuel data index: right main tank
    109125    FUEL_RIGHT = 2
    110126
    111     # Fuel data index: left aux tank
     127    ## Fuel data index: left aux tank
    112128    FUEL_LEFT_AUX = 3
    113129
    114     # Fuel data index: right aux tank
     130    ## Fuel data index: right aux tank
    115131    FUEL_RIGHT_AUX = 4
    116132
    117     # Fuel data index: left tip tank
     133    ## Fuel data index: left tip tank
    118134    FUEL_LEFT_TIP = 5
    119135
    120     # Fuel data index: right tip tank
     136    ## Fuel data index: right tip tank
    121137    FUEL_RIGHT_TIP = 6
    122138
    123     # Fuel data index: external 1 tank
     139    ## Fuel data index: external 1 tank
    124140    FUEL_EXTERNAL_1 = 7
    125141
    126     # Fuel data index: external 2 tank
     142    ## Fuel data index: external 2 tank
    127143    FUEL_EXTERNAL_2 = 8
    128144
    129     # Fuel data index: centre 2 tank
     145    ## Fuel data index: centre 2 tank
    130146    FUEL_CENTRE_2 = 9
    131147
    132     # The number of fuel tank entries
     148    ## The number of fuel tank entries
    133149    NUM_FUEL = FUEL_CENTRE_2 + 1
    134150
    135     # Engine index: engine #1
     151    ## Engine index: engine #1
    136152    ENGINE_1 = 0
    137153
    138     # Engine index: engine #2
     154    ## Engine index: engine #2
    139155    ENGINE_2 = 1
    140156
    141     # Engine index: engine #3
     157    ## Engine index: engine #3
    142158    ENGINE_3 = 2
    143159
    144     # The number of hotkey entries
     160    ## The number of hotkey entries
    145161    HOTKEY_SIZE = 56
    146162
  • src/mlx/singleton.py

    r247 r298  
    1 # Module to allow for a single instance of an application to run
    21
    32import os
    43import 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.
    524
    625#----------------------------------------------------------------------------
  • src/mlx/sound.py

    r180 r298  
    1 # Module to handle sound playback
    2 
    3 #------------------------------------------------------------------------------
    41
    52import os
    63import 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.
    718
    819#------------------------------------------------------------------------------
  • src/mlx/soundsched.py

    r229 r298  
    1 # Module to schedule the sounds to be played
    2 
    3 #------------------------------------------------------------------------------
    41
    52from sound import startSound
     
    85
    96import 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.
    1029
    1130#------------------------------------------------------------------------------
  • src/mlx/update.py

    r189 r298  
    1 # Module handling the download of updates
    2 
    3 #------------------------------------------------------------------------------
    41
    52from config import Config
     
    1512if os.name=="nt":
    1613    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.
    1732
    1833#------------------------------------------------------------------------------
  • src/mlx/util.py

    r134 r298  
    1 # Various utilities
    21
    32import math
     
    65#------------------------------------------------------------------------------
    76
    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
    914#EARTH_RADIUS=6367467.4
    1015EARTH_RADIUS=6371000
  • src/mlx/web.py

    r214 r298  
    1 # Interface towards the websites used
    2 
    3 #------------------------------------------------------------------------------
    41
    52import const
     
    1613import traceback
    1714import 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.
    1832
    1933#---------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.