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

The help text on the Finish page is updated dynamically based on the situation (re #248)

File:
1 edited

Legend:

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

    r605 r607  
    32693269        """Update the sensitivity state of the buttons."""
    32703270        gui = self._wizard.gui
     3271        faultsExplained = gui.faultsFullyExplained
     3272        timesCorrect = self.flightType is None or \
     3273                       not self._tooBigTimeDifference or \
     3274                       gui.hasComments or gui.hasDelayCode
    32713275        sensitive = self._flightType.get_active()>=0 and \
    32723276                    (self._gatesModel.get_iter_first() is None or
    32733277                     self._gate.get_active()>=0) and \
    3274                     (not self._tooBigTimeDifference or
    3275                      gui.hasComments or gui.hasDelayCode) and \
    3276                     gui.faultsFullyExplained
     3278                     faultsExplained and timesCorrect
     3279
     3280        self._updateHelp(faultsExplained, timesCorrect)
    32773281
    32783282        wasSensitive = self._saveButton.get_sensitive()
     
    35113515        self._tooBigTimeDifference = departureError or arrivalError
    35123516
    3513         if self._tooBigTimeDifference and self.flightType is not None:
    3514             self.setHelp(xstr("finish_help") + xstr("finish_help_wrongtime"))
    3515         else:
    3516             self.setHelp(xstr("finish_help") + xstr("finish_help_goodtime"))
    3517 
    35183517        self._depTime.set_markup(self._formatTime(bookedFlight.departureTime,
    35193518                                                  flight.blockTimeStart,
     
    35273526
    35283527        self.updateButtons()
     3528
     3529    def _updateHelp(self, faultsExplained, timesCorrect):
     3530        """Update the help text according to the actual situation."""
     3531        if not faultsExplained:
     3532            self.setHelp(xstr("finish_help") + xstr("finish_help_faults"))
     3533        elif not timesCorrect:
     3534            self.setHelp(xstr("finish_help") + xstr("finish_help_wrongtime"))
     3535        else:
     3536            self.setHelp(xstr("finish_help") + xstr("finish_help_goodtime"))
     3537
    35293538
    35303539#-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.