Changeset 1173:6611a47528bb
- Timestamp:
- 10/20/24 13:00:41 (5 weeks ago)
- Branch:
- python3
- Phase:
- public
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
setup.py
r1083 r1173 51 51 52 52 rootFiles = ["logo.png", "conn_grey.png", "conn_red.png", "conn_green.png", 53 "mavalogo.png" ]53 "mavalogo.png", "fleet.json", "gates.json"] 54 54 if os.name!="nt": 55 55 rootFiles.append("Microsoft.VC90.CRT.manifest") -
src/mlx/gui/flight.py
r1168 r1173 442 442 """Called when the offline button was clicked.""" 443 443 print("mlx.flight.LoginPage: offline flight selected") 444 self._wizard.setupOfflineFlight() 444 445 self._wizard.nextPage() 445 446 … … 6819 6820 self.gui.webHandler.login(self._loginResultCallback, 6820 6821 pilotID, password) 6822 6823 def setupOfflineFlight(self): 6824 """Setup an offline flight.""" 6825 #import pickle 6826 import random 6827 import json 6828 from mlx.rpccommon import Fleet 6829 from mlx.gates import Gates 6830 6831 # with open(os.path.join(self.gui.programDirectory, 6832 # "fleet.pickle"), "rb") as f: 6833 # fleet = pickle.load(f) 6834 # with open(os.path.join(self.gui.programDirectory, 6835 # "fleet.json"), "wt") as f: 6836 # json.dump(fleet.toJSON(), f, sort_keys = True, indent = 4) 6837 with open(os.path.join(self.gui.programDirectory, 6838 "fleet.json"), "rt") as f: 6839 fleet = Fleet.fromJSON(json.load(f)) 6840 # with open(os.path.join(self.gui.programDirectory, 6841 # "fleet1.json"), "wt") as f: 6842 # json.dump(fleet.toJSON(), f, sort_keys = True, indent = 4) 6843 6844 # with open(os.path.join(self.gui.programDirectory, 6845 # "gates.pickle"), "rb") as f: 6846 # gates = pickle.load(f) 6847 # with open(os.path.join(self.gui.programDirectory, 6848 # "gates.json"), "wt") as f: 6849 # json.dump(gates.toJSON(), f, sort_keys = True, indent = 4) 6850 with open(os.path.join(self.gui.programDirectory, 6851 "gates.json"), "rt") as f: 6852 gates = Gates.fromJSON(json.load(f)) 6853 # with open(os.path.join(self.gui.programDirectory, 6854 # "gates1.json"), "wt") as f: 6855 # json.dump(gates.toJSON(), f, sort_keys = True, indent = 4) 6856 6857 class OfflineLoginResult: 6858 def __init__(self, fleet, gates, gui): 6859 self.loggedIn = False 6860 if gui.config and gui.config.pilotID: 6861 self.pilotID = gui.config.pilotID 6862 else: 6863 self.pilotID = "P999" 6864 self.pilotName = "Joe Captain" 6865 self.fleet = fleet 6866 self.gates = gates 6867 self.reportedFlights = [] 6868 self.rejectedFlights = [] 6869 self.flights = [] 6870 self.sessionID = "".join(random.choices("0123456789", k = 16)) 6871 self._loginResult = OfflineLoginResult(fleet, gates, self.gui) 6821 6872 6822 6873 def reloadFlights(self, callback):
Note:
See TracChangeset
for help on using the changeset viewer.