Changeset 274:b866c39279e8 for src/mlx/gui
- Timestamp:
- 07/05/12 17:51:58 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r262 r274 1163 1163 gui.beginBusy(xstr("fuel_get_busy")) 1164 1164 1165 gui.simulator.getFuel(gui.flight.aircraft.fuelTanks, 1166 self._handleFuel) 1165 gui.simulator.getFuel(self._handleFuel) 1167 1166 else: 1168 1167 self._wizard.nextPage() … … 1374 1373 self.setMainWidget(self._fuelAlignment) 1375 1374 1376 tanks = acft.MostFuelTankAircraft.fuelTanks 1377 tankData = ((2500, 3900),) * len(tanks) 1378 self._setupTanks(tanks, tankData) 1375 tankData = [(tank, 2500, 3900) for tank in acft.mostFuelTanks] 1376 self._setupTanks(tankData) 1379 1377 1380 1378 self.addCancelFlightButton() … … 1387 1385 def activate(self): 1388 1386 """Activate the page.""" 1389 gui = self._wizard.gui 1390 1391 self._setupTanks(gui.flight.aircraft.fuelTanks, 1392 self._wizard._fuelData) 1387 self._setupTanks(self._wizard._fuelData) 1393 1388 1394 1389 def finalize(self): … … 1410 1405 self._wizard.nextPage() 1411 1406 1412 def _setupTanks(self, tank s, tankData):1407 def _setupTanks(self, tankData): 1413 1408 """Setup the tanks for the given data.""" 1414 numTanks = len(tank s)1409 numTanks = len(tankData) 1415 1410 if self._fuelTable is not None: 1416 1411 self._fuelAlignment.remove(self._fuelTable) … … 1419 1414 self._fuelTable = gtk.Table(numTanks, 1) 1420 1415 self._fuelTable.set_col_spacings(16) 1421 for i in range(0, numTanks): 1422 tank = tanks[i] 1423 (current, capacity) = tankData[i] 1424 1416 index = 0 1417 for (tank, current, capacity) in tankData: 1425 1418 fuelTank = FuelTank(tank, 1426 1419 xstr("fuel_tank_" + 1427 1420 const.fuelTank2string(tank)), 1428 1421 capacity, current) 1429 self._fuelTable.attach(fuelTank, i , i+1, 0, 1)1422 self._fuelTable.attach(fuelTank, index, index+1, 0, 1) 1430 1423 self._fuelTanks.append(fuelTank) 1424 index += 1 1431 1425 1432 1426 self._fuelAlignment.add(self._fuelTable) -
src/mlx/gui/monitor.py
r263 r274 281 281 282 282 fuelStr = "" 283 for fuelin aircraftState.fuel:283 for (_tank, fuel) in aircraftState.fuel: 284 284 if fuelStr: fuelStr += ", " 285 285 fuelStr += "%.0f" % (fuel,)
Note:
See TracChangeset
for help on using the changeset viewer.