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