Ignore:
Timestamp:
03/29/15 12:10:53 (10 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Reworked the representation and handling of gate data (re #113)

Location:
src/mlx/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/flight.py

    r607 r619  
    77from mlx.flight import Flight
    88from mlx.checks import PayloadChecker
     9from mlx.gates import lhbpGates
    910import mlx.util as util
    1011from mlx.pirep import PIREP
     
    818819        self._gateList.set_sensitive(True)
    819820        occupiedGateNumbers = self._wizard._fleet.getOccupiedGateNumbers()
    820         for gateNumber in const.lhbpGateNumbers:
    821             if gateNumber not in occupiedGateNumbers:
    822                 self._listStore.append([gateNumber])
     821        for gate in lhbpGates:
     822            if gate.isAvailable(lhbpGates, occupiedGateNumbers):
     823                self._listStore.append([gate.number])
    823824
    824825    def finalize(self):
     
    32533254           self._wizard.bookedFlight.arrivalICAO=="LHBP" and \
    32543255           not self._wizard.entranceExam:
    3255             occupiedGates = self._wizard._fleet.getOccupiedGateNumbers()
    3256             for gateNumber in const.lhbpGateNumbers:
    3257                 if gateNumber not in occupiedGates:
    3258                     self._gatesModel.append([gateNumber])
     3256            occupiedGateNumbers = self._wizard._fleet.getOccupiedGateNumbers()
     3257            for gate in lhbpGates.gates:
     3258                if gate.isAvailable(lhbpGates, occupiedGateNumbers):
     3259                    self._gatesModel.append([gate.number])
    32593260            self._gateLabel.set_sensitive(True)
    32603261            self._gate.set_sensitive(True)
  • src/mlx/gui/gates.py

    r300 r619  
    44from mlx.i18n import xstr
    55import mlx.const as const
     6from mlx.gates import Gates, lhbpGates
    67
    78#-------------------------------------------------------------------------------
     
    8283        statusBox.pack_start(gatesFrame, True, True, 4)       
    8384
    84         self._gatesTable = table = gtk.Table(14, 4)
     85        self._gatesTable = table = gtk.Table(lhbpGates.numRows,
     86                                             lhbpGates.numColumns)
    8587        table.set_tooltip_markup(xstr("gates_gates_tooltip"))
    8688        alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
     
    9496        column = 0
    9597        row = 0
    96         for gateNumber in const.lhbpGateNumbers:
    97             label = gtk.Label()
    98             label.set_markup("<b>" + gateNumber + "</b>")
    99             table.attach(label, column, column + 1, row, row + 1)
     98        for (type, data) in lhbpGates.displayInfos:
     99            if type==Gates.DISPLAY_GATE:
     100                gate = data
    100101
    101             self._gateLabels[gateNumber] = label
    102            
    103             if column==1 and row==12:
    104                 column = 2
    105                 row = 1
    106             elif row==13:
     102                label = gtk.Label()
     103                label.set_markup("<b>" + gate.number + "</b>")
     104                table.attach(label, column, column + 1, row, row + 1)
     105
     106                self._gateLabels[gate.number] = label
     107                row += 1
     108            elif type==Gates.DISPLAY_SPACE:
     109                row += 1
     110            elif type==Gates.DISPLAY_NEW_COLUMN:
     111                row = 0
    107112                column += 1
    108                 row = 0
    109             else:
    110                 row += 1
    111                
     113
    112114        button = gtk.Button(xstr("gates_refresh"))
    113115        button.set_use_underline(True)
     
    168170
    169171            occupiedGateNumbers = fleet.getOccupiedGateNumbers()
    170             for gateNumber in const.lhbpGateNumbers:
     172            for gate in lhbpGates.gates:
     173                gateNumber = gate.number
    171174                markup = gateNumber
    172175                if gateNumber in occupiedGateNumbers:
Note: See TracChangeset for help on using the changeset viewer.