Ignore:
Timestamp:
03/14/22 09:58:58 (3 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Updated the flight type handling (re #357)

Location:
src/mlx/gui
Files:
3 edited

Legend:

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

    r1033 r1034  
    23292329        self._bagWeight.set_sensitive(True)
    23302330
    2331         if bookedFlight.flightType==BookedFlight.FLIGHT_TYPE_CHARTER:
     2331        if bookedFlight.flightType==const.FLIGHTTYPE_CHARTER:
    23322332            self._cargoWeight.set_int(0)
    23332333            self._cargoWeight.set_sensitive(False)
     
    23652365        zfw += self._numPassengers.get_int() * \
    23662366            (const.WEIGHT_PASSENGER_CHARTER
    2367              if bookedFlight.flightType==BookedFlight.FLIGHT_TYPE_CHARTER
     2367             if bookedFlight.flightType==const.FLIGHTTYPE_CHARTER
    23682368             else const.WEIGHT_PASSENGER)
    23692369        zfw += self._numChildren.get_int() * const.WEIGHT_CHILD
     
    51075107        table.attach(labelAlignment, 0, 1, row, row+1)
    51085108
    5109         self._flightType = createFlightTypeComboBox()
    5110         self._flightType.set_tooltip_text(xstr("finish_type_tooltip"))
    5111         self._flightType.set_active(0)
    5112         self._flightType.connect("changed", self._flightTypeChanged)
    5113         flightTypeAlignment = Gtk.Alignment(xalign=0.0, xscale=0.0)
    5114         flightTypeAlignment.add(self._flightType)
    5115         table.attach(flightTypeAlignment, 1, 2, row, row+1)
    5116         label.set_mnemonic_widget(self._flightType)
    5117 
    5118         row += 1
    5119 
    51205109        self._onlineFlight = Gtk.CheckButton(xstr("finish_online"))
    51215110        self._onlineFlight.set_use_underline(True)
     
    51785167
    51795168    @property
    5180     def flightType(self):
    5181         """Get the flight type."""
    5182         index = self._flightType.get_active()
    5183         return None if index<0 else self._flightType.get_model()[index][1]
    5184 
    5185     @property
    51865169    def online(self):
    51875170        """Get whether the flight was an online flight or not."""
     
    52155198                                  (flight.startFuel - flight.endFuel,))
    52165199
    5217         self._flightType.set_active(-1)
    52185200        self._onlineFlight.set_active(self._wizard.loggedIn)
    52195201
     
    52405222        gui = self._wizard.gui
    52415223        faultsExplained = gui.faultsFullyExplained
    5242         timesCorrect = self.flightType is None or \
    5243                        not self._tooBigTimeDifference or \
     5224        timesCorrect = not self._tooBigTimeDifference or \
    52445225                       gui.hasComments or gui.hasDelayCode
    52455226        sensitive = gui.flight is not None and \
    52465227                    gui.flight.stage==const.STAGE_END and \
    5247                     self._flightType.get_active()>=0 and \
    52485228                    (self._gatesModel.get_iter_first() is None or
    52495229                     self._gate.get_active()>=0) and \
     
    52815261        """Called when the Back button is pressed."""
    52825262        self.goBack()
    5283 
    5284     def _flightTypeChanged(self, comboBox):
    5285         """Called when the flight type has changed."""
    5286         self._updateTimes()
    52875263
    52885264    def _gateChanged(self, comboBox):
     
    53745350        (arrivalWarning, arrivalError) = flight.blockTimeEndWrong
    53755351
    5376         if self.flightType==const.FLIGHTTYPE_VIP:
     5352        if bookedFlight.flightType==const.FLIGHTTYPE_VIP:
    53775353            departureError = arrivalError = False
    53785354
    5379         self._tooBigTimeDifference = departureError or arrivalError
     5355        self._tooBigTimeDifference = departureError and arrivalError
    53805356
    53815357        self._depTime.set_markup(self._formatTime(bookedFlight.departureTime,
  • src/mlx/gui/pirep.py

    r1033 r1034  
    387387        self._flownMailWeight.set_text("%.0f" % (pirep.mailWeight,))
    388388        self._flightType.set_text(xstr("flighttype_" +
    389                                        flightType2string(pirep.flightType)))
     389                                       flightType2string(pirep.bookedFlight.flightType)))
    390390        self._online.set_text(xstr("pirepView_" +
    391391                                   ("yes" if pirep.online else "no")))
     
    956956        self._flownCargoWeight.set_value(pirep.cargoWeight)
    957957        self._flownMailWeight.set_value(pirep.mailWeight)
    958         self._flightType.set_active(flightType2index(pirep.flightType))
     958        self._flightType.set_text(xstr("flighttype_" +
     959                                       flightType2string(pirep.bookedFlight.flightType)))
    959960        self._online.set_active(pirep.online)
    960961
     
    14441445        self._flownMailWeight.set_tooltip_text(xstr("payload_mail_tooltip"))
    14451446
    1446         self._flightType = createFlightTypeComboBox()
     1447        self._flightType = PIREPViewer.getDataLabel(width = 3)
    14471448        PIREPEditor.tableAttachWidget(table, 0, 2,
    14481449                                      xstr("pirepView_flightType"),
    14491450                                      self._flightType)
    1450         self._flightType.connect("changed", self._updateButtons)
    1451         self._flightType.set_tooltip_text(xstr("pirepEdit_flight_type_tooltip"))
    14521451
    14531452        self._online = Gtk.CheckButton(xstr("pirepEdit_online"))
     
    16081607        pirep.mailWeight = self._flownMailWeight.get_value()
    16091608
    1610         pirep.flightType = flightTypes[self._flightType.get_active()]
    16111609        pirep.online = self._online.get_active()
    16121610
  • src/mlx/gui/weighthelp.py

    r1033 r1034  
    44from mlx.i18n import xstr
    55from mlx.checks import PayloadChecker
    6 from mlx.rpc import BookedFlight
    76
    87import mlx.const as const
     
    441440            return self._pax * \
    442441                (const.WEIGHT_PASSENGER_CHARTER
    443                  if self._flightType==BookedFlight.FLIGHT_TYPE_CHARTER
     442                 if self._flightType==const.FLIGHTTYPE_CHARTER
    444443                 else const.WEIGHT_PASSENGER) + \
    445444                self._children * const.WEIGHT_CHILD + \
Note: See TracChangeset for help on using the changeset viewer.