📄 ide.py
字号:
mem = Tix.Frame(top)
b = Tix.Label(mem, text="Map :")
map = Tix.OptionMenu(mem,command=self.memory_map)
b.grid(row = 0, column = 0,padx=5,pady=3,sticky=W+E)
map.grid(row = 0,column = 1, columnspan=2, padx=5,pady=3,sticky=W+E)
b = Tix.Label(mem, text="Type :")
type = Tix.OptionMenu(mem,command=self.memory_type)
b.grid(row = 1, column = 0,padx=5,pady=3,sticky=W+E)
type.grid(row = 1,column = 1, columnspan=2, padx=5,pady=3,sticky=W+E)
b = Tix.Label(mem, text="'Addr :")
addr = Tix.ComboBox(mem, editable=1, history=1,anchor=Tix.E,command=self.memory_addr)
b.grid(row = 2, column = 0,padx=5,pady=3,sticky=W+E)
addr.grid(row = 2,column = 1, columnspan=2, padx=5,pady=3,sticky=W+E)
b = Tix.Label(mem, text="Size :")
size = Tix.ComboBox(mem,editable=1, history=1,anchor=Tix.E,command=self.memory_size)
b.grid(row = 3, column = 0,padx=5,pady=3,sticky=W+E)
size.grid(row = 3,column = 1, columnspan=2, padx=5,pady=3,sticky=W+E)
b = Tix.Label(mem, text="File :")
file = Tix.FileEntry(mem,command=self.memory_file)
b.grid(row = 4, column = 0,padx=5,pady=3,sticky=W+E)
file.grid(row = 4,column = 1, columnspan=2, padx=5,pady=3,sticky=W+E)
add = Tix.Button(top, text="Add", command=self.memory_add)
reset = Tix.Button(top, text="Reset", command=self.memory_reset)
ok = Tix.Button(top, text="OK",command=self.memory_ok)
map.add_command("I",label="I")
map.add_command("M",label="M")
type.add_command("R",label="R")
type.add_command("W",label="W")
type.add_command("RW",label="RW")
addr.insert(Tix.END,"0x00000000")
size.insert(Tix.END,"0x00000000")
mem.grid(row = 0, column = 0, columnspan=3,padx=5,pady=10,sticky=N+S+W+E)
add.grid(row = 1, column = 0,padx=5,pady=10,sticky=W+E)
reset.grid(row =1, column = 1,padx=5,pady=10,sticky=W+E)
ok.grid(row =1, column = 2,padx=5,pady=10,sticky=W+E)
self.skyeye_redobody()
def memory_map(self,event=None):
self.map = str(event)
def memory_type(self,event=None):
self.type = str(event)
def memory_addr(self,event=None):
self.addr = str(event)
def memory_size(self,event=None):
self.size = str(event)
def memory_file(self,event=None):
self.file = str(event)
def memory_add(self,event=None):
x = {}
if self.map != "":
x["map"] = self.map
else:
self.message("map is not filled yet")
return
if self.type != "":
x["type"] = self.type
else:
self.message("map is not filled yet")
return
if self.addr != "":
x["addr"] = self.addr
else:
self.message("address is not filled yet")
return
if self.size != "":
x["size"] = self.size
else:
self.message("size is not filled yet")
return
x["file"] = self.file
self.membank.append(x)
str = ""
for x in self.membank:
str += "membank:"
str += "map="+x["map"]+","
str += "type="+x["type"]+","
str += "addr="+x["addr"]+","
str += "size="+x["size"]
if x["file"] != "":
str += ",file="+x["file"]
str += "\n"
self.memory_info = str
self.show_memory()
def memory_reset(self,event=None):
self.memory_info = ""
self.membank = []
self.message("Memory information is reseted")
def memory_ok(self,event=None):
self.memory_once = 1
top = self.skyeye_body("Memory")
tmp = Tix.Frame(top)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=240, anchor=Tix.N,
text='Below are the information of memory:')
b.grid( row =0 ,padx=5,pady=3,sticky=W+E)
str = ""
for x in self.membank:
str += "membank:"
str += "map="+x["map"]+","
str += "type="+x["type"]+","
str += "addr="+x["addr"]+","
str += "size="+x["size"]
if x["file"] != "":
str += ",file="+x["file"]
str += "\n"
b = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='%s'%str)
b.grid( row =1 ,padx=5,pady=3,sticky=W+E)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=240, anchor=Tix.N,
text='Would you want to reset?')
b.grid( row =2 ,padx=5,pady=3,sticky=W+E)
reset = Tix.Button(tmp, text="OK", command=self.reset_memory, width = 5, bg="red",fg="white")
reset.grid( row = 3,padx=5,pady=3)
tmp.grid(padx=5,pady=10)
self.message("Memory information is :\n"+str)
self.skyeye_redobody()
def reset_memory(self):
self.memory_once = 0
self.view_memory()
def show_memory(self):
self.message(self.memory_info)
def view_info(self):
top = self.skyeye_body("System information")
tmp = Tix.Frame(top,padx=10,pady=15)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=240, anchor=Tix.N,
text='Below are the information of the whole system:')
b.grid( row =0 ,padx=5,pady=3,sticky=W+E)
str = ""
str += "Cpu \t\t: %s\n"%self.cpu
str += "Mainboard \t: %s\n"%self.board
str += "Net \t\t: %s\n"%self.net
str += "Lcd \t\t: %s\n"%self.lcd
str += "Flash \t\t: %s\n"%self.flash
for x in self.membank:
str += "membank \t : "
str += "map="+x["map"]+","
str += "type="+x["type"]+","
str += "addr="+x["addr"]+","
str += "size="+x["size"]
if x["file"] != "":
str += ",file="+x["file"]
str += "\n"
b = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='%s'%str)
b.grid( row =1 ,padx=5,pady=3,sticky=W+E)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=240, anchor=Tix.N,
text='Would you want to reset ALL?')
b.grid( row =2 ,padx=5,pady=3,sticky=W+E)
reset = Tix.Button(tmp, text="OK", command=self.reset_all, width = 5, bg="red",fg="white")
reset.grid( row = 3,padx=5,pady=3)
tmp.grid(padx=5,pady=25)
self.message("System information is :\n"+str)
self.skyeye_redobody()
def reset_all(self):
self.cpu_once = 0
self.device_once = 0
self.memory_once = 0
self.cpu = ""
self.board=""
self.net = ""
self.lcd = ""
self.flash = ""
self.map = ""
self.type = ""
self.addr = ""
self.size = ""
self.file = ""
self.membank = []
self.memory_info = ""
self.welcome()
self.message("All information has been reset")
def project_new(self):
self.reset_all()
self.message("A new project is open")
def project_save(self):
if self.cpu_once == 0:
self.message("Cpu and Mainboard is not chosen yet")
self.welcome()
return
if self.device_once == 0:
self.message("Peripherial is not chosen yet")
self.welcome()
return
if self.memory_once == 0:
self.message("Memory is not chose yet")
self.welcome()
return
try:
tmp_fd = open("skyeye.conf.koo","w")
except:
self.message("./skyeye.conf.koo write failure")
return
top = self.skyeye_body("Write configuration file")
tmp = Tix.Frame(top,padx=10,pady=25)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=240, anchor=Tix.N,
text='Below are the saved information:')
b.grid( row =0 ,padx=5,pady=3,sticky=W+E)
str = "cpu\t:" + self.cpu + "\n"
str += "mach\t:"+ self.board + "\n"
for x in self.membank:
tmpp = "membank\t:map=" + x["map"] +",type=" +x["type"] + ",addr=" + x["addr"] + ",size=" + x["size"]
if x["file"] != "":
tmpp += ",file=" + x["file"]
str += tmpp + "\n"
if self.lcd != "":
str += "lcd\t:state=on,type="+self.lcd+",mode=gtk\n"
if self.net!= "":
pass # i have to find one demo ...
str += "dbct\t:state=on\n"
b = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='%s'%str)
b.grid( row =1 ,padx=5,pady=3,sticky=W+E)
tmp_fd.write(str)
tmp.grid(padx=5,pady=25)
self.message("Information has been written to ./skyeye.conf.koo")
self.skyeye_redobody()
def execute_compile(self):
pass
def execute_compilecurrentfile(self):
pass
def execute_run(self):
top = self.skyeye_body("Start running skyeye")
tmp = Tix.Frame(top,padx=10,pady=15)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=240, anchor=Tix.N,
text='Below are the command to skyeye:')
b.grid( row =0 ,padx=5,pady=15,sticky=W+E)
tmp.grid(row =0,column =0,padx=5,pady=15,sticky=W+E)
tmp = Tix.Frame(top,padx=10,pady=15)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='skyeye')
b.grid( row =0 ,column =0,padx=5,pady=3,sticky=W+E)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='-e')
b.grid( row =0 ,column =1,padx=5,pady=3,sticky=W+E)
b = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='-c')
b.grid( row =1 ,column =1,padx=5,pady=3,sticky=W+E)
self.image_path = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='vmlinux')
self.image_path.grid( row =0 ,column =2,padx=5,pady=3,sticky=W)
self.conf_path = Tix.Message(tmp,
relief=Tix.FLAT, width=440, anchor=Tix.N,
text='skyeye.conf')
self.conf_path.grid( row =1 ,column =2,padx=5,pady=3,sticky=W)
file = Tix.FileEntry(tmp,command=self.image_path_do)
file.grid( row = 0, column =3,padx=5,pady=3,sticky=W+E)
file = Tix.FileEntry(tmp,command=self.conf_path_do)
file.grid( row = 1, column =3,padx=5,pady=3,sticky=W+E)
tmp.grid(row =1,column =0,padx=5,pady=10,sticky=W+E)
tmp = Tix.Frame(top,padx=10,pady=15)
tmp.grid(row =2,column =0,padx=5,pady=10,sticky=W+E)
self.run = Tix.Button(tmp, text="Run", command=self.run_skyeye)
self.kill = Tix.Button(tmp, text="Kill", command=self.kill_skyeye)
self.kill.config(state=DISABLED)
self.run.grid( row = 0, column =0,padx=5,pady=3,sticky=W+E)
self.kill.grid( row = 0, column =1,padx=5,pady=3,sticky=W+E)
self.skyeye_redobody()
def image_path_do(self,event=None):
if str(event) != "":
self.image_path.config(text=str(event))
def conf_path_do(self,event=None):
if str(event) != "":
self.conf_path.config(text=str(event))
def run_skyeye(self):
if self.is_running == 1:
self.run.config(state=DISABLED)
self.kill.config(bg="red",fg="white")
return
self.run.config(state=DISABLED)
path = "skyeye.exe -e " + self.image_path["text"] + " -c " + self.conf_path["text"]
try:
skyeye_process = subprocess.Popen(path)
self.skyeye_id = skyeye_process.pid
self.kill.config(state=NORMAL)
except:
pass
def kill_skyeye(self):
handle = win32api.OpenProcess(1,0,self.skyeye_id)
win32process.TerminateProcess(handle,0)
self.is_running = 0
self.run.config(state=NORMAL)
self.kill.config(state=DISABLED)
def execute_compileandrun(self):
pass
def execute_rebuildall(self):
pass
def execute_clean(self):
pass
def tools_compileroption(self):
pass
def tools_linkeroption(self):
pass
def tools_makefileoption(self):
pass
def window_max(self):
pass
def window_restore(self):
pass
def help_about(self):
print "in help about"
def destroy (self):
self.root.destroy()
if __name__ == '__main__':
try:
root = Tix.Tk()
test = skyeye(root)
root.mainloop()
except:
pass
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -