Ignore:
Timestamp:
03/01/15 16:53:08 (9 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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.