Changeset 98:f017d907fa39


Ignore:
Timestamp:
04/21/12 14:58:44 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

The delay code buttons are generated in a more generic way

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/const.py

    r97 r98  
    143143# Flight type: charter
    144144FLIGHTTYPE_CHARTER = 3
     145
     146#-------------------------------------------------------------------------------
     147
     148# Delay code: loading problems
     149DELAYCODE_LOADING = 0
     150
     151# Delay code: VATSIM problem
     152DELAYCODE_VATSIM = 1
     153
     154# Delay code: network problems
     155DELAYCODE_NETWORK = 2
     156
     157# Delay code: controller's fault
     158DELAYCODE_CONTROLLER = 3
     159
     160# Delay code: system crash or freeze
     161DELAYCODE_SYSTEM = 4
     162
     163# Delay code: navigation problem
     164DELAYCODE_NAVIGATION = 5
     165
     166# Delay code: traffic problems
     167DELAYCODE_TRAFFIC = 6
     168
     169# Delay code: apron navigation
     170DELAYCODE_APRON = 7
     171
     172# Delay code: weather problems
     173DELAYCODE_WEATHER = 8
     174
     175# Delay code: personal reasons
     176DELAYCODE_PERSONAL = 9
    145177
    146178#-------------------------------------------------------------------------------
  • src/mlx/gui/info.py

    r97 r98  
    33from common import *
    44
     5import mlx.const as const
     6
    57class FlightInfo(gtk.VBox):
    68    """The flight info tab."""
     9    _delayCodes = [ (const.DELAYCODE_LOADING, "L_oading problems"),
     10                    (const.DELAYCODE_VATSIM, "_VATSIM problem"),
     11                    (const.DELAYCODE_NETWORK, "_Net problems"),
     12                    (const.DELAYCODE_CONTROLLER, "Controller's _fault"),
     13                    (const.DELAYCODE_SYSTEM, "S_ystem crash/freeze"),
     14                    (const.DELAYCODE_NAVIGATION, "Navi_gation problem"),
     15                    (const.DELAYCODE_TRAFFIC, "T_raffic problems"),
     16                    (const.DELAYCODE_APRON, "_Apron navigation problem"),
     17                    (const.DELAYCODE_WEATHER, "_Weather problems"),
     18                    (const.DELAYCODE_PERSONAL, "_Personal reasons") ]
     19   
    720    @staticmethod
    821    def _createCommentArea(label):
     
    6982        table.set_col_spacings(16)
    7083
    71         self._loadingProblems = gtk.CheckButton("L_oading problems")
    72         self._loadingProblems.set_use_underline(True)
    73         table.attach(self._loadingProblems, 0, 1, 0, 1)
     84        row = 0
     85        column = 0
    7486
    75         self._vatsimProblem = gtk.CheckButton("_VATSIM problem")
    76         self._vatsimProblem.set_use_underline(True)
    77         table.attach(self._vatsimProblem, 1, 2, 0, 1)
    78 
    79         self._netProblems = gtk.CheckButton("_Net problems")
    80         self._netProblems.set_use_underline(True)
    81         table.attach(self._netProblems, 0, 1, 1, 2)
    82 
    83         self._controllersFault = gtk.CheckButton("Controllers _fault")
    84         self._controllersFault.set_use_underline(True)
    85         table.attach(self._controllersFault, 1, 2, 1, 2)
    86 
    87         self._systemCrash = gtk.CheckButton("S_ystem crash/freeze")
    88         self._systemCrash.set_use_underline(True)
    89         table.attach(self._systemCrash, 0, 1, 2, 3)
    90 
    91         self._navigationProblem = gtk.CheckButton("Navi_gation problem")
    92         self._navigationProblem.set_use_underline(True)
    93         table.attach(self._navigationProblem, 1, 2, 2, 3)
    94 
    95         self._trafficProblems = gtk.CheckButton("T_raffic problems")
    96         self._trafficProblems.set_use_underline(True)
    97         table.attach(self._trafficProblems, 0, 1, 3, 4)
    98 
    99         self._apronProblem = gtk.CheckButton("_Apron navigation problem")
    100         self._apronProblem.set_use_underline(True)
    101         table.attach(self._apronProblem, 1, 2, 3, 4)
    102 
    103         self._weatherProblems = gtk.CheckButton("_Weather problems")
    104         self._weatherProblems.set_use_underline(True)
    105         table.attach(self._weatherProblems, 0, 1, 4, 5)
    106 
    107         self._personalReasons = gtk.CheckButton("_Personal reasons")
    108         self._personalReasons.set_use_underline(True)
    109         table.attach(self._personalReasons, 1, 2, 4, 5)
     87        self._delayCodeWidgets = []
     88        for (_code, label) in FlightInfo._delayCodes:
     89            button = gtk.CheckButton(label)
     90            button.set_use_underline(True)
     91            table.attach(button, column, column + 1, row, row + 1)
     92            self._delayCodeWidgets.append(button)
     93            if column==0:
     94                column += 1
     95            else:
     96                row += 1
     97                column = 0
    11098
    11199        alignment.add(table)
Note: See TracChangeset for help on using the changeset viewer.