Changeset 908:fcf3c44650f1 for src/mlx


Ignore:
Timestamp:
05/21/18 14:15:25 (7 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Basic functions work with the new website (re #332)

Location:
src/mlx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/common.py

    r800 r908  
    1818#---------------------------------------------------------------------------------------
    1919
    20 MAVA_BASE_URL = os.environ.get("MAVA_BASE_URL", "http://virtualairlines.hu")
     20#MAVA_BASE_URL = os.environ.get("MAVA_BASE_URL", "http://virtualairlines.hu")
     21MAVA_BASE_URL = os.environ.get("MAVA_BASE_URL", "http://oldmava.mavasystems.hu")
    2122
    2223#-------------------------------------------------------------------------------
  • src/mlx/gui/flight.py

    r899 r908  
    22752275        aircraft = self._wizard.gui._flight.aircraft
    22762276
    2277         numCrew = bookedFlight.numCrew
    2278         numCockpitCrew = min(numCrew, aircraft.dowCockpit)
    2279         numCabinCrew = numCrew - numCockpitCrew
     2277        numCockpitCrew = bookedFlight.numCockpitCrew
     2278        numCabinCrew = bookedFlight.numCabinCrew
     2279        numCrew = numCockpitCrew + numCabinCrew
    22802280
    22812281        self._numCockpitCrew.set_int(numCockpitCrew)
  • src/mlx/pirep.py

    r856 r908  
    136136        self.bookedFlight = flight.bookedFlight
    137137
     138        self.numCockpitCrew = flight.numCockpitCrew
     139        self.numCabinCrew = flight.numCabinCrew
    138140        self.numCrew = flight.numCrew
    139141        self.numPassengers = flight.numPassengers
     
    182184        self.bookedFlight = bookedFlight
    183185
    184         self.numCrew = int(pirepData["numCrew"])
     186        self.numCockpitCrew = int(pirepData["numCockpitCrew"])
     187        self.numCabinCrew = int(pirepData["numCabinCrew"])
     188        self.numCrew = self.numCockpitCrew + self.numCabinCrew
    185189        self.numPassengers = int(pirepData["numPassengers"])
    186190        self.bagWeight = int(pirepData["bagWeight"])
     
    381385        attrs["arrivalICAO"] = self.bookedFlight.arrivalICAO
    382386        attrs["numPassengers"] = self.numPassengers
     387        attrs["numCockpitCrew"] = self.numCockpitCrew
     388        attrs["numCabinCrew"] = self.numCabinCrew
    383389        attrs["numCrew"] = self.numCrew
    384390        attrs["cargoWeight"] = self.cargoWeight
  • src/mlx/rpc.py

    r898 r908  
    236236    def _decodeAircraftType(typeCode):
    237237        """Decode the aircraft type from the given typeCode."""
    238         if typeCode in BookedFlight.TYPECODE2TYPE:
    239             return BookedFlight.TYPECODE2TYPE[typeCode]
     238        if typeCode in const.icao2Type:
     239            return const.icao2Type[typeCode]
    240240        else:
    241241            raise Exception("Invalid aircraft type code: '" + typeCode + "'")
     
    277277    _instructions = {
    278278        "numPassengers" : int,
    279         "numCrew" : int,
     279        "numCockpitCrew" : int,
     280        "numCabinCrew" : int,
    280281        "bagWeight" : int,
    281282        "cargoWeight" : int,
     
    309310        print >> f, "tail_nr=%s" % (self.tailNumber,)
    310311        print >> f, "passenger=%d" % (self.numPassengers,)
    311         print >> f, "crew=%d" % (self.numCrew,)
     312        print >> f, "crew=%d" % (self.numCockpitrew + self.numCabinCrew,)
    312313        print >> f, "bag=%d" % (self.bagWeight,)
    313314        print >> f, "cargo=%d" % (self.cargoWeight,)
     
    518519            self._sessionID = reply.value["sessionID"]
    519520
    520             types = [BookedFlight.TYPECODE2TYPE[typeCode]
     521            types = [const.icao2Type[typeCode]
    521522                     for typeCode in reply.value["typeCodes"]]
    522523
     
    626627        of type codes, if any."""
    627628        typeCodes = None if types is None else \
    628             [BookedFlight.TYPE2TYPECODE[type] for type in types]
     629          [const.icaoCodes[type] for type in types]
    629630
    630631        values = self._performCall(lambda sessionID:
  • src/mlx/web.py

    r898 r908  
    130130
    131131        flight.numPassengers = 0
     132        flight.numCockpitCrew = 2
     133        flight.numCabinCrew = 2
    132134        flight.numCrew = 2
    133135        flight.bagWeight = 0
     
    248250                                                            arrivalTime)
    249251
     252        self.numCockpitCrew = self.numCrew
     253        self.numCabinCrew = 0
     254
    250255        d = dir(self)
    251256        for attribute in ["callsign", "departureICAO", "arrivalICAO",
    252                           "aircraftType", "tailNumber",
    253                           "numPassengers", "numCrew",
     257                          "aircraftType", "tailNumber", "numPassengers",
     258                          "numCrew", "numCockpitCrew", "numCabinCrew",
    254259                          "bagWeight", "cargoWeight", "mailWeight",
    255260                          "route", "departureTime", "arrivalTime"]:
     
    281286
    282287        self.aircraftType = \
    283           self._decodeAircraftType(bookedFlightData["aircraftType"])
     288          self._decodeAircraftICAOType(bookedFlightData["aircraftType"])
    284289        self.tailNumber = bookedFlightData["tailNumber"]
    285290        self.numPassengers = int(bookedFlightData["numPassengers"])
    286         self.numCrew = int(bookedFlightData["numCrew"])
     291        self.numCockpitCrew = int(bookedFlightData["numCockpitCrew"])
     292        self.numCabinCrew = int(bookedFlightData["numCabinCrew"])
     293        self.numCrew = self.numCockpitCrew + self.numCabinCrew
    287294        self.bagWeight = int(bookedFlightData["bagWeight"])
    288295        self.cargoWeight = int(bookedFlightData["cargoWeight"])
     
    326333        if typeCode in self.TYPECODE2TYPE:
    327334            return self.TYPECODE2TYPE[typeCode]
     335        else:
     336            raise Exception("Invalid aircraft type code: '" + typeCode + "'")
     337
     338    def _decodeAircraftICAOType(self, typeCode):
     339        """Decode the aircraft type from the given typeCode."""
     340        if typeCode in const.icao2Type:
     341            return const.icao2Type[typeCode]
    328342        else:
    329343            raise Exception("Invalid aircraft type code: '" + typeCode + "'")
Note: See TracChangeset for help on using the changeset viewer.