Changeset 1139:9754005a7e70 for src/mlx


Ignore:
Timestamp:
04/21/24 08:49:36 (7 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

The number of infants does not count towards the total number of passengers, but cannot be more than the number of adults (re #386)

File:
1 edited

Legend:

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

    r1120 r1139  
    27052705        changed."""
    27062706        bookedFlight = self._wizard._bookedFlight
    2707         numPassengers = \
    2708             self._numPassengers.get_int() + \
    2709             self._numChildren.get_int() + \
    2710             self._numInfants.get_int()
    2711         minCabinCrew = 0 if numPassengers==0 else \
     2707        numPassengers = self._numPassengers.get_int()
     2708        numSeatsOccupied = numPassengers + self._numChildren.get_int()
     2709        minCabinCrew = 0 if numSeatsOccupied==0 else \
    27122710            (bookedFlight.maxPassengers // 50) + 1
    27132711
     
    27242722        self._crewLabel.set_use_underline(True)
    27252723
    2726         tooManyPassengers = numPassengers>bookedFlight.maxPassengers
    2727         if tooManyPassengers:
     2724        tooManyPassengers = numSeatsOccupied>bookedFlight.maxPassengers
     2725        tooManyInfants = self._numInfants.get_int() > numPassengers
     2726        if tooManyPassengers or tooManyInfants:
    27282727            self._paxLabel.set_markup("<b><span foreground=\"red\">" +
    27292728                                      xstr("payload_pax") +
    27302729                                      "</span></b>")
    2731             extraHelp.append(xstr("payload_help_many_pax") % (bookedFlight.maxPassengers,))
    27322730        else:
    27332731            self._paxLabel.set_text(xstr("payload_pax"))
     2732
     2733        if tooManyPassengers:
     2734            extraHelp.append(xstr("payload_help_many_pax") %
     2735                             (bookedFlight.maxPassengers,))
     2736        elif tooManyInfants:
     2737            extraHelp.append(xstr("payload_help_many_infants") %
     2738                             (numPassengers,))
     2739
    27342740        self._paxLabel.set_use_underline(True)
    27352741
     
    27402746        self.setHelp(hlp)
    27412747
    2742         self._button.set_sensitive(enoughCrew and not tooManyPassengers)
    2743 
     2748        self._button.set_sensitive(enoughCrew and not tooManyPassengers and
     2749                                   not tooManyInfants)
    27442750
    27452751        self._updateCalculatedZFW()
Note: See TracChangeset for help on using the changeset viewer.