Index: src/mlx/acft.py
===================================================================
--- src/mlx/acft.py	(revision 140)
+++ src/mlx/acft.py	(revision 141)
@@ -735,4 +735,8 @@
 #---------------------------------------------------------------------------------------
 
+MostFuelTankAircraft = T134
+
+#---------------------------------------------------------------------------------------
+
 _classes = { const.AIRCRAFT_B736 : B736,
              const.AIRCRAFT_B737 : B737,
Index: src/mlx/const.py
===================================================================
--- src/mlx/const.py	(revision 140)
+++ src/mlx/const.py	(revision 141)
@@ -329,4 +329,35 @@
 #-------------------------------------------------------------------------------
 
+fuelTanks = [ FUELTANK_CENTRE,
+              FUELTANK_LEFT,
+              FUELTANK_RIGHT,
+              FUELTANK_LEFT_AUX,
+              FUELTANK_RIGHT_AUX,
+              FUELTANK_LEFT_TIP,
+              FUELTANK_RIGHT_TIP,
+              FUELTANK_EXTERNAL1,
+              FUELTANK_EXTERNAL2,
+              FUELTANK_CENTRE2 ]
+
+#-------------------------------------------------------------------------------
+
+_fuelTankStrings = { FUELTANK_CENTRE : "centre",
+                     FUELTANK_LEFT : "left",
+                     FUELTANK_RIGHT : "right",
+                     FUELTANK_LEFT_AUX : "left_aux",
+                     FUELTANK_RIGHT_AUX : "right_aux",
+                     FUELTANK_LEFT_TIP : "left_tip",
+                     FUELTANK_RIGHT_TIP : "right_tip",
+                     FUELTANK_EXTERNAL1 : "external1",
+                     FUELTANK_EXTERNAL2 : "external2",
+                     FUELTANK_CENTRE2 : "centre2" }
+
+def fuelTank2string(fuelTank):
+    """Get the string equivalent of the given fuelTank."""
+    return _fuelTankStrings[fuelTank] \
+           if fuelTank in _fuelTankStrings else None    
+
+#-------------------------------------------------------------------------------
+
 # The available gates at LHBP
 lhbpGateNumbers = []
Index: src/mlx/fsuipc.py
===================================================================
--- src/mlx/fsuipc.py	(revision 140)
+++ src/mlx/fsuipc.py	(revision 141)
@@ -528,5 +528,5 @@
     
         self._latin1decoder = codecs.getdecoder("iso-8859-1")
-    
+
     def connect(self, aircraft):
         """Initiate a connection to the simulator."""
@@ -608,4 +608,34 @@
 
         self._handler.requestWrite(data, self._handleMessageSent)
+
+    def getFuel(self, tanks, callback):
+        """Get the fuel from the given tanks.
+
+        The callback will be called with a list of two-tuples, where the tuples
+        have the following items:
+        - the current weight of the fuel in the tank (in kgs)
+        - the current total capacity of the tank (in kgs)."""
+        data = [(0x0af4, "H")]     # Fuel weight
+        for tank in tanks:
+            offset = _tank2offset[tank]
+            data.append( (offset, "u") )     # tank level
+            data.append( (offset+4, "u") )   # tank capacity
+
+        self._handler.requestRead(data, self._handleFuelRetrieved,
+                                  extra = callback)
+
+    def setFuelLevel(self, levels):
+        """Set the fuel level to the given ones.
+
+        levels is an array of two-tuples, where each tuple consists of the
+        following:
+        - the const.FUELTANK_XXX constant denoting the tank that must be set,
+        - the requested level of the fuel as a floating-point value between 0.0
+        and 1.0."""
+        data = []
+        for (tank, level) in levels:
+            offset = _tank2offset[tank]
+            data.append( (offset, "u", long(level * 128.8 * 65536.0)) )
+        self._handler.requestWrite(data, self._handleFuelWritten)
             
     def disconnect(self):
@@ -801,4 +831,19 @@
     def _handleMessageSent(self, success, extra):
         """Callback for a message sending request."""
+        pass
+
+    def _handleFuelRetrieved(self, data, callback):
+        """Callback for a fuel retrieval request."""
+        fuelWeight = data[0] / 256.0
+        result = []
+        for i in range(1, len(data), 2):
+            capacity = data[i+1] * fuelWeight * const.LBSTOKG
+            amount = data[i] * capacity / 128.0 / 65536.0
+            result.append( (amount, capacity) )
+
+        callback(result)
+                                                  
+    def _handleFuelWritten(self, success, extra):
+        """Callback for a fuel setting request."""
         pass
                                                   
Index: src/mlx/gui/flight.py
===================================================================
--- src/mlx/gui/flight.py	(revision 139)
+++ src/mlx/gui/flight.py	(revision 141)
@@ -5,4 +5,5 @@
 import mlx.const as const
 import mlx.fs as fs
+import mlx.acft as acft
 from mlx.checks import PayloadChecker
 import mlx.util as util
@@ -967,5 +968,265 @@
     def _forwardClicked(self, button):
         """Called when the forward button is clicked."""
+        if not self._completed:
+            gui = self._wizard.gui
+            gui.beginBusy(xstr("fuel_get_busy"))
+            
+            gui.simulator.getFuel(gui.flight.aircraft.fuelTanks,
+                                  self._handleFuel)
+        else:
+            self._wizard.nextPage()
+
+    def _handleFuel(self, fuelData):
+        """Callback for the fuel query operation."""
+        gobject.idle_add(self._processFuel, fuelData)
+
+    def _processFuel(self, fuelData):
+        """Process the given fuel data."""
+        self._wizard.gui.endBusy()
+        self._wizard._fuelData = fuelData
         self._wizard.nextPage()
+        
+#-----------------------------------------------------------------------------
+
+class FuelTank(gtk.VBox):
+    """Widget for the fuel tank."""
+    def __init__(self, fuelTank, name, capacity, currentWeight):
+        """Construct the widget for the tank with the given name."""
+        super(FuelTank, self).__init__()
+
+        self.fuelTank = fuelTank
+        self.capacity = capacity
+        self.currentWeight = currentWeight
+        self.expectedWeight = currentWeight
+
+        label = gtk.Label("<b>" + name + "</b>")
+        label.set_use_markup(True)
+        label.set_justify(JUSTIFY_CENTER)
+        label.set_alignment(0.5, 1.0)
+        self.pack_start(label, False, False, 4)
+
+        self._tankFigure = gtk.DrawingArea()
+        self._tankFigure.set_size_request(38, -1)
+
+        if pygobject:
+            self._tankFigure.connect("draw", self._drawTankFigure)
+        else:
+            self._tankFigure.connect("expose_event", self._drawTankFigure)
+
+        alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
+                                  xscale = 0.0, yscale = 1.0)
+        alignment.add(self._tankFigure) 
+
+        self.pack_start(alignment, True, True, 4)
+
+        self._expectedButton = gtk.SpinButton()
+        self._expectedButton.set_numeric(True)
+        self._expectedButton.set_range(0, self.capacity)
+        self._expectedButton.set_increments(10, 100)
+        self._expectedButton.set_value(currentWeight)
+        self._expectedButton.set_alignment(1.0)
+        self._expectedButton.set_width_chars(5)
+        self._expectedButton.connect("value-changed", self._expectedChanged)
+
+        alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
+                                  xscale = 0.0, yscale = 1.0)
+        alignment.add(self._expectedButton) 
+        self.pack_start(alignment, False, False, 4)
+
+    def setCurrent(self, currentWeight):
+        """Set the current weight."""
+        self.currentWeight = currentWeight
+        self._redraw()
+
+    def isCorrect(self):
+        """Determine if the contents of the fuel tank are as expected"""
+        return abs(self.expectedWeight - self.currentWeight)<=1
+
+    def disable(self):
+        """Disable the fuel tank."""
+        self._expectedButton.set_sensitive(False)
+
+    def _redraw(self):
+        """Redraw the tank figure."""
+        self._tankFigure.queue_draw()
+
+    def _drawTankFigure(self, connStateArea, eventOrContext):
+        """Draw the tank figure."""
+        triangleSize = 5
+        
+        context = eventOrContext if pygobject else connStateArea.window.cairo_create()
+
+        width = connStateArea.get_allocated_width() if pygobject \
+                else connStateArea.allocation.width
+        height = connStateArea.get_allocated_height() if pygobject \
+                 else connStateArea.allocation.height
+
+        rectangleX0 = triangleSize
+        rectangleY0 = triangleSize
+        rectangleX1 = width - 1 - triangleSize
+        rectangleY1 = height - 1 - triangleSize
+        rectangleLineWidth = 2.0
+
+        context.set_source_rgb(0.0, 0.0, 0.0)
+        context.set_line_width(rectangleLineWidth)
+        context.rectangle(rectangleX0 + rectangleLineWidth/2,
+                          rectangleY0 + rectangleLineWidth/2,
+                          rectangleX1 - rectangleX0 - rectangleLineWidth,
+                          rectangleY1 - rectangleY0 - rectangleLineWidth)
+        context.stroke()
+
+        rectangleInnerLeft   = rectangleX0 + rectangleLineWidth
+        rectangleInnerRight  = rectangleX1 - rectangleLineWidth
+        rectangleInnerTop    = rectangleY0 + rectangleLineWidth
+        rectangleInnerBottom = rectangleY1 - rectangleLineWidth
+
+        rectangleInnerWidth = rectangleInnerRight - rectangleInnerLeft
+        rectangleInnerHeight = rectangleInnerBottom - rectangleInnerTop
+
+        context.set_source_rgb(1.0, 0.9, 0.6)
+        currentHeight = self.currentWeight * rectangleInnerHeight / self.capacity
+        currentX = rectangleInnerTop + rectangleInnerHeight - currentHeight
+        context.rectangle(rectangleInnerLeft,
+                          rectangleInnerTop + rectangleInnerHeight - currentHeight,
+                          rectangleInnerWidth, currentHeight)
+        context.fill()
+
+        expectedHeight = self.expectedWeight * rectangleInnerHeight / self.capacity
+        expectedY = rectangleInnerTop + rectangleInnerHeight - expectedHeight
+
+        context.set_line_width(1.5)
+        context.set_source_rgb(0.0, 0.85, 0.85)
+        context.move_to(rectangleX0, expectedY)
+        context.line_to(rectangleX1, expectedY)
+        context.stroke()
+
+        context.set_line_width(0.0)
+        context.move_to(0, expectedY - triangleSize)
+        context.line_to(0, expectedY + triangleSize)
+        context.line_to(rectangleX0 + 1, expectedY)
+        context.line_to(0, expectedY - triangleSize)
+        context.fill()
+
+        context.set_line_width(0.0)
+        context.move_to(width, expectedY - triangleSize)
+        context.line_to(width, expectedY + triangleSize)
+        context.line_to(rectangleX1 - 1, expectedY)
+        context.line_to(width, expectedY - triangleSize)
+        context.fill()
+
+    def _expectedChanged(self, spinButton):
+        """Called when the expected value has changed."""
+        self.expectedWeight = spinButton.get_value_as_int()
+        self._redraw()        
+
+#-----------------------------------------------------------------------------
+
+class FuelPage(Page):
+    """The page containing the fuel tank filling."""
+    _pumpStep = 0.02
+    
+    def __init__(self, wizard):
+        """Construct the page."""
+        super(FuelPage, self).__init__(wizard, xstr("fuel_title"),
+                                       xstr("fuel_help"),
+                                       completedHelp = xstr("fuel_chelp"))
+
+        self._fuelTanks = []
+        self._fuelTable = None
+        self._fuelAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
+                                            xscale = 0.0, yscale = 1.0)
+        self.setMainWidget(self._fuelAlignment)
+
+        tanks = acft.MostFuelTankAircraft.fuelTanks
+        tankData = ((2500, 3900),) * len(tanks)
+        self._setupTanks(tanks, tankData)
+
+        self._backButton = self.addPreviousButton(clicked = self._backClicked)
+        self._button = self.addNextButton(clicked = self._forwardClicked)
+
+        self._pumpIndex = 0
+
+    def activate(self):
+        """Activate the page."""
+        gui = self._wizard.gui
+
+        self._setupTanks(gui.flight.aircraft.fuelTanks,
+                         self._wizard._fuelData)
+
+    def finalize(self):
+        """Finalize the page."""
+        for fuelTank in self._fuelTanks:
+            fuelTank.disable()
+
+    def _backClicked(self, button):
+        """Called when the Back button is pressed."""
+        self.goBack()
+        
+    def _forwardClicked(self, button):
+        """Called when the forward button is clicked."""
+        if not self._completed:
+            self._pumpIndex = 0
+            self._wizard.gui.beginBusy(xstr("fuel_pump_busy"))
+            self._pump()
+        else:
+            self._wizard.nextPage()        
+
+    def _setupTanks(self, tanks, tankData):
+        """Setup the tanks for the given data."""
+        numTanks = len(tanks)
+        if self._fuelTable is not None:
+            self._fuelAlignment.remove(self._fuelTable)
+
+        self._fuelTanks = []
+        self._fuelTable = gtk.Table(numTanks, 1)
+        self._fuelTable.set_col_spacings(16)
+        for i in range(0, numTanks):
+            tank = tanks[i]
+            (current, capacity) = tankData[i]
+
+            fuelTank = FuelTank(tank,
+                                xstr("fuel_tank_" +
+                                     const.fuelTank2string(tank)),
+                                capacity, current)
+            self._fuelTable.attach(fuelTank, i, i+1, 0, 1)
+            self._fuelTanks.append(fuelTank)
+            
+        self._fuelAlignment.add(self._fuelTable)
+        self.show_all()
+
+    def _pump(self):
+        """Perform one step of pumping.
+
+        It is checked, if the current tank's contents are of the right
+        quantity. If not, it is filled one step further to the desired
+        contents. Otherwise the next tank is started. If all tanks are are
+        filled, the next page is selected."""
+        numTanks = len(self._fuelTanks)
+
+        fuelTank = None
+        while self._pumpIndex < numTanks:
+            fuelTank = self._fuelTanks[self._pumpIndex]
+            if fuelTank.isCorrect():
+                self._pumpIndex += 1
+                fuelTank = None
+            else:
+                break
+
+        if fuelTank is None:
+            self._wizard.gui.endBusy()
+            self._wizard.nextPage()
+        else:
+            currentLevel = fuelTank.currentWeight / fuelTank.capacity
+            expectedLevel = fuelTank.expectedWeight / fuelTank.capacity
+            if currentLevel<expectedLevel:
+                currentLevel += FuelPage._pumpStep
+                if currentLevel>expectedLevel: currentLevel = expectedLevel
+            else:
+                currentLevel -= FuelPage._pumpStep
+                if currentLevel<expectedLevel: currentLevel = expectedLevel
+            fuelTank.setCurrent(currentLevel * fuelTank.capacity)
+            self._wizard.gui.simulator.setFuelLevel([(fuelTank.fuelTank,
+                                                      currentLevel)])
+            gobject.timeout_add(50, self._pump)
         
 #-----------------------------------------------------------------------------
@@ -974,4 +1235,5 @@
     """The page containing the route and the flight level."""
     def __init__(self, wizard):
+        """Construct the page."""
         super(RoutePage, self).__init__(wizard, xstr("route_title"),
                                         xstr("route_help"),
@@ -2045,4 +2307,5 @@
         self._payloadIndex = len(self._pages)
         self._pages.append(TimePage(self))
+        self._pages.append(FuelPage(self))
         self._routePage = RoutePage(self)
         self._pages.append(self._routePage)
@@ -2242,4 +2505,5 @@
         self._bookedFlight = None
         self._departureGate = "-"
+        self._fuelData = None
         self._departureNOTAMs = None
         self._departureMETAR = None
Index: src/mlx/i18n.py
===================================================================
--- src/mlx/i18n.py	(revision 139)
+++ src/mlx/i18n.py	(revision 141)
@@ -284,4 +284,26 @@
                  "Click here to query the current UTC time from the simulator.")
         self.add("time_busy", "Querying time...")
+
+        self.add("fuel_title", "Fuel")
+        self.add("fuel_help",
+                 "Enter the amount of fuel in kilograms that need to be "
+                 "present in each tank below.\n\n"
+                 "When you press <b>Next</b>, the necessary amount of fuel\n"
+                 "will be pumped into or out of the tanks.")
+        self.add("fuel_chelp",
+                 "The amount of fuel tanked into your aircraft at the\n"
+                 "beginning of the flight can be seen below.")
+        self.add("fuel_tank_centre", "Centre\n")
+        self.add("fuel_tank_left", "Left\n")
+        self.add("fuel_tank_right", "Right\n")
+        self.add("fuel_tank_left_aux", "Left\nAux")
+        self.add("fuel_tank_right_aux", "Right\nAux")
+        self.add("fuel_tank_left_tip", "Left\nTip")
+        self.add("fuel_tank_right_tip", "Right\nTip")
+        self.add("fuel_tank_external1", "External\n1")
+        self.add("fuel_tank_external2", "External\n2")
+        self.add("fuel_tank_centre2", "Centre\n2")
+        self.add("fuel_get_busy", "Querying fuel information...")
+        self.add("fuel_pump_busy", "Pumping fuel...")
 
         self.add("route_title", "Route")
