From be4844742dc38ddf5882f1adcb2e800a962d1a00 Mon Sep 17 00:00:00 2001 From: CMDR-Kiel42 Date: Sat, 15 Jun 2019 22:44:58 +0200 Subject: [PATCH] Only use the System column instead of loading the whole csv file --- load.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/load.py b/load.py index 53289ca..abfd9c4 100644 --- a/load.py +++ b/load.py @@ -28,9 +28,9 @@ def plugin_start(): # Open the last saved route with open(this.save_route_path, 'r') as csvfile: route_reader = csv.reader(csvfile) - this.route = [row for row in route_reader] + this.route = [row[0] for row in route_reader] - this.next_stop = this.route[1][0] + this.next_stop = this.route[1] except: print("No previously saved route.") @@ -39,9 +39,7 @@ def plugin_stop(): if this.route.__len__() != 0: # Save route for next time with open(this.save_route_path, 'w') as csvfile: - route_writer = csv.writer(csvfile) - for row in this.route: - route_writer.writerow(row) + csvfile.write('\n'.join(this.route)) def update_gui(): this.waypoint_btn["text"] = this.next_wp_label + this.next_stop @@ -63,12 +61,12 @@ def new_route(self=None): with open(filename, 'r') as csvfile: route_reader = csv.reader(csvfile) - this.route = [row for row in route_reader] + this.route = [row[0] for row in route_reader] if monitor.system == this.route[1][0]: del this.route[1] - this.next_stop = this.route[1][0] + this.next_stop = this.route[1] copy_waypoint() update_gui() @@ -80,7 +78,7 @@ def update_route(): if os.path.isfile(this.save_route_path): os.remove(this.save_route_path) else: - this.next_stop = this.route[1][0] + this.next_stop = this.route[1] update_gui() copy_waypoint(this.parent)