def hauptmenu(pfad="../messung"): global root,checks,auswahl try: root.destroy() except NameError,TclError: pass root = tk.Tk() root.geometry('1000x800+800+400') root.grid() root.title("Hauptmenu") plo_list=[] for i in range(len(plots)): plo_list.append([]) path=os.path.expanduser('../plots/') for i in range(len(sorted(os.listdir(path)))): for j in range(len(plots)): if sorted(os.listdir(path))[i].split('_')[-1].split('.')[0]==plots[j].name: plo_list[j].append(sorted(os.listdir(path))[i].split('_')[0]) path=os.path.expanduser(pfad) auswahl,igor_list=[],[] for file in sorted(os.listdir(path)): if os.path.isfile(os.path.join(path,file)): try: int(os.path.splitext(file)[0].split('-')[0]) auswahl.append(os.path.splitext(file)[0].split('-')[0]) except ValueError: pass path=os.path.expanduser('../../igor/messung/') for file in sorted(os.listdir(path)): try: x=int(os.path.splitext(file)[0].split('-')[0]) if (str(x) in auswahl)==False: auswahl.append(os.path.splitext(file)[0].split('-')[0]) if str(x) in auswahl: igor_list.append(os.path.splitext(file)[0].split('-')[0]) except ValueError: pass checks=[] for we in range(len(plots)): if plots[we].name=="wetter": wetter=we for i in range(len(list(set(auswahl)))): checks.append(tk.IntVar()) if sorted(list(set(auswahl)))[i] in igor_list:tk.Button(root,text='',command=lambda datum=sorted(list(set(auswahl)))[i]:igor_steuern(datum)).grid(row=i+3,column=3) tk.Checkbutton(root,text=sorted(list(set(auswahl)))[i],variable=checks[i]).grid(row=i+3,column=4) for j in range(len(plots)): if sorted(list(set(auswahl)))[i] in plo_list[j]: tk.Button(root,text=plots[j].name,command=lambda jd=j, datum=sorted(list(set(auswahl)))[i]:plot_bearbeitung(root,datum,plots,plots[jd],spuren)).grid(row=i+3,column=7+j) tk.Label(root,text="igor einlesen").grid(row=1,column=3) tk.Button(root,text="plot einstellungen",command=lambda:plot_einstellungen(0)).grid(row=1,column=5,columnspan=2) tk.Button(root,text="zur Ordnerwahl",command=lambda:ordnerwahl()).grid(row=1,column=1,columnspan=2) tk.Button(root,text="Ende",command=lambda:sys.exit("Bis bald")).grid(row=1,column=0) tk.Button(root,text="alle",command=lambda:check_all(checks)).grid(row=i+4,column=4) tk.Button(root,text="keine",command=lambda:uncheck_all(checks)).grid(row=i+5,column=4) tk.Label(root,text='SP2 timeshift: %d s'%sp2_timeshift).grid(row=2,column=1) tk.Label(root,text='SP1A timeshift: %d s'%sp1a_timeshift).grid(row=3,column=1) c_row,c_col=3,1 optionen_name=['Rohdaten einlesen','netcdf file erstellen','SP2 ICARTT erstellen','SP1A ICARTT erstellen','30s Mittelung erstellen'] schreiben=[] for i in range(len(optionen_name)): schreiben.append(tk.IntVar()) tk.Checkbutton(root,text=optionen_name[i],variable=schreiben[i]).grid(row=c_row+2+i,column=c_col) tk.Label(root,text="Plots anpassen").grid(row=2,column=c_col+6,columnspan=len(plots)) tk.Label(root,text=' ').grid(row=c_row+len(optionen_name)+2,column=c_col) tk.Label(root,text='Plots').grid(row=c_row+len(optionen_name)+3,column=c_col) ploo,ploop=[],[] c_row,c_col=39,1 for j in range(len(plots)+2): ploop.append(tk.IntVar()) if j<len(plots): ploo.append(tk.Checkbutton(root,text=plots[j].name,variable=ploop[j]).grid(row=c_row+i+j,column=c_col)) if j==len(plots): ploo.append(tk.Checkbutton(root,text="Druck-Abgleich",variable=ploop[j]).grid(row=c_row+i+j+1,column=c_col)) if j>len(plots): ploo.append(tk.Checkbutton(root,text="Flugroute",variable=ploop[j]).grid(row=c_row+i+j+1,column=c_col)) tk.Button(root,text="los",command= lambda: vorbereitung(pfad,schreiben,ploop)).grid(row=c_row+i+j+3,column=c_col) root.update() root.mainloop()
if plots[we].name == "wetter": wetter = we for i in range(len(list(set(auswahl)))): checks.append(tk.IntVar()) if sorted(list(set(auswahl)))[i] in igor_list: tk.Button(root, text="", command=lambda datum=sorted(list(set(auswahl)))[i]: igor_steuern(datum)).grid( row=i + 3, column=3 ) tk.Checkbutton(root, text=sorted(list(set(auswahl)))[i], variable=checks[i]).grid(row=i + 3, column=4) for j in range(len(plots)): if sorted(list(set(auswahl)))[i] in plo_list[j]: tk.Button( root, text=plots[j].name, command=lambda jd=j, datum=sorted(list(set(auswahl)))[i]: plot_bearbeitung( root, datum, plots, plots[jd], spuren ), ).grid(row=i + 3, column=7 + j) tk.Label(root, text="igor einlesen").grid(row=1, column=3) tk.Button(root, text="plot einstellungen", command=lambda: plot_einstellungen(0)).grid( row=1, column=5, columnspan=2 ) tk.Button(root, text="zur Ordnerwahl", command=lambda: ordnerwahl()).grid(row=1, column=1, columnspan=2) tk.Button(root, text="Ende", command=lambda: sys.exit("Bis bald")).grid(row=1, column=0) tk.Button(root, text="alle", command=lambda: check_all(checks)).grid(row=i + 4, column=4) tk.Button(root, text="keine", command=lambda: uncheck_all(checks)).grid(row=i + 5, column=4) tk.Label(root, text="SP2 timeshift: %d s" % sp2_timeshift).grid(row=2, column=1) tk.Label(root, text="SP1A timeshift: %d s" % sp1a_timeshift).grid(row=3, column=1) c_row, c_col = 3, 1