Ignore:
Files:
2 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • .hgignore

    r442 r276  
    66mlx-common.nsh
    77locale/.+/LC_MESSAGES
    8 locale/.+/mlx_delay.po
    9 src/mlx/gui/dcdata.py
    10 xplra.py
  • .hgtags

    r449 r419  
    88cc775599652d39ab574dac90fe8730ef52842744 version_0.14
    99e11be493e87d09619387e352c389208cca54097d version_0.15
    10 89c9d5d516eb0da04f2cd10db58332f054249bb1 version_0.16
  • Makefile

    r439 r276  
    33all: $(foreach lang,$(LANGUAGES),locale/$(lang)/LC_MESSAGES/mlx.mo)
    44
    5 locale/%/LC_MESSAGES/mlx.mo: locale/%/mlx.po locale/%/mlx_delay.po
     5locale/%/LC_MESSAGES/mlx.mo: locale/%/mlx.po
    66        mkdir -p `dirname $@`
    7         msgcat $^ | msgfmt -o $@ -
    8 
    9 locale/hu/mlx_delay.po locale/en/mlx_delay.po: dcdatagen.py
    10         ./dcdatagen.py
     7        msgfmt -o $@ $^
  • doc/overview.dox

    r444 r302  
    1111 * Note, that to be able to understand the code most effectively, it
    1212 * is important to either use the application actively, or to read its
    13  * user documentation carefully.
     13 * user documentation carefully. 
    1414 *
    1515 * \section overview Overview
    1616 *
    17  * The application was written in
     17 * The application was written in 
    1818 * <a href="http://python.org">Python 2</a>. The Python wrapper
    1919 * <a href="http://gtk.org">Gtk+</a> toolkit was used for the graphical
     
    2323 * as the primary toolkit, while it has no reliable port for Windows
    2424 * yet. Therefore it was decided to support both Gtk+ 2 and 3
    25  * depending on the platform. For Gtk+ 2 the
     25 * depending on the platform. For Gtk+ 2 the 
    2626 * <a href="http://pygtk.org">PyGTK</a> wrapper is used, while for Gtk+
    2727 * 3 the <a href="https://live.gnome.org/PyGObject">PyGObject</a>
     
    3333 * <a href="http://www.schiratti.com/dowson.html">FSUIPC</a>
    3434 * interface. The author has created a Python mapping for it, which
    35  * has been submitted for inclusion into the SDK, so it will hopefully
     35 * has been submitted for inclusion into the SDK, so it will hopefully 
    3636 * appear in its next version. It is planned to support X-Plane in the
    3737 * near future (hopefully by the end of 2012) on both Linux and
     
    4545 * Gtk+ and Gtk+ itself. Since Python is an interpreted language,
    4646 * there is no need for any special build system.
    47  *
     47 * 
    4848 * Python and Gtk+ are readily available on most Linux distributions,
    4949 * but some links are probably useful for Windows users:
     
    5454 * \li To create install packages, you also need py2exe: <a href="http://www.py2exe.org/">http://www.py2exe.org</a>,
    5555 * \li as well as the Nullsoft Install System: http://nsis.sourceforge.net/Main_Page
    56  *
     56 * 
    5757 * The install package can be created by running the \c makeinst.bat
    5858 * file. It contains some absolute paths, so check those befure
     
    8181 *    thread. Instead, use \c gobject.idle_add to "inject" the
    8282 *    operation into the main thread.
    83  * -# To ensure the responsiveness of the GUI, only operations
     83 * -# To ensure the responsiveness of the GUI, only operations 
    8484 *    that take a short time should be executed in the GUI thread.
    8585 *
     
    9898 * simulator is to be supported, a class with the same (or at least
    9999 * sufficiently similar) public interface should be implemented.
    100  *
     100 *             
    101101 * The most important function of the program is the
    102102 * continuous monitoring of the aircraft's parameters and some other
    103103 * data. The monitoring is started using the \ref
    104104 * mlx.fsuipc.Simulator.startMonitoring "startMonitoring" function of
    105  * the simulator object. If started, it calls the \ref
     105 * the simulator object. If started, it calls the \ref 
    106106 * mlx.acft.Aircraft.handleState "handleState" function of the
    107107 * mlx.acft.Aircraft instance used. The mlx.acft module contains one
     
    114114 * smoothed values of IAS and VS, and then calls each "checker". A
    115115 * checker is an instance of a subclass of mlx.checks.StateChecker,
    116  * which checks a one or a few parameters that are important from some
     116 * which checks a one or a few parameters that are important from some 
    117117 * aspect of the correct execution of a flight. For example, a checker
    118  * may check if the \ref mlx.checks.StrobeLightsChecker
     118 * may check if the \ref mlx.checks.StrobeLightsChecker 
    119119 * "strobe lights" are switched on and off at the right stages of the
    120120 * flight. But some checkers simply log some \ref
    121121 * mlx.checks.AltimeterLogger "value" whenever it changes
    122122 * in an "interesting" way, or \ref mlx.checks.ACARSSender "send the
    123  * ACARS" periodically.
     123 * ACARS" periodically. 
    124124 *
    125125 * There is also a \ref mlx.checks.StageCheker "checker" which
    126126 * detects the changes in the stage of the flight, and calls the
    127127 * \ref mlx.acft.Aircraft.setStage "setStage" function of the
    128  * aircraft, if there is a change. It first calls the
     128 * aircraft, if there is a change. It first calls the 
    129129 * \ref mlx.flight.Flight "flight"'s \ref mlx.flight.Flight.setStage
    130130 * "setStage" function, which notifies the GUI and the \ref
     
    139139 * mlx.soundsched.SoundScheduler "sound scheduler" to check if some
    140140 * backround sound should be played. If the check list hotkey is
    141  * pressed, the \ref mlx.soundsched.ChecklistScheduler
     141 * pressed, the \ref mlx.soundsched.ChecklistScheduler 
    142142 * "checklist scheduler" is notified too.
    143143 *
    144144 * As mentioned, there is a \ref mlx.logger.Logger "logger" in the
    145145 * application, which contains the textual log lines as well as the
    146  * faults and their scores.
     146 * faults and their scores. 
    147147 *
    148148 * The business logic part contains many other components, but they
     
    151151 * modules for more information.
    152152 *
    153  * \subsection arch_gui GUI
     153 * \subsection arch_gui GUI     
    154154 *
    155155 * As mentioned, the GUI is implemented using Gtk+. This toolkit
     
    158158 * experience with Glade in an earlier project, it was decided to not
    159159 * use it. Instead, the GUI elements are created and handled by
    160  * hand-written code.
     160 * hand-written code. 
    161161 *
    162162 * The central class of the graphical user interface is
     
    165165 * connection to the simulator and creates the \ref mlx.flight.Flight
    166166 * "flight" and \ref mlx.flight.Aircraft "aircraft" objects as
    167  * needed.
     167 * needed. 
    168168 *
    169169 * To understand the operation of the GUI, one should be familiar with
    170170 * Gtk+, but otherwise it is pretty straighforward. See the
    171  * documentation of the relevant modules for more information.
    172  *
    173  * \section newtype Adding a new aircraft type
    174  *
    175  * While new aircraft types will probably not be added too often, here
    176  * is a checklist about what should be modified when such a
    177  * requirement arises.
    178  *
    179  * First, it is worth to know what data you need to add the new type:
    180  *
    181  * \li the aircraft's type name and its ICAO code
    182  * \li the following weights: DOW, MZFW, MTOW, MLW
    183  * \li the flap settings and their speed limits
    184  * \li the speed limit for extending/retracting the gear (VLE)
    185  * \li the number and types of the fuel tanks
    186  * \li the type code the MAVA website uses to identify the type
    187  * \li if the plane has reversers, what is the operating limit speed,
    188  *     if any
    189  * \li does the plane support the notion of a takeoff derate, and if
    190  *     so, what data should be given
    191  * \li what lights does the plane have
    192  *
    193  * If you have the data, you can add the type by modifying the source
    194  * files as per the checklist below:
    195  *
    196  * -# \c src/mlx/const.py: look for the constants named AIRCRAFT_xxx.
    197  *    Add the new type at the end of the list of those constants, with
    198  *    a number 1 greater than the number of the last existing
    199  *    type. The part of the constant's name after the underscore (xxx
    200  *    above) should be the ICAO code of the aircraft type.
    201  * -# \c src/mlx/const.py: below this list of constants, you can find
    202  *    an array named \c aircraftTypes. Add the type constant to it.
    203  * -# \c src/mlx/const.py: further below you can find a dictionary
    204  *    mapping te aircraft type to the corresponding ICAO codes. Add
    205  *    the new type to it.
    206  * -# \c src/mlx/acft.py: add a new subclass of \ref
    207  *    mlx.acft.Aircraft. Its name should be the ICAO code. Check an
    208  *    existing aircraft and add the same variables containing the
    209  *    weights, the flap speed limits and the gear speed limit. There
    210  *    may be some other member variables or functions that should be
    211  * -# \c src/mlx/acft.py: there is a dictionary named \c _classes
    212  *    towards the end of the file. Add the type to it.
    213  * -# \c src/mlx/web.py: the \ref mlx.web.BookedFlight class contains
    214  *    two dictionaries, the mapping between the types and the values the MAVA
    215  *    website uses to identify the type. Add the appropriate values
    216  *    here.
    217  * -# \c src/mlx/fsuipc.py: add a subclass of \ref
    218  *    mlx.fsuipc.GenericAircraftModel for the new type named the ICAO
    219  *    code of the type followed by the word \c Model. Implement its
    220  *    constructor to supply the base class with the flaps notches
    221  *    (starting with 0), the array of constants describing the fuel
    222  *    tanks the model has, and the number of engines. Also implement
    223  *    the name of the model, which should be something like
    224  *    "FSUIPC/Generic ...". If necessary implement other functions or
    225  *    set other members.
    226  * -# \c src/mlx/fsuipc.py: add the new type and model class to the
    227  *    dictionary named \c _genericModels towards the end of the file.
    228  * -# \c src/mlx/fsuipc.py: if you have a model that has some
    229  *    non-generic characteristics, create a specific class for
    230  *    it. This class should be a subclass of the generic class
    231  *    created, and it should be registered at the bottom of the file,
    232  *    as the other models are.
    233  * -# \c src/mlx/gui/common.py: this file contains a dictionary called
    234  *    \c mlx.gui.common.aircraftNames. Add the new type it it. It
    235  *    contains the mapping from the type constants to their
    236  *    language-specific names. The string ID is "aircraft_" followed by
    237  *    the lower-cased ICAO code.
    238  * -# \c locale/hu/mlx.po, locale/en/mlx.po: the beginning of this
    239  *    file contains mapping from the string ID previously used to the
    240  *    actual name of the aircraft. Add the new type as appropriate.
    241  * -# \c dcdatagen.py: this program generates some source and message
    242  *    files related to the delay codes. Currently there are two
    243  *    tables, one for old-timer types and the other for the "modern" types.
    244  *    The file contains a list of lists called \c typeGroups. Add the
    245  *    type's ICAO code the appropriate list.
    246  *
    247  * When all the changes have been made, run \c make in the root
    248  * directory to update some source files.
     171 * documentation of the relevant modules for more information.
    249172 */
     173 
  • locale/en/mlx.po

    r445 r393  
    6363msgid "aircraft_yk40"
    6464msgstr "Yakovlev Yak-40"
    65 
    66 msgid "aircraft_b462"
    67 msgstr "British Aerospace 146-200"
    6865
    6966msgid "file_filter_all"
     
    780777msgstr "N_ominal/takeoff:"
    781778
    782 msgid "takeoff_derate_b462"
    783 msgstr "Der_ate (yes/no):"
    784 
    785779msgid "takeoff_derate_tooltip"
    786780msgstr "Enter the takeoff derate parameter."
     
    977971msgid "info_delay"
    978972msgstr "Delay codes"
     973
     974msgid "info_delay_loading"
     975msgstr "L_oading problems"
     976
     977msgid "info_delay_vatsim"
     978msgstr "_VATSIM problem"
     979
     980msgid "info_delay_net"
     981msgstr "_Net problems"
     982
     983msgid "info_delay_atc"
     984msgstr "Controll_er's fault"
     985
     986msgid "info_delay_system"
     987msgstr "S_ystem crash/freeze"
     988
     989msgid "info_delay_nav"
     990msgstr "Naviga_tion problem"
     991
     992msgid "info_delay_traffic"
     993msgstr "T_raffic problems"
     994
     995msgid "info_delay_apron"
     996msgstr "_Apron navigation problem"
     997
     998msgid "info_delay_weather"
     999msgstr "_Weather problems"
     1000
     1001msgid "info_delay_personal"
     1002msgstr "_Personal reasons"
    9791003
    9801004msgid "statusbar_conn_tooltip"
  • locale/hu/mlx.po

    r445 r393  
    6464msgstr "Jakovlev Jak-40"
    6565
    66 msgid "aircraft_b462"
    67 msgstr "British Aerospace 146-200"
    68 
    6966msgid "file_filter_all"
    7067msgstr "Összes fájl"
     
    781778msgstr "Névleges/felszállási:"
    782779
    783 msgid "takeoff_derate_b462"
    784 msgstr "Teljesítménycsökkentés (yes/no):"
    785 
    786780msgid "takeoff_derate_tooltip"
    787781msgstr "Írd be a felszállási teljesítménycsökkentés értékét."
     
    980974msgid "info_delay"
    981975msgstr "Késés kódok"
     976
     977msgid "info_delay_loading"
     978msgstr "_Betöltési problémák"
     979
     980msgid "info_delay_vatsim"
     981msgstr "_VATSIM probléma"
     982
     983msgid "info_delay_net"
     984msgstr "_Hálózati problémák"
     985
     986msgid "info_delay_atc"
     987msgstr "Irán_yító hibája"
     988
     989msgid "info_delay_system"
     990msgstr "_Rendszer elszállás/fagyás"
     991
     992msgid "info_delay_nav"
     993msgstr "Navi_gációs probléma"
     994
     995msgid "info_delay_traffic"
     996msgstr "_Forgalmi problémák"
     997
     998msgid "info_delay_apron"
     999msgstr "_Előtér navigációs probléma"
     1000
     1001msgid "info_delay_weather"
     1002msgstr "Időjárási _problémák"
     1003
     1004msgid "info_delay_personal"
     1005msgstr "S_zemélyes okok"
    9821006
    9831007msgid "statusbar_conn_tooltip"
  • src/mlx/acft.py

    r447 r409  
    152152        self._checkers.append(checks.VSChecker())
    153153
    154         timeout = 30.0 + config.realIASSmoothingLength - 1
     154        timeout = 5.0 + config.realIASSmoothingLength - 1
    155155        self._checkers.append(checks.OverspeedChecker(timeout = timeout))
    156156
     
    10171017#---------------------------------------------------------------------------------------
    10181018
    1019 class B462(Aircraft):
    1020     """British Aerospace BAe-146 aircraft.
    1021 
    1022     The aircraft type-specific values in the aircraft state have the following
    1023     structure:
    1024     - fuel: left, centre, right
    1025     - n1: left outer, left inner, right inner, right outer
    1026     - reverser: empty (the plane has no reversers)"""
    1027     def __init__(self, flight):
    1028         super(B462, self).__init__(flight)
    1029         self.dow = 25706
    1030         self.mtow = 43998
    1031         self.mlw = 38599
    1032         self.mzfw = 33792
    1033         self.gearSpeedLimit = 210
    1034         self.flapSpeedLimits = { 18 : 217,
    1035                                  24 : 180,
    1036                                  30 : 170,
    1037                                  33 : 150 }
    1038 
    1039     @property
    1040     def derateLabels(self):
    1041         """Get the derate strings for this type."""
    1042         return (xstr("takeoff_derate_b462"), None)
    1043 
    1044     @property
    1045     def derateTemplate(self):
    1046         """Get the derate template for this aicraft type."""
    1047         return "Derate enabled: %s"
    1048 
    1049 #---------------------------------------------------------------------------------------
    1050 
    10511019mostFuelTanks = [const.FUELTANK_LEFT_TIP, const.FUELTANK_EXTERNAL1,
    10521020                 const.FUELTANK_LEFT_AUX,
     
    10721040             const.AIRCRAFT_T134  : T134,
    10731041             const.AIRCRAFT_T154  : T154,
    1074              const.AIRCRAFT_YK40  : YK40,
    1075              const.AIRCRAFT_B462  : B462 }
     1042             const.AIRCRAFT_YK40  : YK40 }
    10761043
    10771044#---------------------------------------------------------------------------------------
  • src/mlx/checks.py

    r450 r430  
    10541054    def isCondition(self, flight, aircraft, oldState, state):
    10551055        """Check if the fault condition holds."""
    1056         return state.gLoad>2.0 and not state.onTheGround and \
    1057           (flight.stage!=const.STAGE_LANDING or state.radioAltitude>=50)
     1056        return state.gLoad>2.0 and (flight.stage!=const.STAGE_LANDING or \
     1057                                    state.radioAltitude>=50)
    10581058
    10591059    def logFault(self, flight, aircraft, logger, oldState, state):
     
    11221122                 (flight.stage in
    11231123                  [const.STAGE_CRUISE, const.STAGE_DESCENT,
    1124                    const.STAGE_GOAROUND] or \
    1125                   (flight.stage==const.STAGE_LANDING  and
    1126                    state.groundSpeed>50.0) or \
     1124                   const.STAGE_LANDING, const.STAGE_GOAROUND] or \
    11271125                  ((not state.autoXPDR or \
    11281126                    (self._liftOffTime is not None and
     
    12411239class OverspeedChecker(PatientFaultChecker):
    12421240    """Check if Vne has been exceeded."""
    1243     def __init__(self, timeout = 30.0):
     1241    def __init__(self, timeout = 5.0):
    12441242        """Construct the checker."""
    12451243        super(OverspeedChecker, self).__init__(timeout = timeout)
     
    13101308        return flight.stage in [const.STAGE_DESCENT, const.STAGE_LANDING,
    13111309                                const.STAGE_TAXIAFTERLAND] and \
    1312             state.reverser and \
    13131310            state.groundSpeed<aircraft.reverseMinSpeed and max(state.reverser)
    13141311
  • src/mlx/const.py

    r443 r417  
    1111
    1212## The version of the program
    13 VERSION="0.16"
     13VERSION="0.15"
    1414
    1515#-------------------------------------------------------------------------------
     
    9595## Aircraft type: Yakovlev Yak-40
    9696AIRCRAFT_YK40 = 15
    97 
    98 ## Aircraft type: British Aerospace BAe-146
    99 AIRCRAFT_B462 = 16
    10097
    10198#-------------------------------------------------------------------------------
     
    111108                 AIRCRAFT_B733, AIRCRAFT_B734, AIRCRAFT_B735,
    112109                 AIRCRAFT_T154, AIRCRAFT_T134,
    113                  AIRCRAFT_YK40, AIRCRAFT_DC3,
    114                  AIRCRAFT_B462]
     110                 AIRCRAFT_YK40, AIRCRAFT_DC3]
    115111
    116112#-------------------------------------------------------------------------------
     
    133129              AIRCRAFT_T134  : "T134",
    134130              AIRCRAFT_T154  : "T154",
    135               AIRCRAFT_YK40  : "YK40",
    136               AIRCRAFT_B462  : "B462" }
     131              AIRCRAFT_YK40  : "YK40" }
    137132
    138133#-------------------------------------------------------------------------------
     
    242237#-------------------------------------------------------------------------------
    243238
     239## Delay code: loading problems
     240DELAYCODE_LOADING = 0
     241
     242## Delay code: VATSIM problem
     243DELAYCODE_VATSIM = 1
     244
     245## Delay code: network problems
     246DELAYCODE_NETWORK = 2
     247
     248## Delay code: controller's fault
     249DELAYCODE_CONTROLLER = 3
     250
     251## Delay code: system crash or freeze
     252DELAYCODE_SYSTEM = 4
     253
     254## Delay code: navigation problem
     255DELAYCODE_NAVIGATION = 5
     256
     257## Delay code: traffic problems
     258DELAYCODE_TRAFFIC = 6
     259
     260## Delay code: apron navigation
     261DELAYCODE_APRON = 7
     262
     263## Delay code: weather problems
     264DELAYCODE_WEATHER = 8
     265
     266## Delay code: personal reasons
     267DELAYCODE_PERSONAL = 9
     268
     269#-------------------------------------------------------------------------------
     270
    244271## Message type: logger error
    245272# FIXME: cannot set the hotkey
  • src/mlx/fsuipc.py

    r443 r412  
    20432043#------------------------------------------------------------------------------
    20442044
    2045 class B462Model(GenericAircraftModel):
    2046     """Generic model for the British Aerospace BAe 146-200 aircraft."""
    2047     fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE,
    2048                  const.FUELTANK_RIGHT]
    2049 
    2050     def __init__(self):
    2051         """Construct the model."""
    2052         super(B462Model, self). \
    2053             __init__(flapsNotches = [0, 18, 24, 30, 33],
    2054                      fuelTanks = B462Model.fuelTanks,
    2055                      numEngines = 4)
    2056 
    2057     @property
    2058     def name(self):
    2059         """Get the name for this aircraft model."""
    2060         return "FSUIPC/Generic British Aerospace 146"
    2061 
    2062     def getAircraftState(self, aircraft, timestamp, data):
    2063         """Get an aircraft state object for the given monitoring data.
    2064 
    2065         This removes the reverser value for the middle engine."""
    2066         state = super(B462Model, self).getAircraftState(aircraft, timestamp, data)
    2067         state.reverser = []
    2068         return state
    2069 
    2070 #------------------------------------------------------------------------------
    2071 
    20722045_genericModels = { const.AIRCRAFT_B736  : B737Model,
    20732046                   const.AIRCRAFT_B737  : B737Model,
     
    20852058                   const.AIRCRAFT_T134  : T134Model,
    20862059                   const.AIRCRAFT_T154  : T154Model,
    2087                    const.AIRCRAFT_YK40  : YK40Model,
    2088                    const.AIRCRAFT_B462  : B462Model }
     2060                   const.AIRCRAFT_YK40  : YK40Model }
    20892061
    20902062#------------------------------------------------------------------------------
  • src/mlx/gui/common.py

    r443 r401  
    7373
    7474    SHADOW_IN = gtk.SHADOW_IN
    75     SHADOW_NONE = gtk.SHADOW_NONE
    7675
    7776    POLICY_AUTOMATIC = gtk.POLICY_AUTOMATIC
     
    8786
    8887    EVENT_BUTTON_PRESS = gdk.BUTTON_PRESS
    89 
    90     TREE_VIEW_COLUMN_FIXED = gtk.TREE_VIEW_COLUMN_FIXED
    91 
    92     FILL = gtk.FILL
    93     EXPAND = gtk.EXPAND
    9488
    9589    pixbuf_new_from_file = gdk.pixbuf_new_from_file
     
    145139
    146140    SHADOW_IN = gtk.ShadowType.IN
    147     SHADOW_NONE = gtk.ShadowType.NONE
    148141
    149142    POLICY_AUTOMATIC = gtk.PolicyType.AUTOMATIC
     
    159152
    160153    EVENT_BUTTON_PRESS = gdk.EventType.BUTTON_PRESS
    161 
    162     TREE_VIEW_COLUMN_FIXED = gtk.TreeViewColumnSizing.FIXED
    163 
    164     FILL = gtk.AttachOptions.FILL
    165     EXPAND = gtk.AttachOptions.EXPAND
    166154
    167155    pixbuf_new_from_file = gdkPixbuf.Pixbuf.new_from_file
     
    298286                  _const.AIRCRAFT_T134  : xstr("aircraft_t134"),
    299287                  _const.AIRCRAFT_T154  : xstr("aircraft_t154"),
    300                   _const.AIRCRAFT_YK40  : xstr("aircraft_yk40"),
    301                   _const.AIRCRAFT_B462  : xstr("aircraft_b462") }
     288                  _const.AIRCRAFT_YK40  : xstr("aircraft_yk40") }
    302289
    303290#------------------------------------------------------------------------------
  • src/mlx/gui/flight.py

    r436 r413  
    368368    def _loginClicked(self, button):
    369369        """Called when the login button was clicked."""
    370         print "mlx.flight.LoginPage: logging in"
     370        print "mlx.flight.LoginPage: logged in"
    371371        self._wizard.login(self._handleLoginResult,
    372372                           self._pilotID.get_text(),
     
    591591        flight = self._getSelectedFlight()
    592592        self._wizard._bookedFlight = flight
    593         self._wizard.gui.enableFlightInfo(flight.aircraftType)
     593        self._wizard.gui.enableFlightInfo()
    594594
    595595        self._updateDepartureGate()
  • src/mlx/gui/gui.py

    r450 r430  
    493493            self.reset()
    494494
    495     def enableFlightInfo(self, aircraftType):
     495    def enableFlightInfo(self):
    496496        """Enable the flight info tab."""
    497         self._flightInfo.enable(aircraftType)
     497        self._flightInfo.enable()
    498498
    499499    def cancelFlight(self):
  • src/mlx/gui/info.py

    r441 r349  
    11
    22from common import *
    3 
    4 from mlx.gui.delaycodes import DelayCodeTable
    53
    64from mlx.i18n import xstr
     
    2321    """The flight info tab."""
    2422    @staticmethod
     23    def _delayCodes():
     24        """Get an array of delay codes."""
     25        return [ (const.DELAYCODE_LOADING, xstr("info_delay_loading")),
     26                 (const.DELAYCODE_VATSIM, xstr("info_delay_vatsim")),
     27                 (const.DELAYCODE_NETWORK, xstr("info_delay_net")),
     28                 (const.DELAYCODE_CONTROLLER, xstr("info_delay_atc")),
     29                 (const.DELAYCODE_SYSTEM, xstr("info_delay_system")),
     30                 (const.DELAYCODE_NAVIGATION, xstr("info_delay_nav")),
     31                 (const.DELAYCODE_TRAFFIC, xstr("info_delay_traffic")),
     32                 (const.DELAYCODE_APRON, xstr("info_delay_apron")),
     33                 (const.DELAYCODE_WEATHER, xstr("info_delay_weather")),
     34                 (const.DELAYCODE_PERSONAL, xstr("info_delay_personal")) ]
     35
     36    @staticmethod
    2537    def _createCommentArea(label):
    2638        """Create a comment area.
     
    4052
    4153        scroller = gtk.ScrolledWindow()
    42         scroller.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
    43         scroller.set_shadow_type(SHADOW_IN)
    44 
     54        # FIXME: these should be constants
     55        scroller.set_policy(gtk.PolicyType.AUTOMATIC if pygobject
     56                            else gtk.POLICY_AUTOMATIC,
     57                            gtk.PolicyType.AUTOMATIC if pygobject
     58                            else gtk.POLICY_AUTOMATIC)
     59        scroller.set_shadow_type(gtk.ShadowType.IN if pygobject
     60                                 else gtk.SHADOW_IN)
    4561        comments = gtk.TextView()
    4662        comments.set_wrap_mode(WRAP_WORD)
     
    7894
    7995        alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
    80                                   xscale = 1.0, yscale = 1.0)
     96                                  xscale = 0.0, yscale = 0.0)
    8197        alignment.set_padding(padding_top = 4, padding_bottom = 4,
    8298                              padding_left = 8, padding_right = 8)
    8399
    84         self._delayCodeTable = table = DelayCodeTable()
    85         self._delayWindow = scrolledWindow = gtk.ScrolledWindow()
    86         scrolledWindow.add(table)
    87         scrolledWindow.set_size_request(-1, 185)
    88         scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
    89         scrolledWindow.set_shadow_type(SHADOW_IN)
     100        self._delayTable = table = gtk.Table(5, 2)
     101        table.set_col_spacings(16)
    90102
    91         alignment.add(scrolledWindow)
     103        row = 0
     104        column = 0
     105
     106        self._delayCodeWidgets = []
     107        for (_code, label) in FlightInfo._delayCodes():
     108            button = gtk.CheckButton(label)
     109            button.set_use_underline(True)
     110            table.attach(button, column, column + 1, row, row + 1)
     111            self._delayCodeWidgets.append(button)
     112            if column==0:
     113                column += 1
     114            else:
     115                row += 1
     116                column = 0
     117
     118        alignment.add(table)
    92119        frame.add(alignment)
    93120
    94121        self._delayAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
    95                                              xscale = 1.0, yscale = 1.0)
     122                                             xscale = 0.0, yscale = 0.0)
    96123        self._delayAlignment.add(frame)
    97         self._delayAlignment.set_padding(padding_top = 0, padding_bottom = 0,
    98                                          padding_left = 8, padding_right = 8)
    99124
    100125        self.pack_start(self._delayAlignment, False, False, 8)
     
    122147    def delayCodes(self):
    123148        """Get the list of delay codes checked by the user."""
    124         return self._delayCodeTable.delayCodes
     149        codes =  []
     150        delayCodes = FlightInfo._delayCodes()
     151        for index in range(0, len(delayCodes)):
     152            if self._delayCodeWidgets[index].get_active():
     153                codes.append(delayCodes[index][0])
     154        return codes
    125155
    126     def enable(self, aircraftType):
     156    def enable(self):
    127157        """Enable the flight info tab."""
    128158        self._comments.set_sensitive(True)
    129159        self._flightDefects.set_sensitive(True)
    130         self._delayCodeTable.setType(aircraftType)
    131         self._delayWindow.set_sensitive(True)
    132         self._delayCodeTable.setStyle()
     160        self._delayTable.set_sensitive(True)
    133161
    134162    def disable(self):
     
    136164        self._comments.set_sensitive(False)
    137165        self._flightDefects.set_sensitive(False)
    138         self._delayWindow.set_sensitive(False)
    139         self._delayCodeTable.setStyle()
     166        self._delayTable.set_sensitive(False)
    140167
    141168    def reset(self):
     
    143170        self._comments.get_buffer().set_text("")
    144171        self._flightDefects.get_buffer().set_text("")
    145         self._delayCodeTable.reset()
     172
     173        for widget in self._delayCodeWidgets:
     174            widget.set_active(False)
    146175
    147176    def _commentsChanged(self, textbuffer):
  • src/mlx/gui/pirep.py

    r437 r303  
    241241        for code in pirep.delayCodes:
    242242            if delayCodes: delayCodes += ", "
    243             delayCodes += code
     243            delayCodes += PIREP.delayCodeNames[code]
    244244       
    245245        self._delayCodes.get_buffer().set_text(delayCodes)       
  • src/mlx/pirep.py

    r437 r401  
    1919class PIREP(object):
    2020    """A pilot's report of a flight."""
     21    delayCodeNames = { const.DELAYCODE_LOADING : "Loading Problems",
     22                       const.DELAYCODE_NETWORK : "Net Problems",
     23                       const.DELAYCODE_SYSTEM : "System Crash/Freezing",
     24                       const.DELAYCODE_TRAFFIC : "Traffic Problems",
     25                       const.DELAYCODE_WEATHER : "Weather Problems",
     26                       const.DELAYCODE_VATSIM : "VATSIM Problem",
     27                       const.DELAYCODE_CONTROLLER : "Controller's Fault",
     28                       const.DELAYCODE_NAVIGATION : "Navigation Problem",
     29                       const.DELAYCODE_APRON : "Apron Navigation Problems",
     30                       const.DELAYCODE_PERSONAL : "Personal Reasons" }
     31
    2132    @staticmethod
    2233    def _formatLine(timeStr, line):
     
    129140            for code in self.delayCodes:
    130141                if s: s += ", "
    131                 s += code
     142                s += PIREP.delayCodeNames[code]
    132143            return s
    133144
  • src/mlx/pyuipc_sim.py

    r443 r408  
    158158    ENGINE_3 = 2
    159159
    160     ## Engine index: engine #4
    161     ENGINE_4 = 3
    162 
    163160    ## The number of hotkey entries
    164161    HOTKEY_SIZE = 56
     
    298295        self.visibility = 10000
    299296
    300         self.n1 = [0.0, 0.0, 0.0, 0.0]
    301         self.throttles = [0.0, 0.0, 0.0, 0.0]
     297        self.n1 = [0.0, 0.0, 0.0]
     298        self.throttles = [0.0, 0.0, 0.0]
    302299
    303300        self.payloadCount = 1
     
    331328        self.eng2DeIce = False
    332329        self.eng3DeIce = False
    333         self.eng4DeIce = False
    334330        self.propDeIce = False
    335331        self.structDeIce = False
     
    431427        elif offset==0x09e2:       # Engine #3 de-ice
    432428            return 1 if self.eng3DeIce else 0
    433         elif offset==0x0a54:       # Engine #4 throttle
    434             return self._getThrottle(self.ENGINE_4)
    435         elif offset==0x0a7a:       # Engine #4 de-ice
    436             return 1 if self.eng4DeIce else 0
    437429        elif offset==0x0af4:       # Fuel weight
    438430            return int(self.fuelWeight * 256.0)
     
    541533            return self.n1[self.ENGINE_2]
    542534        elif offset==0x2200:       # Engine #3 N1
    543             return self.n1[self.ENGINE_3]
    544         elif offset==0x2300:       # Engine #4 N1
    545535            return self.n1[self.ENGINE_3]
    546536        elif offset==0x2ea0:       # Elevator trim
     
    705695        elif offset==0x09e2:       # Engine #3 de-ice
    706696            self.eng3DeIce = value!=0
    707         elif offset==0x0a54:       # Engine #4 throttle
    708             self._setThrottle(self.ENGINE_4, value)
    709         elif offset==0x0a7a:       # Engine #4 de-ice
    710             self.eng4DeIce = value!=0
    711697        elif offset==0x0af4:       # Fuel weight
    712698            self.fuelWeight = value / 256.0
     
    810796        elif offset==0x2200:       # Engine #3 N1
    811797            self.n1[self.ENGINE_3] = value
    812         elif offset==0x2300:       # Engine #4 N1
    813             self.n1[self.ENGINE_4] = value
    814798        elif offset==0x2ea0:       # Elevator trim
    815799            self.elevatorTrim = value * 180.0 / math.pi
     
    14291413        self._valueHandlers["n1_3"] = ([(0x2200, "f")], lambda value: value,
    14301414                                       lambda word: float(word))
    1431         self._valueHandlers["n1_4"] = ([(0x2300, "f")], lambda value: value,
    1432                                        lambda word: float(word))
    14331415
    14341416        self._valueHandlers["throttle_1"] = ([(0x088c, "H")],
     
    14391421                                             CLI.throttle2pyuipc)
    14401422        self._valueHandlers["throttle_3"] = ([(0x09bc, "H")],
    1441                                              CLI.pyuipc2throttle,
    1442                                              CLI.throttle2pyuipc)
    1443         self._valueHandlers["throttle_4"] = ([(0x0a54, "H")],
    14441423                                             CLI.pyuipc2throttle,
    14451424                                             CLI.throttle2pyuipc)
     
    15111490                                            CLI.bool2str, CLI.str2bool)
    15121491        self._valueHandlers["eng3Deice"] = ([(0x09e2, "H")],
    1513                                             CLI.bool2str, CLI.str2bool)
    1514         self._valueHandlers["eng4Deice"] = ([(0x0a7a, "H")],
    15151492                                            CLI.bool2str, CLI.str2bool)
    15161493        self._valueHandlers["propDeice"] = ([(0x337c, "b")],
  • src/mlx/web.py

    r450 r430  
    6363                      "TU3"  : const.AIRCRAFT_T134,
    6464                      "TU5"  : const.AIRCRAFT_T154,
    65                       "YK4"  : const.AIRCRAFT_YK40,
    66                       "146"  : const.AIRCRAFT_B462 }
     65                      "YK4"  : const.AIRCRAFT_YK40 }
    6766
    6867    TYPE2TYPECODE = { const.AIRCRAFT_B736  : "736",
     
    8180                      const.AIRCRAFT_T134  : "TU3",
    8281                      const.AIRCRAFT_T154  : "TU5",
    83                       const.AIRCRAFT_YK40  : "YK4",
    84                       const.AIRCRAFT_B462  : "146" }
     82                      const.AIRCRAFT_YK40  : "YK4" }
    8583
    8684    @staticmethod
Note: See TracChangeset for help on using the changeset viewer.