def manageFilesSubmit(window, listbox): global vars submittedEntries = listbox.get(0, Tk.END) count = 0 for entries in submittedEntries: if entries[0:3] == 'Add': #try: test = open(entries[10:], 'r') Filenames.append(entries[10:]) vars[entries[10:]] = lexyacc.parseMe(entries[10:]) markForDel = [] for variables in vars[entries[10:]]: if checkEmpty(vars[entries[10:]][variables].data) == 0: markForDel.append(variables) for variables in markForDel: del vars[entries[10:]][variables] vars[entries[10:]] = organizedata.organizedata(vars[entries[10:]]) #except: # errorMsg('Could not open file' + str(count)) elif entries[0:7] == 'Refresh': del vars[entries[14:]] vars[entries[14:]] = lexyacc.parseMe(entries[14:]) markForDel = [] for variables in vars[entries[14:]]: if checkEmpty(vars[entries[14:]][variables].data) == 0: markForDel.append(variables) for variables in markForDel: del vars[entries[14:]][variables] vars[entries[14:]] = organizedata.organizedata(vars[entries[14:]]) elif entries[0:6] == 'Delete': del vars[entries[13:]] Filenames.remove(entries[13:]) else: errorMsg('This is a bug... please submit bug report') window.destroy()
def manageFilesSubmit(window, listbox): global vars submittedEntries = listbox.get(0, Tk.END) count = 0 for entries in submittedEntries: if entries[0:3] == 'Add': #try: test = open(entries[10:], 'r') Filenames.append(entries[10:]) vars[entries[10:]] = lexyacc.parseMe(entries[10:]) markForDel = [] for variables in vars[entries[10:]]: if (variables != 'CFLOG' and checkEmpty(vars[entries[10:]][variables].data) == 0): markForDel.append(variables) for variables in markForDel: del vars[entries[10:]][variables] vars[entries[10:]] = organizedata.organizedata(vars[entries[10:]]) #except: # errorMsg('Could not open file' + str(count)) elif entries[0:7] == 'Refresh': del vars[entries[14:]] vars[entries[14:]] = lexyacc.parseMe(entries[14:]) markForDel = [] for variables in vars[entries[14:]]: if checkEmpty(vars[entries[14:]][variables].data) == 0: markForDel.append(variables) for variables in markForDel: del vars[entries[14:]][variables] vars[entries[14:]] = organizedata.organizedata(vars[entries[14:]]) elif entries[0:6] == 'Delete': del vars[entries[13:]] Filenames.remove(entries[13:]) else: errorMsg('This is a bug... please submit bug report') window.destroy()
def startup(res, TEFILES): global vars # The Main Window Stuff # Instantiate the window instance = Tk.Tk() instance.title("AerialVision GPU Graphing Tool") #set the window size if res == 'small': root = Tk.Frame(instance, width=1325, height=850, bg='white') elif res == 'medium': root = Tk.Frame(instance, width=1700, height=1100, bg='white') else: root = Tk.Frame(instance, width=1700, height=1100, bg='white') root.pack_propagate(0) root.pack() # User can choose between a text editor or a visualizer chooseTextVisualizer = Pmw.NoteBook(root) chooseTextVisualizer.pack(fill='both', expand='true') visualizer = chooseTextVisualizer.add('Visualizer') textEditor = chooseTextVisualizer.add('Source Code View') #INITIALIZING THE VISUALIZER #The top frame for the control panel # Frame for Control Panel if res == 'small': controlPanel = Tk.Frame(visualizer, width=1250, height=50, bg="beige", borderwidth=5, relief=Tk.GROOVE) elif res == 'medium': controlPanel = Tk.Frame(visualizer, width=1530, height=50, bg="beige", borderwidth=5, relief=Tk.GROOVE) else: controlPanel = Tk.Frame(visualizer, width=1530, height=50, bg="beige", borderwidth=5, relief=Tk.GROOVE) controlPanel.pack(anchor=Tk.N, pady=5) controlPanel.pack_propagate(0) # Control Panel Title controlTitle = Tk.Frame(controlPanel, bg='beige') controlTitle.pack(side=Tk.LEFT) lControlTitle = Tk.Label(controlTitle, text='Control Panel: ', font=("Gills Sans MT", 15, "bold"), bg="beige") lControlTitle.pack(side=Tk.LEFT) #Number of Tabs Frame) numbTabs = Tk.Frame(controlPanel, bg='beige') numbTabs.pack(side=Tk.LEFT) eAddTab = Tk.Entry(numbTabs) bRemTab = Tk.Button(numbTabs, text="Rem Tab", command=(lambda: remTab(graphTabs)), bg='red') bRemTab.pack(side=Tk.LEFT) bAddTab = Tk.Button( numbTabs, text="Add Tab", command=(lambda: graphAddTab(vars, graphTabs, res, eAddTab))) bAddTab.pack(side=Tk.LEFT) eAddTab.pack(side=Tk.LEFT) eAddTab.insert(0, 'TabTitle?') bManageFiles = Tk.Button(numbTabs, text="Manage Files", command=lambda: manageFiles()) bManageFiles.pack(side=Tk.LEFT) #Quit or Open up new Window Frame quitNew = Tk.Frame(controlPanel, bg='beige') quitNew.pack(side=Tk.RIGHT, padx=10) bQuit = Tk.Button(quitNew, text="Quit", bg='red', command=(lambda: tmpquit(instance))) bQuit.pack(side=Tk.LEFT) #The bottom Frame that contains tabs,graphs,etc... #Instantiating the Main frame #Frame for Graphing Area if res == 'small': graphMainFrame = Tk.Frame(visualizer, width=1250, height=750, borderwidth=5, relief=Tk.GROOVE) elif res == 'medium': graphMainFrame = Tk.Frame(visualizer, width=1615, height=969, borderwidth=5, relief=Tk.GROOVE) else: graphMainFrame = Tk.Frame(visualizer, width=1615, height=969, borderwidth=5, relief=Tk.GROOVE) graphMainFrame.pack(pady=5) graphMainFrame.pack_propagate(0) #Setting up the Tabs graphTabs = Pmw.NoteBook(graphMainFrame) graphTabs.pack(fill='both', expand='true') #Class newTab will take "graphTabs" which is the widget on top of graphMainFrame and create a new tab #for every instance of the class # Here we extract the available data that can be graphed by the user for files in Filenames: vars[files] = lexyacc.parseMe(files) markForDel = {} for files in vars: markForDel[files] = [] for variables in vars[files]: if variables == 'CFLOG': continue if variables == 'EXTVARS': continue if checkEmpty(vars[files][variables].data) == 0: markForDel[files].append(variables) for files in markForDel: for variables in markForDel[files]: del vars[files][variables] organizedata.setCFLOGInfoFiles(TEFILES) for files in Filenames: vars[files] = organizedata.organizedata(vars[files]) graphAddTab(vars, graphTabs, res, eAddTab) # INITIALIZING THE TEXT EDITOR if res == 'small': textControlPanel = Tk.Frame(textEditor, width=1250, height=50, bg='beige', borderwidth=5, relief=Tk.GROOVE) elif res == 'medium': textControlPanel = Tk.Frame(textEditor, width=1530, height=50, bg='beige', borderwidth=5, relief=Tk.GROOVE) else: textControlPanel = Tk.Frame(textEditor, width=1530, height=50, bg='beige', borderwidth=5, relief=Tk.GROOVE) textControlPanel.pack(anchor=Tk.N, pady=5) textControlPanel.pack_propagate(0) lTextControlPanel = Tk.Label(textControlPanel, text='Control Panel: ', font=("Gills Sans MT", 15, "bold"), bg="beige") lTextControlPanel.pack(side=Tk.LEFT) bTextRemTab = Tk.Button(textControlPanel, text='Rem Tab', command=(lambda: textRemTab(textTabs)), bg='red') bTextRemTab.pack(side=Tk.LEFT) bTextAddTab = Tk.Button( textControlPanel, text='AddTab', command=(lambda: textAddTab(textTabs, res, TEFILES))) bTextAddTab.pack(side=Tk.LEFT) bTextManageFiles = Tk.Button(textControlPanel, text='Manage Files', command=(lambda: textManageFiles())) bTextManageFiles.pack(side=Tk.LEFT) #Quit or Open up new Window Frame textquitNew = Tk.Frame(textControlPanel, bg='beige') textquitNew.pack(side=Tk.RIGHT, padx=10) bTextQuit = Tk.Button(textquitNew, text="Quit", bg='red', command=(lambda: tmpquit(instance))) bTextQuit.pack(side=Tk.LEFT) if res == 'small': textMainFrame = Tk.Frame(textEditor, width=1250, height=750, borderwidth=5, relief=Tk.GROOVE) elif res == 'medium': textMainFrame = Tk.Frame(textEditor, width=1615, height=969, borderwidth=5, relief=Tk.GROOVE) else: textMainFrame = Tk.Frame(textEditor, width=1615, height=969, borderwidth=5, relief=Tk.GROOVE) textMainFrame.pack(pady=5) textMainFrame.pack_propagate(0) textTabs = Pmw.NoteBook(textMainFrame) textTabs.pack(fill='both', expand='true') textAddTab(textTabs, res, TEFILES) instance.mainloop()
def startup(res, TEFILES): global vars # The Main Window Stuff # Instantiate the window instance = Tk.Tk(); instance.title("AerialVision GPU Graphing Tool") #set the window size if res == 'small': root = Tk.Frame(instance, width = 1325, height = 850, bg = 'white'); elif res == 'medium': root = Tk.Frame(instance, width = 1700, height = 1100, bg = 'white'); else: root = Tk.Frame(instance, width = 1700, height = 1100, bg = 'white'); root.pack_propagate(0); root.pack(); # User can choose between a text editor or a visualizer chooseTextVisualizer = Pmw.NoteBook(root) chooseTextVisualizer.pack(fill= 'both', expand = 'true') visualizer = chooseTextVisualizer.add('Visualizer') textEditor = chooseTextVisualizer.add('Source Code View') #INITIALIZING THE VISUALIZER #The top frame for the control panel # Frame for Control Panel if res == 'small': controlPanel = Tk.Frame(visualizer, width=1250, height= 50, bg ="beige", borderwidth = 5, relief = Tk.GROOVE); elif res == 'medium': controlPanel = Tk.Frame(visualizer, width=1530, height= 50, bg ="beige", borderwidth = 5, relief = Tk.GROOVE); else: controlPanel = Tk.Frame(visualizer, width=1530, height= 50, bg ="beige", borderwidth = 5, relief = Tk.GROOVE); controlPanel.pack(anchor = Tk.N, pady = 5); controlPanel.pack_propagate(0) # Control Panel Title controlTitle = Tk.Frame(controlPanel, bg = 'beige') controlTitle.pack(side = Tk.LEFT) lControlTitle = Tk.Label(controlTitle, text='Control Panel: ', font = ("Gills Sans MT", 15, "bold"), bg = "beige"); lControlTitle.pack(side = Tk.LEFT) #Number of Tabs Frame) numbTabs = Tk.Frame(controlPanel, bg = 'beige') numbTabs.pack(side = Tk.LEFT) eAddTab = Tk.Entry(numbTabs) bRemTab = Tk.Button(numbTabs, text = "Rem Tab", command = (lambda: remTab(graphTabs)), bg = 'red') bRemTab.pack(side=Tk.LEFT) bAddTab = Tk.Button(numbTabs, text = "Add Tab", command = (lambda: graphAddTab(vars, graphTabs, res, eAddTab))) bAddTab.pack(side=Tk.LEFT) eAddTab.pack(side = Tk.LEFT) eAddTab.insert(0, 'TabTitle?') bManageFiles = Tk.Button(numbTabs, text = "Manage Files", command = lambda: manageFiles()) bManageFiles.pack(side = Tk.LEFT) #Quit or Open up new Window Frame quitNew = Tk.Frame(controlPanel, bg = 'beige') quitNew.pack(side = Tk.RIGHT, padx = 10) bQuit = Tk.Button(quitNew, text = "Quit", bg = 'red', command = (lambda: tmpquit(instance))) bQuit.pack(side = Tk.LEFT) #The bottom Frame that contains tabs,graphs,etc... #Instantiating the Main frame #Frame for Graphing Area if res == 'small': graphMainFrame = Tk.Frame(visualizer, width = 1250, height = 750, borderwidth = 5, relief = Tk.GROOVE); elif res == 'medium': graphMainFrame = Tk.Frame(visualizer, width = 1615, height = 969, borderwidth = 5, relief = Tk.GROOVE); else: graphMainFrame = Tk.Frame(visualizer, width = 1615, height = 969, borderwidth = 5, relief = Tk.GROOVE); graphMainFrame.pack(pady = 5); graphMainFrame.pack_propagate(0); #Setting up the Tabs graphTabs = Pmw.NoteBook(graphMainFrame) graphTabs.pack(fill = 'both', expand = 'true') #Class newTab will take "graphTabs" which is the widget on top of graphMainFrame and create a new tab #for every instance of the class # Here we extract the available data that can be graphed by the user for files in Filenames: vars[files] = lexyacc.parseMe(files) markForDel = {} for files in vars: markForDel[files] = [] for variables in vars[files]: if variables == 'CFLOG': continue if checkEmpty(vars[files][variables].data) == 0: markForDel[files].append(variables) for files in markForDel: for variables in markForDel[files]: del vars[files][variables] for files in Filenames: vars[files] = organizedata.organizedata(vars[files]) graphAddTab(vars, graphTabs, res, eAddTab) # INITIALIZING THE TEXT EDITOR if res == 'small': textControlPanel = Tk.Frame(textEditor, width = 1250, height = 50, bg = 'beige', borderwidth = 5, relief = Tk.GROOVE) elif res == 'medium': textControlPanel = Tk.Frame(textEditor, width = 1530, height = 50, bg = 'beige', borderwidth = 5, relief = Tk.GROOVE) else: textControlPanel = Tk.Frame(textEditor, width = 1530, height = 50, bg = 'beige', borderwidth = 5, relief = Tk.GROOVE) textControlPanel.pack(anchor = Tk.N, pady = 5) textControlPanel.pack_propagate(0) lTextControlPanel = Tk.Label(textControlPanel, text = 'Control Panel: ', font = ("Gills Sans MT", 15, "bold"), bg = "beige") lTextControlPanel.pack(side = Tk.LEFT) bTextRemTab = Tk.Button(textControlPanel, text = 'Rem Tab', command = (lambda: textRemTab(textTabs)), bg = 'red') bTextRemTab.pack(side = Tk.LEFT) bTextAddTab = Tk.Button(textControlPanel, text = 'AddTab', command = (lambda: textAddTab(textTabs,res, TEFILES))) bTextAddTab.pack(side= Tk.LEFT) bTextManageFiles = Tk.Button(textControlPanel, text = 'Manage Files', command = (lambda: textManageFiles())) bTextManageFiles.pack(side = Tk.LEFT) #Quit or Open up new Window Frame textquitNew = Tk.Frame(textControlPanel, bg = 'beige') textquitNew.pack(side = Tk.RIGHT, padx = 10) bTextQuit = Tk.Button(textquitNew, text = "Quit", bg = 'red', command = (lambda: tmpquit(instance))) bTextQuit.pack(side = Tk.LEFT) if res == 'small': textMainFrame = Tk.Frame(textEditor, width = 1250, height = 750, borderwidth = 5, relief = Tk.GROOVE) elif res == 'medium': textMainFrame = Tk.Frame(textEditor, width = 1615, height = 969, borderwidth = 5, relief = Tk.GROOVE) else: textMainFrame = Tk.Frame(textEditor, width = 1615, height = 969, borderwidth = 5, relief = Tk.GROOVE) textMainFrame.pack(pady = 5) textMainFrame.pack_propagate(0) textTabs = Pmw.NoteBook(textMainFrame) textTabs.pack(fill = 'both', expand = 'true') textAddTab(textTabs, res, TEFILES) instance.mainloop()