- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/rpc.py
r908 r889 208 208 "TU5" : const.AIRCRAFT_T154, 209 209 "YK4" : const.AIRCRAFT_YK40, 210 "146" : const.AIRCRAFT_B462, 211 "IL6" : const.AIRCRAFT_IL62 } 210 "146" : const.AIRCRAFT_B462 } 212 211 213 212 # FIXME: copied from web.BookedFlight … … 229 228 const.AIRCRAFT_T154 : "TU5", 230 229 const.AIRCRAFT_YK40 : "YK4", 231 const.AIRCRAFT_B462 : "146", 232 const.AIRCRAFT_IL62 : "IL6" } 230 const.AIRCRAFT_B462 : "146" } 233 231 234 232 # FIXME: copied from web.BookedFlight … … 236 234 def _decodeAircraftType(typeCode): 237 235 """Decode the aircraft type from the given typeCode.""" 238 if typeCode in const.icao2Type:239 return const.icao2Type[typeCode]236 if typeCode in BookedFlight.TYPECODE2TYPE: 237 return BookedFlight.TYPECODE2TYPE[typeCode] 240 238 else: 241 239 raise Exception("Invalid aircraft type code: '" + typeCode + "'") … … 277 275 _instructions = { 278 276 "numPassengers" : int, 279 "numCockpitCrew" : int, 280 "numCabinCrew" : int, 277 "numCrew" : int, 281 278 "bagWeight" : int, 282 279 "cargoWeight" : int, … … 310 307 print >> f, "tail_nr=%s" % (self.tailNumber,) 311 308 print >> f, "passenger=%d" % (self.numPassengers,) 312 print >> f, "crew=%d" % (self.numC ockpitrew + self.numCabinCrew,)309 print >> f, "crew=%d" % (self.numCrew,) 313 310 print >> f, "bag=%d" % (self.bagWeight,) 314 311 print >> f, "cargo=%d" % (self.cargoWeight,) … … 379 376 for planeValue in value: 380 377 self._addPlane(Plane(planeValue)) 381 382 #---------------------------------------------------------------------------------------383 384 class AircraftTypeInfo(RPCObject):385 """Information about an aircraft type."""386 # The instructions for the construction387 _instructions = {388 "dow" : int,389 "dowCockpit" : int,390 "dowCabin" : int,391 }392 393 def __init__(self, value):394 """Construct the booked flight object from the given RPC result395 value."""396 super(AircraftTypeInfo, self).__init__(value,397 AircraftTypeInfo._instructions)398 self.aircraftType = const.icao2Type[value["typeCode"]]399 378 400 379 #--------------------------------------------------------------------------------------- … … 519 498 self._sessionID = reply.value["sessionID"] 520 499 521 types = [ const.icao2Type[typeCode]500 types = [BookedFlight.TYPECODE2TYPE[typeCode] 522 501 for typeCode in reply.value["typeCodes"]] 523 502 … … 525 504 else: 526 505 return None 527 528 def getTypes(self):529 """Get the data of the aircraft types supported by us."""530 value = self._performCall(lambda sessionID:531 self._server.getTypes(sessionID))532 533 return [AircraftTypeInfo(t) for t in value]534 506 535 507 def getFlights(self): … … 627 599 of type codes, if any.""" 628 600 typeCodes = None if types is None else \ 629 [const.icaoCodes[type] for type in types]601 [BookedFlight.TYPE2TYPECODE[type] for type in types] 630 602 631 603 values = self._performCall(lambda sessionID:
Note:
See TracChangeset
for help on using the changeset viewer.