Ignore:
Timestamp:
04/21/12 14:58:44 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The delay code buttons are generated in a more generic way

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.