📄 madagascargui.py
字号:
N=[n1,n2,n3] o1=self.o1.get() o2=self.o2.get() o3=self.o3.get() o2=self.o2.get() O=[o1,o2,o3] d1=self.d1.get() d2=self.d2.get() d3=self.d3.get() D=[d1,d2,d3] label1=self.label1.get() label2=self.label2.get() label3=self.label3.get() Labels=[label1,label2,label3] unit1=self.unit1.get() unit2=self.unit2.get() unit3=self.unit3.get() Unit=[unit1,unit2,unit3] ### RSFPut function command=LOCATION + '/SConstruct' input=open(command,'r') OldSConstruct = input.readlines() input.close() SConstruct = open(command,'w') sectionHead = '# Update Header \n' for item in OldSConstruct: if item != sectionHead: SConstruct.write(item) if item == sectionHead: break SConstruct.write(sectionHead) counter = 0 newFiles = [] for file in RSFfiles: newHeaderInfo = '' if o1 is not "": newHeaderInfo = " o1="+ o1 if o2 is not "": newHeaderInfo = newHeaderInfo + " o2="+ o2 if o3 is not "": newHeaderInfo = newHeaderInfo + " o3="+ o3 if d1 is not "": newHeaderInfo = newHeaderInfo + " d1="+ d1 if d2 is not "": newHeaderInfo = newHeaderInfo + " d2="+ d2 if d3 is not "": newHeaderInfo = newHeaderInfo + " d3="+ d3 if n1 is not "": newHeaderInfo = newHeaderInfo + " n1="+ n1 if n2 is not "": newHeaderInfo = newHeaderInfo + " n2="+ n2 if n3 is not "": newHeaderInfo = newHeaderInfo + " n3="+ n3 if label1 is not "": newHeaderInfo = newHeaderInfo + " label1=" + label1 if label2 is not "": newHeaderInfo = newHeaderInfo + " label2=" + label2 if label3 is not "": newHeaderInfo = newHeaderInfo + " label3=" + label3 if unit1 is not "": newHeaderInfo = newHeaderInfo + " unit1=" + unit1 if unit2 is not "": newHeaderInfo = newHeaderInfo + " unit2=" + unit2 if unit3 is not "": newHeaderInfo = newHeaderInfo + " unit3=" + unit3 input = "Flow(\'" +"update_" + file + "\',\'" + file + "\',\'put " + newHeaderInfo + "\')" command=LOCATION + "/SConstruct" SConstruct=open(command,'a') SConstruct.write(input) SConstruct.write('\n') SConstruct.close() newFile = "update_"+file newFiles.append(newFile) command = "cd " + LOCATION + "\n pwd \n scons &" os.system(command) print 'newFiles' print newFiles length = len(RSFfiles) for file in RSFfiles: trash = RSFfiles.pop() if length > 1: trash = RSFfiles.pop() print 'midRSF' print RSFfiles for file in newFiles: RSFfiles.append(file) print 'RSF' print RSFfiles#--------------------# Fetch Files #-------------------- def fetch(self): # location = os.system("pwd") command = "mkdir " + LOCATION os.system(command) command2=LOCATION + '/SConstruct' SConstruct=open(command2,'w') SConstruct.write("from rsfproj import *") SConstruct.write("\n") sectionHeader = '# Fetch Files from repository \n' SConstruct.write(sectionHeader) for file in SELECTFILES: input = "Fetch(\"" + file + "\"," + "\"" + LOCATION + "\")" SConstruct.write(input) SConstruct.write("\n") SConstruct.close() command = "cd " + LOCATION + " \n pwd \n scons &" os.system(command) #os.system("pwd") def view(self): fileInfo = Toplevel() fileNameRow=0 columnNum = 0 for file in RSFfiles: Label(fileInfo,text=file,fg="black",font=("Helvetica",12)).grid(row=fileNameRow,column=columnNum) command = "cd " + LOCATION + "\nsfin " + file + ".rsf > info_" + file makeFile = os.system(command) command2=LOCATION + "/info_" + file readFile = open(command2,'r') info = readFile.readlines() readFile.close() fileInfoRow=1 for item in info: Label(fileInfo,text=item,fg="red",font=("Helvetica",10,"italic")).grid(row=fileInfoRow,column=columnNum) fileInfoRow = fileInfoRow + 1 columnNum=columnNum+1 def convert(self): global RSFfiles RSFfiles=[] command2=LOCATION + '/SConstruct' SConstruct=open(command2,'a') SConstruct.write("# Convert Files to RSF\n") for file in SELECTFILES: for file2 in segyFiles: if file is file2: fileOut = '' fileLength =len(file) for letter in file[0:fileLength]: if letter is not '.': fileOut = fileOut + letter if letter == '.': break RSFfiles.append(fileOut) command = "Flow(\'"+ fileOut + "\',\'" + file + "\', 'segyread tape=$SOURCE',stdin=0)" SConstruct.write(command) SConstruct.write('\n') for file3 in nativeFiles: if file is file3: fileOut = '' fileLength = len(file) for letter in file[0:fileLength]: if letter is not '.': fileOut = fileOut + letter if letter == '.': break RSFfiles.append(fileOut) command = "Flow(\'"+ fileOut + "\',\'" + file + "\', 'dd form=native')" SConstruct.write(command) SConstruct.write('\n') SConstruct.write('# Update Header \n') SConstruct.close() command3="cd "+LOCATION+"\n" + "scons &" os.system(command3) def plot(self): command=LOCATION + '/SConstruct' input=open(command,'r') OldSConstruct = input.readlines() input.close() SConstruct = open(command,'w') sectionHeader = '# Plotting Section\n' for item in OldSConstruct: if item != sectionHeader: SConstruct.write(item) if str(item) == sectionHeader: break SConstruct.write(sectionHeader) #### Get Values to Plug into SFwindow and SFgrey## samp1=self.samp1.get() samp2=self.samp2.get() samp3=self.samp3.get() start1=self.start1.get() start2=self.start2.get() start3=self.start3.get() jump1=self.jump1.get() jump2=self.jump2.get() jump3=self.jump3.get() min1=self.min1.get() min2=self.min2.get() min3=self.min3.get() max1=self.max1.get() max2=self.max2.get() max3=self.max3.get() size1=self.size1.get() size2=self.size2.get() size3=self.size3.get() clip=self.clip.get() if self.color.curselection() is not (): colorTuple = self.color.curselection() selection = int(colorTuple[0]) color = colorOpts[selection] else: color = 'I' if self.gainpanel.curselection() is not (): gainTuple = self.gainpanel.curselection() choice = int(gainTuple[0]) gainpanel = gainpanelOpts[choice] else: gainpanel = 'a' for file in RSFfiles: windowInfo = '' if samp1 is not '': windowInfo = windowInfo + ' d1='+ samp1 if samp2 is not '': windowInfo = windowInfo + ' d2='+ samp2 if samp3 is not '': windowInfo = windowInfo + ' d3='+ samp3 if start1 is not '': windowInfo = windowInfo + ' f1='+ start1 if start2 is not '': windowInfo = windowInfo + ' f2='+ start2 if start3 is not '': windowInfo = windowInfo + ' f3='+ start3 if jump1 is not '': windowInfo = windowInfo + ' j1='+ jump1 if jump2 is not '': windowInfo = windowInfo + ' j2='+ jump2 if jump3 is not '': windowInfo = windowInfo + ' j3='+ jump3 if min1 is not '': windowInfo = windowInfo + ' min1='+ min1 if min2 is not '': windowInfo = windowInfo + ' min2='+ min2 if min3 is not '': windowInfo = windowInfo + ' min3='+ min3 if max1 is not '': windowInfo = windowInfo + ' max1='+ max1 if max2 is not '': windowInfo = windowInfo + ' max2='+ max2 if max3 is not '': windowInfo = windowInfo + ' max3='+ max3 if size1 is not '': windowInfo = windowInfo + ' size1='+ size1 if size2 is not '': windowInfo = windowInfo + ' size2='+ size2 if size3 is not '': windowInfo = windowInfo + ' size3='+ size3 greyInfo='' if clip is not '': greyInfo = greyInfo + ' pclip=' + clip if color is not '': greyInfo = greyInfo + ' color=' + color if gainpanel is not '': greyInfo = greyInfo + ' gainpanel=' + gainpanel windowCommand = '\'window $SOURCE ' + windowInfo command = "Result(\'"+ file +"\',"+ windowCommand + ' | grey ' + greyInfo + '\')' SConstruct.write(command) SConstruct.write('\n') SConstruct.write('End()') SConstruct.close() command3="cd "+LOCATION+"\n" + "scons view &" os.system(command3) def loadCat(self): Label(root, text="Select Files To Combine").grid(row=25,column=0,columnspan=2,pady=2) Label(root, text="Cat Axis").grid(row=25,column=7,columnspan=1,pady=2) self.catFiles = Listbox(root,selectmode=MULTIPLE,relief=RAISED,height=3,width=35,exportselection=0) for item in RSFfiles: self.catFiles.insert(END, item) self.catFiles.grid(row=25,column=2,rowspan=3,columnspan=5) self.catAxis = Entry(root,width=3) self.catAxis.grid(row=25, column=8,pady=2) self.concatinate = Button(root, text="Combine", command=self.cat) self.concatinate.grid(row=25,column=13,sticky=E+W) def cat(self): choices = self.catFiles.curselection() axisNum=self.catAxis.get() CATfiles = [] for item in choices: number = int(item) selectFiles = RSFfiles[number] CATfiles.append(selectFiles) command=LOCATION + '/SConstruct' input=open(command,'r') OldSConstruct = input.readlines() input.close() SConstruct = open(command,'w') plotHeader = '# Plotting Section\n' sectionHeader = '# Concatinate Files \n' for item in OldSConstruct: if item != plotHeader: SConstruct.write(item) if str(item) == plotHeader: break SConstruct.write(sectionHeader) catRules ='\'cat ${SOURCES[0:2]} axis=' + axisNum + '\'' command2 = 'Flow(\'catFile_'+ LOCATION + '\',' + str(CATfiles) + ',' + catRules + ',stdin=0) \n' SConstruct.write(command2) command3="cd "+LOCATION+"\n" + "scons &" os.system(command3) for file in RSFfiles: trash = RSFfiles.pop() trash = RSFfiles.pop() # Remove last entry newFile='catFile_' + LOCATION RSFfiles.append(newFile) print RSFfiles def archive(self): command = 'cd ' + LOCATION + '\n' '\\rm update* info*' print command os.system(command) ############################################################################################################################################################################################################################################################################################################################# Declare Root Frame## Run App Madagascar on root frame## Create Title Bar and insert Logoroot = Tk()title=Label(root,text='Madagascar',height=2,borderwidth=1,font=("Helvetica", 16,"bold"))title.grid(row=0,column=3,columnspan=3)#logo=PhotoImage(file="Madagascar2.xbm")#logo.grid(row=0,column=0,columnspan=3)app = Madagascar(root)root.mainloop()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -