mirror of
https://github.com/norohind/EDMC_SpanshRouter.git
synced 2026-10-22 18:02:08 +03:00
Add only csv files in file explorer + avoid dirty exception if no file is chosen
This commit is contained in:
1 parent
5334e3320e
commit
74da851997
1 file changed
+12
-10
@@ -49,19 +49,21 @@ def copy_waypoint(self=None):
|
|||||||
this.parent.update()
|
this.parent.update()
|
||||||
|
|
||||||
def new_route(self=None):
|
def new_route(self=None):
|
||||||
filename = filedialog.askopenfilename() # show an "Open" dialog box and return the path to the selected file
|
filename = filedialog.askopenfilename(filetypes = (("csv files", "*.csv"),)) # show an "Open" dialog box and return the path to the selected file
|
||||||
this.next_route = filename
|
|
||||||
|
|
||||||
with open(filename, 'r') as csvfile:
|
if filename.__len__() > 0:
|
||||||
route_reader = csv.reader(csvfile)
|
this.next_route = filename
|
||||||
this.route = [row for row in route_reader]
|
|
||||||
|
|
||||||
if monitor.system == this.route[1][0]:
|
with open(filename, 'r') as csvfile:
|
||||||
del this.route[1]
|
route_reader = csv.reader(csvfile)
|
||||||
|
this.route = [row for row in route_reader]
|
||||||
|
|
||||||
this.next_stop = this.route[1][0]
|
if monitor.system == this.route[1][0]:
|
||||||
copy_waypoint()
|
del this.route[1]
|
||||||
update_gui()
|
|
||||||
|
this.next_stop = this.route[1][0]
|
||||||
|
copy_waypoint()
|
||||||
|
update_gui()
|
||||||
|
|
||||||
def update_route():
|
def update_route():
|
||||||
del(this.route[1])
|
del(this.route[1])
|
||||||
|
|||||||
Reference in new issue
Block a user