Index: src/mlx/acft.py
===================================================================
--- src/mlx/acft.py	(revision 447)
+++ src/mlx/acft.py	(revision 512)
@@ -32,4 +32,33 @@
 #---------------------------------------------------------------------------------------
 
+# Derate type: no derate possible
+DERATE_NONE = 0
+
+# Derate type: Boeing, i.e. a percentage value.
+# For logging, the percentage value is expected as a string (i.e. whatever the
+# pilot enters into the text field).
+DERATE_BOEING = 1
+
+# Derate type: EPR, i.e. an EPR value.
+# For logging, the EPR value is expected as a string (i.e. whatever the pilot
+# enters into the text field).
+DERATE_EPR = 2
+
+# Derate type: Tupolev, i.e. nominal or takeoff
+# For logging, one of the DERATE_TUPOLEV_xxx values are expected.
+DERATE_TUPOLEV = 3
+
+# Tupolev derate value: nominal
+DERATE_TUPOLEV_NOMINAL = 1
+
+# Tupolev derate value: takeoff
+DERATE_TUPOLEV_TAKEOFF = 2
+
+# Derate type: BAe-146, i.e. enabled or not
+# For logging, a boolean is expected.
+DERATE_B462 = 4
+
+#---------------------------------------------------------------------------------------
+
 class SmoothedValue(object):
     """A smoothed value."""
@@ -203,21 +232,33 @@
 
     @property
-    def derateLabels(self):
-        """Get the strings related to the derate entry.
-
-        It returns a tuple of two items:
-        - the label before the entry field,
-        - the label after the entry field, which can be None.
-
-        If both labels are None, the derate value will not be logged or
-        queried. This is the default."""
-        return (None, None)
-
-    @property
-    def derateTemplate(self):
-        """Get the template for logging the derate value.
-
-        If it returns None (which is the default), no derate value will be
-        logged."""
+    def derateType(self):
+        """Get the derate type for this aircraft.
+
+        This default implementation returns DERATE_NONE."""
+        return DERATE_NONE
+
+    def getDerateLine(self, value):
+        """Get the log line for the given derate value.
+
+        It uses the the derate type and produces the standard message for
+        each. This children need not override it, although they can."""
+        dt = self.derateType
+
+        if dt==DERATE_BOEING:
+            return "Derate calculated by the pilot: %s %%" % \
+              ("-" if value is None else value,)
+        elif dt==DERATE_EPR:
+            return "EPR calculated by the pilot: %s" % \
+              ("-" if value is None else value,)
+        elif dt==DERATE_TUPOLEV:
+            return "Thrust setting calculated by the pilot: %s" % \
+              ("-" if value is None else
+               "nominal" if value==DERATE_TUPOLEV_NOMINAL else "takeoff",)
+        elif dt==DERATE_B462:
+            return "Derate setting: %s" % \
+              ("-" if value is None else "enabled" if value else "disabled",)
+        elif dt!=DERATE_NONE:
+            print "mlx.acft.getDerateLine: invalid derate type: " + dt
+
         return None
 
@@ -472,17 +513,17 @@
         """Log the derate values either newly or by updating the corresponding
         line."""
-        derateTemplate = self.derateTemplate
-        if derateTemplate is None:
+        dt = self.derateType
+        if dt==DERATE_NONE:
             return
 
-        derate = self._flight.derate
-        message = derateTemplate % ("-" if derate is None else derate)
-        if self._derateLineID is None:
-            if state is None:
-                state = self._aircraftState
-            self._derateLineID = \
-                self.logger.message(state.timestamp, message)
-        else:
-            self.logger.updateLine(self._derateLineID, message)
+        message = self.getDerateLine(self._flight.derate)
+        if message is not None:
+            if self._derateLineID is None:
+                if state is None:
+                    state = self._aircraftState
+                self._derateLineID = \
+                  self.logger.message(state.timestamp, message)
+            else:
+                self.logger.updateLine(self._derateLineID, message)
 
     def _logTakeoffAntiIce(self, state = None):
@@ -607,12 +648,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return (xstr("takeoff_derate_boeing"), "%")
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "Derate calculated by the pilot: %s %%"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_BOEING
 
     # def _appendSpeedChecker(self):
@@ -741,12 +777,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return (xstr("takeoff_derate_boeing"), "%")
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "Derate calculated by the pilot: %s %%"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_BOEING
 
 #---------------------------------------------------------------------------------------
@@ -819,12 +850,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return ("EPR", None)
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "EPR calculated by the pilot: %s"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_EPR
 
 #---------------------------------------------------------------------------------------
@@ -881,12 +907,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return (xstr("takeoff_derate_tupolev"), None)
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "Nominal/takeoff power calculated by the pilot: %s"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_TUPOLEV
 
     @property
@@ -939,12 +960,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return (xstr("takeoff_derate_tupolev"), None)
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "Nominal/takeoff power calculated by the pilot: %s"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_TUPOLEV
 
     def _appendLightsLoggers(self):
@@ -990,12 +1006,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return (xstr("takeoff_derate_tupolev"), None)
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "Nominal/takeoff power calculated by the pilot: %s"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_TUPOLEV
 
     def _appendLightsLoggers(self):
@@ -1038,12 +1049,7 @@
 
     @property
-    def derateLabels(self):
-        """Get the derate strings for this type."""
-        return (xstr("takeoff_derate_b462"), None)
-
-    @property
-    def derateTemplate(self):
-        """Get the derate template for this aicraft type."""
-        return "Derate enabled: %s"
+    def derateType(self):
+        """Get the derate type for this type."""
+        return DERATE_B462
 
 #---------------------------------------------------------------------------------------
