Example #1
0
    def __init__(self, master, console,params,maingui):
        self.frame = Frame(master)
        self.frame.config(padx=5, pady=5, bg=Styles.colours["darkGrey"])
        self.frame.grid(row=0, column=0, sticky=W + E + N + S,columnspan=2)
        self.title = Message(self.frame, text="ProjectB: Selection",
                        justify=CENTER, bg=Styles.colours["darkGrey"],
                        foreground=Styles.colours["yellow"],
                        width=300, font=Styles.fonts["h1"])

        def importsettings(event):
            f = tkFileDialog.askopenfilename(parent=master, title='Choose a file')
            parsemodifycustomvar(params,parsein(f,parseintosimple(params),console))
            maingui.ready("model")
            maingui.ready("bayes")

        def exportfile(event):
            f = tkFileDialog.asksaveasfilename(parent=master, title='Choose a file')
            parseout(f,parseintosimple(params),console)

        self.bimport = camobutton(self.frame, "Import Settings", 15,importsettings)
        self.bexport = camobutton(self.frame, "Export Settings", 15,exportfile)
        self.badvset = yellowbutton(self.frame, "Advanced Settings", 20)

        self.badvset.bind("<Button-1>", lambda a: AdvancedSettings(console,params))
        self.qb = qbutton(self.frame)

        self.title.pack(side=LEFT, fill=BOTH, padx=5, pady=5)
        self.qb.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.badvset.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.bexport.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.bimport.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
Example #2
0
    def evaluationUI(self):
        modeldetails = header(self.frame,"Model")
        fm = Frame(self.frame)
        fm.config(bg=Styles.colours["grey"])
        resultdetails = header(self.frame,"Results")
        resultsframe = Frame(self.frame)
        resultsframe.config(bg=Styles.colours["grey"])


        #Model details
        Message(fm, text="Command:", font=Styles.fonts["h2"], bg=Styles.colours["grey"],width=200).grid(row=0,column=0,sticky=E)
        Message(fm, text=self.params["command"].get(), font=Styles.fonts["h3"], bg=Styles.colours["grey"],width=415).grid(row=0,column=1,sticky=W)
        Message(fm, text="Model Input:", font=Styles.fonts["h2"], bg=Styles.colours["grey"],width=200).grid(row=1,column=0,sticky=E)
        Message(fm, text=self.params["modelinput"].get(), font=Styles.fonts["h3"], bg=Styles.colours["grey"],width=415).grid(row=1,column=1,sticky=W)
        Message(fm, text="Model Output:", font=Styles.fonts["h2"], bg=Styles.colours["grey"],width=200).grid(row=2,column=0,sticky=E)
        Message(fm, text=self.params["modeloutput"].get(), font=Styles.fonts["h3"], bg=Styles.colours["grey"],width=415).grid(row=2,column=1,sticky=W)

        #Table Headers
        Label(resultsframe,text=" # ", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=5).grid(row=0,column=0,sticky=E)
        Label(resultsframe,text="Kernel:", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=9).grid(row=0,column=1,sticky=E)
        Label(resultsframe,text="Policy:", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=9).grid(row=0,column=2,sticky=E)
        Label(resultsframe,text="Iterations:", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=14).grid(row=0,column=3,sticky=E)
        Label(resultsframe,text="Best Result:", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=14).grid(row=0,column=4,sticky=E)
        Label(resultsframe,text="Time (s):", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=14).grid(row=0,column=5,sticky=E)
        Label(resultsframe,text="", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=14).grid(row=0,column=6,sticky=E)

        #Table Data
        for i,e in enumerate(self.experiments):
            if e.has_key("iterfinish"):
                Label(resultsframe,text=str(i+1), font=Styles.fonts["entryFilled"],bg=Styles.colours["grey"],width=5).grid(row=i+1,column=0,sticky=E)
                Label(resultsframe,text=e["kernel"].upper(), font=Styles.fonts["entryFilled"],bg=Styles.colours["grey"],width=9).grid(row=i+1,column=1,sticky=E)
                Label(resultsframe,text=e["policy"][0].upper(), font=Styles.fonts["entryFilled"],bg=Styles.colours["grey"],width=9).grid(row=i+1,column=2,sticky=E)
                Label(resultsframe,text=e["iterfinish"], font=Styles.fonts["entryFilled"],bg=Styles.colours["grey"],width=14).grid(row=i+1,column=3,sticky=E)
                Label(resultsframe,text="{0:.5f}".format(e["best"]), font=Styles.fonts["entryFilled"],bg=Styles.colours["grey"],width=14).grid(row=i+1,column=4,sticky=E)
                Label(resultsframe,text="{0:.2f}".format(e["time"]), font=Styles.fonts["entryFilled"],bg=Styles.colours["grey"],width=14).grid(row=i+1,column=5,sticky=E)
                yellowbutton(resultsframe,"Query",10,lambda x: self.query(e["modelid"])).grid(row=i+1,column=6,sticky=E,pady=3)
            else:
                Label(resultsframe,text=str(i+1), font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=5).grid(row=i+1,column=0,sticky=E)
                Label(resultsframe,text=e["kernel"].upper(), font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=9).grid(row=i+1,column=1,sticky=E)
                Label(resultsframe,text=e["policy"][0].upper(), font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=9).grid(row=i+1,column=2,sticky=E)
                Label(resultsframe,text="Not Started", font=Styles.fonts["entry"],bg=Styles.colours["grey"],width=14).grid(row=i+1,column=3,sticky=W+E,columnspan=3)

        #Footer buttons
        y1 = camobutton(self.footer,"Save Console Logs",18,click=lambda x: self.saveconsole())
        y1.config(font=Styles.fonts["h2"])
        y1.pack(side=LEFT,fill=BOTH, padx=5, pady=5)

        y2 = camobutton(self.footer,"Output Directory",18,lambda x: self.opendir())
        y2.config(font=Styles.fonts["h2"])
        y2.pack(side=LEFT,fill=BOTH, padx=5, pady=5)

        y3 = yellowbutton(self.footer,"Exit",18,lambda x: self.closeall())
        y3.config(font=Styles.fonts["h2"])
        y3.pack(side=RIGHT,fill=BOTH, padx=5, pady=5)


        #Grid everything
        #Model Title and Frame
        modeldetails.grid(row=0,column=0,columnspan=3,sticky=W + E + N + S)
        fm.grid(row=1, column=0,columnspan=3,sticky=W + E + N + S)
        #Result Title and Frame
        resultdetails.grid(row=2, column=0,columnspan=3,sticky=W + E + N + S)
        resultsframe.grid(row=3, column=0,columnspan=3,sticky=W + E + N + S)
        #Footer
        self.footer.grid(row=3,column=0,sticky=W+E+N+S,columnspan=2)