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

Added a new widget to list the faults and provide space for the user to enter an explanation (re #248).

Location:
src/mlx/gui
Files:
1 added
3 edited

Legend:

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

    r575 r604  
    5757    DIALOG_MODAL = gtk.DIALOG_MODAL
    5858    WRAP_WORD = gtk.WRAP_WORD
     59
    5960    JUSTIFY_CENTER = gtk.JUSTIFY_CENTER
     61    JUSTIFY_LEFT = gtk.JUSTIFY_LEFT
    6062
    6163    CONTROL_MASK = gdk.CONTROL_MASK
     
    7880
    7981    POLICY_AUTOMATIC = gtk.POLICY_AUTOMATIC
     82    POLICY_NEVER = gtk.POLICY_NEVER
     83    POLICY_ALWAYS = gtk.POLICY_ALWAYS
    8084
    8185    WEIGHT_NORMAL = pango.WEIGHT_NORMAL
     
    131135    WRAP_WORD = gtk.WrapMode.WORD
    132136    JUSTIFY_CENTER = gtk.Justification.CENTER
     137    JUSTIFY_LEFT = gtk.Justification.LEFT
    133138
    134139    CONTROL_MASK = gdk.ModifierType.CONTROL_MASK
     
    151156
    152157    POLICY_AUTOMATIC = gtk.PolicyType.AUTOMATIC
     158    POLICY_NEVER = gtk.PolicyType.NEVER
     159    POLICY_ALWAYS = gtk.PolicyType.ALWAYS
    153160
    154161    WEIGHT_NORMAL = pango.Weight.NORMAL
  • src/mlx/gui/gui.py

    r555 r604  
    396396    def flightDefects(self):
    397397        """Get the flight defects."""
    398         return self._flightInfo.flightDefects
     398        return self._flightInfo.faultsAndExplanations
    399399
    400400    @property
     
    585585        """Remove the flight log line with the given index."""
    586586        gobject.idle_add(self._removeFlightLogLine, index)
     587
     588    def addFault(self, id, timestampString, text):
     589        """Add a fault to the list of faults."""
     590        faultText = formatFlightLogLine(timestampString, text).strip()
     591        self._flightInfo.addFault(id, faultText)
     592
     593    def updateFault(self, id, timestampString, text):
     594        """Update a fault in the list of faults."""
     595        faultText = formatFlightLogLine(timestampString, text).strip()
     596        self._flightInfo.updateFault(id, faultText)
     597
     598    def clearFault(self, id):
     599        """Clear a fault in the list of faults."""
     600        self._flightInfo.clearFault(id)
    587601
    588602    def _removeFlightLogLine(self, index):
  • src/mlx/gui/info.py

    r555 r604  
    33
    44from mlx.gui.delaycodes import DelayCodeTable
     5from mlx.gui.faultexplain import FaultExplainWidget
    56
    67from mlx.i18n import xstr
     
    1415#
    1516# This module implements to \ref FlightInfo class, which is the widget for the
    16 # extra information related to the flight. It contains text areas for the
    17 # comments and the flight defects at the top next to each other, and the frame
    18 # for the delay codes at the bottom in the centre.
     17# extra information related to the flight. It contains a text area for the
     18# comments, the fault list widget, and the frame for the delay codes at the
     19# bottom in the centre.
    1920
    2021#------------------------------------------------------------------------------
     
    6162                                                xscale = 1.0, yscale = 1.0)
    6263        commentsBox = gtk.HBox()
     64        commentsBox.set_homogeneous(True)
    6365
    6466        (frame, self._comments) = FlightInfo._createCommentArea(xstr("info_comments"))
     
    6668        self._comments.get_buffer().connect("changed", self._commentsChanged)
    6769
    68         (frame, self._flightDefects) = \
    69              FlightInfo._createCommentArea(xstr("info_defects"))
    70         commentsBox.pack_start(frame, True, True, 8)
     70        self._faultExplainWidget = FaultExplainWidget()
     71        commentsBox.pack_start(self._faultExplainWidget, True, True, 8)
    7172
    7273        self._commentsAlignment.add(commentsBox)
     
    113114
    114115    @property
    115     def flightDefects(self):
    116         """Get the flight defects."""
    117         buffer = self._flightDefects.get_buffer()
    118         return text2unicode(buffer.get_text(buffer.get_start_iter(),
    119                                             buffer.get_end_iter(), True))
     116    def faultsAndExplanations(self):
     117        """Get the faults and explanations as HTML."""
     118        return self._faultExplainWidget.html
    120119
    121120    @property
     
    129128        return self._delayCodeTable.hasDelayCode
    130129
     130    def addFault(self, id, faultText):
     131        """Add a fault to the list of faults."""
     132        self._faultExplainWidget.addFault(id, faultText)
     133
     134    def updateFault(self, id, faultText):
     135        """Update a fault to the list of faults."""
     136        self._faultExplainWidget.updateFault(id, faultText)
     137
     138    def clearFault(self, id):
     139        """Clear a fault to the list of faults."""
     140        self._faultExplainWidget.clearFault(id)
     141
    131142    def enable(self, aircraftType):
    132143        """Enable the flight info tab."""
    133144        self._comments.set_sensitive(True)
    134         self._flightDefects.set_sensitive(True)
     145        self._faultExplainWidget.set_sensitive(True)
    135146        self._delayCodeTable.setType(aircraftType)
    136147        self._delayWindow.set_sensitive(True)
     
    140151        """Enable the flight info tab."""
    141152        self._comments.set_sensitive(False)
    142         self._flightDefects.set_sensitive(False)
     153        self._faultExplainWidget.set_sensitive(False)
    143154        self._delayWindow.set_sensitive(False)
    144155        self._delayCodeTable.setStyle()
     
    147158        """Reset the flight info tab."""
    148159        self._comments.get_buffer().set_text("")
    149         self._flightDefects.get_buffer().set_text("")
     160        self._faultExplainWidget.reset()
    150161        self._delayCodeTable.reset()
    151162
Note: See TracChangeset for help on using the changeset viewer.