Index: src/mlx/gui/flight.py
===================================================================
--- src/mlx/gui/flight.py	(revision 753)
+++ src/mlx/gui/flight.py	(revision 754)
@@ -62,5 +62,5 @@
 class Page(gtk.Alignment):
     """A page in the flight wizard."""
-    def __init__(self, wizard, title, help, completedHelp = None):
+    def __init__(self, wizard, id, title, help, completedHelp = None):
         """Construct the page."""
         super(Page, self).__init__(xalign = 0.0, yalign = 0.0,
@@ -140,4 +140,6 @@
 
         self._wizard = wizard
+        self._id = id
+        self._nextPageID = None
 
         self._cancelFlightButton = None
@@ -145,4 +147,19 @@
         self._completed = False
         self._fromPage = None
+
+    @property
+    def id(self):
+        """Get the identifier of the page."""
+        return self._id
+
+    @property
+    def nextPageID(self):
+        """Get the identifier of the next page, if set."""
+        return self._nextPageID
+
+    @nextPageID.setter
+    def nextPageID(self, nextPageID):
+        """Set the identifier of the next page."""
+        self._nextPageID = nextPageID
 
     def setMainWidget(self, widget):
@@ -278,6 +295,6 @@
     def __init__(self, wizard):
         """Construct the login page."""
-        super(LoginPage, self).__init__(wizard, xstr("login"),
-                                        xstr("loginHelp"))
+        super(LoginPage, self).__init__(wizard, "login",
+                                        xstr("login"), xstr("loginHelp"))
 
         alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
@@ -393,5 +410,5 @@
     def _registerClicked(self, button):
         """Called when the Register button was clicked."""
-        self._wizard.jumpPage(3)
+        self._wizard.jumpPage("register")
 
     def _offlineClicked(self, button):
@@ -432,5 +449,6 @@
         help = xstr("flightsel_help")
         completedHelp = xstr("flightsel_chelp")
-        super(FlightSelectionPage, self).__init__(wizard, xstr("flightsel_title"),
+        super(FlightSelectionPage, self).__init__(wizard, "flightsel",
+                                                  xstr("flightsel_title"),
                                                   help, completedHelp = completedHelp)
 
@@ -612,5 +630,5 @@
         """Called when the forward button was clicked."""
         if self._completed:
-            self._wizard.jumpPage(self._nextDistance, finalize = False)
+            self._wizard.jumpPage(self._nextID, finalize = False)
         else:
             self._flightSelected()
@@ -667,30 +685,30 @@
                                          const.PLANE_AWAY)
         else:
-            self._nextDistance = 4
-            self._wizard.jumpPage(4)
+            self._nextID = "connect"
+            self._wizard.jumpPage("connect")
 
     def _fleetRetrieved(self, fleet):
         """Called when the fleet has been retrieved."""
         if fleet is None:
-            self._nextDistance = 4
-            self._wizard.jumpPage(4)
+            self._nextID = "connect"
+            self._wizard.jumpPage("connect")
         else:
             plane = fleet[self._wizard._bookedFlight.tailNumber]
             if plane is None:
-                self._nextDistance = 4
-                self._wizard.jumpPage(4)
+                self._nextID = "connect"
+                self._wizard.jumpPage("connect")
             elif plane.gateNumber is not None and \
                  not fleet.isGateConflicting(plane):
                 self._wizard._departureGate = plane.gateNumber
-                self._nextDistance = 4
-                self._wizard.jumpPage(4)
+                self._nextID = "connect"
+                self._wizard.jumpPage("connect")
             else:
-                self._nextDistance = 1
-                self._wizard.nextPage()
+                self._nextID = "gatesel"
+                self._wizard.jumpPage("gatesel")
 
     def _planeUpdated(self, success):
         """Callback for the plane updating."""
-        self._nextDistance = 4
-        self._wizard.jumpPage(4)
+        self._nextID = "connect"
+        self._wizard.jumpPage("connect")
 
     def _getSaveDialog(self):
@@ -795,5 +813,6 @@
     def __init__(self, wizard):
         """Construct the gate selection page."""
-        super(GateSelectionPage, self).__init__(wizard, xstr("gatesel_title"),
+        super(GateSelectionPage, self).__init__(wizard, "gatesel",
+                                                xstr("gatesel_title"),
                                                 xstr("gatesel_help"))
 
@@ -858,5 +877,5 @@
             self._gateSelected()
         else:
-            self._wizard.jumpPage(3)
+            self._wizard.jumpPage("connect")
 
     def _rowActivated(self, flightList, path, column):
@@ -880,5 +899,5 @@
         """Callback for the plane updating call."""
         if success is None or success:
-            self._wizard.jumpPage(3)
+            self._wizard.jumpPage("connect")
         else:
             dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
@@ -896,5 +915,5 @@
         """Called when the fleet has been retrieved."""
         if fleet is None:
-            self._wizard.jumpPage(3)
+            self._wizard.jumpPage("connect")
         else:
             self.activate()
@@ -916,5 +935,6 @@
     def __init__(self, wizard):
         """Construct the registration page."""
-        super(RegisterPage, self).__init__(wizard, xstr("register_title"),
+        super(RegisterPage, self).__init__(wizard, "register",
+                                           xstr("register_title"),
                                            xstr("register_help"))
 
@@ -1170,5 +1190,6 @@
     def __init__(self, wizard):
         """Construct the student page."""
-        super(StudentPage, self).__init__(wizard, xstr("student_title"),
+        super(StudentPage, self).__init__(wizard, "student",
+                                          xstr("student_title"),
                                           xstr("student_help"))
 
@@ -1183,5 +1204,6 @@
                "Then press the Connect button to connect to the simulator."
         completedHelp = "The basic data of your flight can be read below."
-        super(ConnectPage, self).__init__(wizard, xstr("connect_title"),
+        super(ConnectPage, self).__init__(wizard, "connect",
+                                          xstr("connect_title"),
                                           xstr("connect_help"),
                                           completedHelp = xstr("connect_chelp"))
@@ -1366,5 +1388,6 @@
     def __init__(self, wizard):
         """Construct the page."""
-        super(PayloadPage, self).__init__(wizard, xstr("payload_title"),
+        super(PayloadPage, self).__init__(wizard, "payload",
+                                          xstr("payload_title"),
                                           xstr("payload_help"),
                                           completedHelp = xstr("payload_chelp"))
@@ -1593,5 +1616,6 @@
     current time from the flight simulator."""
     def __init__(self, wizard):
-        super(TimePage, self).__init__(wizard, xstr("time_title"),
+        super(TimePage, self).__init__(wizard, "time",
+                                       xstr("time_title"),
                                        xstr("time_help"),
                                        completedHelp = xstr("time_chelp"))
@@ -1714,5 +1738,6 @@
     def __init__(self, wizard):
         """Construct the page."""
-        super(RoutePage, self).__init__(wizard, xstr("route_title"),
+        super(RoutePage, self).__init__(wizard, "route",
+                                        xstr("route_title"),
                                         xstr("route_help"),
                                         completedHelp = xstr("route_chelp"))
@@ -1882,8 +1907,8 @@
         if self._wizard.gui.config.useSimBrief and \
            self._wizard.usingSimBrief is not False:
-            self._wizard.nextPage()
+            self._wizard.jumpPage("simbrief_setup")
         else:
             self._wizard.usingSimBrief = False
-            self._wizard.jumpPage(3)
+            self._wizard.jumpPage("fuel")
 
 #-----------------------------------------------------------------------------
@@ -2044,5 +2069,5 @@
         """Construct the setup page."""
 
-        super(SimBriefSetupPage, self).__init__(wizard,
+        super(SimBriefSetupPage, self).__init__(wizard, "simbrief_setup",
                                                 xstr("simbrief_setup_title"),
                                                 xstr("simbrief_setup_help"),
@@ -2363,5 +2388,5 @@
 
                 self._wizard.usingSimBrief = False
-                self._wizard.jumpPage(2, fromPageShift = 1)
+                self._wizard.jumpPage("fuel", fromPageShift = 1)
 
     def _getPlan(self):
@@ -2448,5 +2473,5 @@
         """Construct the setup page."""
 
-        super(SimBriefingPage, self).__init__(wizard,
+        super(SimBriefingPage, self).__init__(wizard, "simbrief_result",
                                               xstr("simbrief_result_title"), "")
 
@@ -2704,5 +2729,6 @@
     def __init__(self, wizard):
         """Construct the page."""
-        super(FuelPage, self).__init__(wizard, xstr("fuel_title"),
+        super(FuelPage, self).__init__(wizard, "fuel",
+                                       xstr("fuel_title"),
                                        xstr("fuel_help_pre") +
                                        xstr("fuel_help_post"),
@@ -2756,7 +2782,7 @@
             self._pump()
         elif self._wizard.usingSimBrief:
-            self._wizard.jumpPage(3)
+            self._wizard.jumpPage("takeoff")
         else:
-            self._wizard.nextPage()
+            self._wizard.jumpPage("briefing1")
 
     def _setupTanks(self, tankData):
@@ -2804,5 +2830,5 @@
             if self._wizard.usingSimBrief:
                 self._wizard.gui.startMonitoring()
-                self._wizard.jumpPage(3)
+                self._wizard.jumpPage("takeoff")
             else:
                 bookedFlight = self._wizard._bookedFlight
@@ -2873,9 +2899,13 @@
         self._departure = departure
 
-        title = xstr("briefing_title") % (1 if departure else 2,
+        number = 1 if departure else 2
+
+        title = xstr("briefing_title") % (number,
                                           xstr("briefing_departure")
                                           if departure
                                           else xstr("briefing_arrival"))
-        super(BriefingPage, self).__init__(wizard, title, xstr("briefing_help"),
+        super(BriefingPage, self).__init__(wizard,
+                                           "briefing%d" % (number,),
+                                           title, xstr("briefing_help"),
                                            completedHelp = xstr("briefing_chelp"))
 
@@ -3064,5 +3094,6 @@
     def __init__(self, wizard):
         """Construct the takeoff page."""
-        super(TakeoffPage, self).__init__(wizard, xstr("takeoff_title"),
+        super(TakeoffPage, self).__init__(wizard, "takeoff",
+                                          xstr("takeoff_title"),
                                           xstr("takeoff_help"),
                                           completedHelp = xstr("takeoff_chelp"))
@@ -3552,5 +3583,6 @@
     def __init__(self, wizard):
         """Construct the page."""
-        super(CruisePage, self).__init__(wizard, xstr("cruise_title"),
+        super(CruisePage, self).__init__(wizard, "cruise",
+                                         xstr("cruise_title"),
                                          xstr("cruise_help"))
 
@@ -3666,5 +3698,6 @@
     def __init__(self, wizard):
         """Construct the landing page."""
-        super(LandingPage, self).__init__(wizard, xstr("landing_title"),
+        super(LandingPage, self).__init__(wizard, "landing",
+                                          xstr("landing_title"),
                                           xstr("landing_help"),
                                           completedHelp = xstr("landing_chelp"))
@@ -3980,5 +4013,6 @@
         """Construct the finish page."""
         help = xstr("finish_help") + xstr("finish_help_goodtime")
-        super(FinishPage, self).__init__(wizard, xstr("finish_title"), help)
+        super(FinishPage, self).__init__(wizard, "finish",
+                                         xstr("finish_title"), help)
 
         alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
@@ -4835,9 +4869,14 @@
     def nextPage(self, finalize = True):
         """Go to the next page."""
-        self.jumpPage(1, finalize)
-
-    def jumpPage(self, count, finalize = True, fromPageShift = None):
+        nextPageID = self._pages[self._currentPage].nextPageID
+        self.jumpPage(1 if nextPageID is None else nextPageID, finalize)
+
+    def jumpPage(self, countOrID, finalize = True, fromPageShift = None):
         """Go to the page which is 'count' pages after the current one."""
-        self.setCurrentPage(self._currentPage + count,
+        if isinstance(countOrID, str):
+            targetIndex = self._getIndexOf(countOrID)
+        else:
+            targetIndex = self._currentPage + countOrID
+        self.setCurrentPage(targetIndex,
                             finalize = finalize, fromPageShift = fromPageShift)
 
@@ -5071,3 +5110,13 @@
                 self._arrivalBriefingPage.setMETAR(metar)
 
+    def _getIndexOf(self, pageID):
+        """Get the index for the given page ID.
+
+        It is an assertion failure if the ID is not found."""
+        for index in range(0, len(self._pages)):
+            page = self._pages[index]
+            if page.id==pageID:
+                return index
+        assert False
+
 #-----------------------------------------------------------------------------
