Changeset 898:55da787ce6e1
- Timestamp:
- 03/16/18 08:58:18 (7 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r895 r898 97 97 class Aircraft(object): 98 98 """Base class for aircraft.""" 99 dowCockpit = 2 100 dowCabin = 3 101 99 102 @staticmethod 100 103 def create(flight, bookedFlight): … … 829 832 class B734(Boeing737CL): 830 833 """Boeing 737-400 aircraft.""" 834 dow = 35100 835 831 836 def __init__(self, flight): 832 837 super(B734, self).__init__(flight) 833 self.dow = 35100834 838 self.mtow = 62822 835 839 self.mlw = 54885 … … 1301 1305 #--------------------------------------------------------------------------------------- 1302 1306 1307 def setupTypes(aircraftTypes): 1308 """Setup the values in the given types using the info retrieved 1309 from the server.""" 1310 for aircraftTypeInfo in aircraftTypes: 1311 clazz = getClass(aircraftTypeInfo.aircraftType) 1312 1313 clazz.dow = aircraftTypeInfo.dow 1314 clazz.dowCockpit = aircraftTypeInfo.dowCockpit 1315 clazz.dowCabin = aircraftTypeInfo.dowCabin 1316 1317 #--------------------------------------------------------------------------------------- 1318 1303 1319 if __name__ == "__main__": 1304 1320 value = SmoothedValue() -
src/mlx/const.py
r895 r898 224 224 AIRCRAFT_T154 : "T154", 225 225 AIRCRAFT_YK40 : "YK40", 226 AIRCRAFT_B462 : "B462" } 226 AIRCRAFT_B462 : "B462", 227 AIRCRAFT_IL62 : "IL62" } 228 229 #------------------------------------------------------------------------------- 230 231 ## A mapping from ICAO codes to the corresponding aircraft types 232 icao2Type = { "B736" : AIRCRAFT_B736, 233 "B737" : AIRCRAFT_B737, 234 "B738" : AIRCRAFT_B738, 235 "B732" : AIRCRAFT_B732, 236 "B733" : AIRCRAFT_B733, 237 "B734" : AIRCRAFT_B734, 238 "B735" : AIRCRAFT_B735, 239 "DH8D" : AIRCRAFT_DH8D, 240 "B762" : AIRCRAFT_B762, 241 "B763" : AIRCRAFT_B763, 242 "CRJ2" : AIRCRAFT_CRJ2, 243 "F70" : AIRCRAFT_F70, 244 "DC3" : AIRCRAFT_DC3, 245 "T134" : AIRCRAFT_T134, 246 "T154" : AIRCRAFT_T154, 247 "YK40" : AIRCRAFT_YK40, 248 "B462" : AIRCRAFT_B462, 249 "IL62" : AIRCRAFT_IL62 } 227 250 228 251 #------------------------------------------------------------------------------- -
src/mlx/rpc.py
r895 r898 381 381 #--------------------------------------------------------------------------------------- 382 382 383 class AircraftTypeInfo(RPCObject): 384 """Information about an aircraft type.""" 385 # The instructions for the construction 386 _instructions = { 387 "dow" : int, 388 "dowCockpit" : int, 389 "dowCabin" : int, 390 } 391 392 def __init__(self, value): 393 """Construct the booked flight object from the given RPC result 394 value.""" 395 super(AircraftTypeInfo, self).__init__(value, 396 AircraftTypeInfo._instructions) 397 self.aircraftType = const.icao2Type[value["typeCode"]] 398 399 #--------------------------------------------------------------------------------------- 400 383 401 class Registration(object): 384 402 """Data for registration.""" … … 507 525 return None 508 526 527 def getTypes(self): 528 """Get the data of the aircraft types supported by us.""" 529 value = self._performCall(lambda sessionID: 530 self._server.getTypes(sessionID)) 531 532 return [AircraftTypeInfo(t) for t in value] 533 509 534 def getFlights(self): 510 535 """Get the flights available for performing.""" -
src/mlx/web.py
r895 r898 817 817 result.types = loginResult[2] 818 818 result.password = password 819 820 result.aircraftTypes = client.getTypes() 821 819 822 flights = client.getFlights() 820 823 result.flights = flights[0] 821 824 result.reportedFlights = flights[1] 822 825 result.rejectedFlights = flights[2] 826 823 827 if result.rank=="STU": 824 828 reply = client.getEntryExamStatus()
Note:
See TracChangeset
for help on using the changeset viewer.