Ejemplo n.º 1
0
 def __init__(self, *args, **kwds):
     self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
     # begin wxGlade: Stats.__init__
     kwds["style"] = wx.DEFAULT_FRAME_STYLE
     wx.Frame.__init__(self, *args, **kwds)
     self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
     self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
     sel = self.radio_box_1.GetSelection()
     print self.radio_box_1.GetString(sel)
     
     self.panel = wx.Panel(self, wx.ID_ANY)
     """ Start Pie Chart Code"""
     # make a square figure and axes
     pylab.figure(1, figsize=(6,6))
     ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
     names = ["Peter","John","James"]
     data = [12,15,8]
     title = "Are feet real?"
     self.circle = Creation("circle",names, data, title)
     self.bar = Creation("bar", names, data, title)
     self.bar.build()
     self.showGraph()
     perf_plot = 'temp.png'
     self.Fit()
     self.__set_properties()
     self.__do_layout()
Ejemplo n.º 2
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: Stats.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.panel = wx.Panel(self, wx.ID_ANY)
        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=[_("Jan"), _("Joost"), _("Klaas-Peter IV"), _("Kees-Jan"), _("Dwin")], style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[_("Grootste klootviool"), _("H**o"), _("Wie lijkt het meest op Dwin"), _("Wie is Kees-Jan")])

        self.__set_properties()
        self.__do_layout()
      
        """ Start Pie Chart Code"""
        # make a square figure and axes
        pylab.figure(1, figsize=(6,6))
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
        names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        data = [12,15,8,3,18,23,9,12]
        title = "Placeholder title"
        self.graph = Creation(names, data, title)
        self.graph.buildBar()
        self.showGraph()
        perf_plot = 'temp.png'
        self.Fit()
        self.__set_properties()
        self.__do_layout()
Ejemplo n.º 3
0
class Stats(wx.Frame):
    def __init__(self, *args, **kwds):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        # begin wxGlade: Stats.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        sel = self.radio_box_1.GetSelection()
        print self.radio_box_1.GetString(sel)
        
        self.panel = wx.Panel(self, wx.ID_ANY)
        """ Start Pie Chart Code"""
        # make a square figure and axes
        pylab.figure(1, figsize=(6,6))
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
        names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        data = [12,15,8,3,18,23,9,12]
        title = "Placeholder title"
        self.graph = Creation(names, data, title)
        self.graph.buildBar()
        self.showGraph()
        perf_plot = 'temp.png'
        self.Fit()
        self.__set_properties()
        self.__do_layout()
        # end wxGlade
    def showGraph(self):
        image = wx.Bitmap("temp.png")
        wx.StaticBitmap(self.panel, wx.ID_ANY, wx.Bitmap("temp.png"))
    def onChange(self, event):
        graphtype = self.radio_box_1.GetString(self.radio_box_1.GetSelection())
        
        if graphtype == "Circle":
            
            self.graph.buildPie()
        elif graphtype == "Bar":
            self.graph.buildBar()
        self.showGraph()
    def __set_properties(self):

        self.SetTitle(_("Changeable stats"))
        self.radio_box_1.SetSelection(0)
     

    def __do_layout(self):

        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.radio_box_1, 0, wx.EXPAND, 0)
        sizer_2.Add(self.panel, 2, wx.EXPAND, 1)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
Ejemplo n.º 4
0
    def __init__(self, *args, **kwds):
        if os.path.isfile("temp.png"):
            os.remove("temp.png")
            #print "BESTAAT"
        
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetBackgroundColour((92,48,0))
        self.savebutton = wx.Button(self, wx.ID_ANY, "Opslaan")
        self.backbutton = wx.Button(self, wx.ID_ANY, "Terug")
        self.backbutton.Bind(wx.EVT_BUTTON, self.onBack)
        self.savebutton.Bind(wx.EVT_BUTTON, self.onSave)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, ("Soort grafiek"), choices=[("Bar"), ("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        
        pylab.figure(1, figsize=(6,6))
        
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])

        
        #names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        self.data = [0]
        names= [""]
        title = "Placeholder title"
        self.graph = Creation(names, self.data, title)
        #self.graph.buildBar()
        
        perf_plot = 'temp.png'
        names = self.getNames()
        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=names,
                                                                 style=wx.LB_MULTIPLE)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[("Wie haalt het vaakst?"), ("Wie is de grootste wanbetaler?"),
                                                               ("Welke dranken worden het meest gehaald?"), ("Wie geeft het gulst?")])
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        self.list_box_2.Bind(wx.EVT_LISTBOX, self.onUpdateData)
        self.list_box_3.Bind(wx.EVT_LISTBOX, self.onUpdateNames)
        sel = self.radio_box_1.GetSelection()
        ##print self.radio_box_1.GetString(sel)
        self.__set_properties()
        self.onUpdateNames(wx.EVT_LISTBOX)
        self.onUpdateData(wx.EVT_LISTBOX)
        
        self.__do_layout()
Ejemplo n.º 5
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: Stats.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        pylab.figure(1, figsize=(6,6))
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
        names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        data = [12,15,8,3,18,23,9,12]
        title = "Placeholder title"
        self.graph = Creation(names, data, title)
        self.graph.buildBar()
    
        perf_plot = 'temp.png'

        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=[_("Jan"), _("Joost"), _("Klaas-Peter IV"), _("Kees-Jan"), _("Dwin")], style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[_("Grootste klootviool"), _("H**o"), _("Wie lijkt het meest op Dwin"), _("Wie is Kees-Jan")])
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        sel = self.radio_box_1.GetSelection()
        print self.radio_box_1.GetString(sel)
        self.__set_properties()
        self.__do_layout()
Ejemplo n.º 6
0
    def __init__(self, *args, **kwds):
        if os.path.isfile("temp.png"):
            os.remove("temp.png")
            print "BESTAAT"
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        
        pylab.figure(1, figsize=(6,6))
        
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])

        names = ["Dwin"]
        #names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        self.data = [5]
        title = "Placeholder title"
        self.graph = Creation(names, self.data, title)
        #self.graph.buildBar()
        
        perf_plot = 'temp.png'

        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=[_("Iedereen"),_("Jan"), _("Joost"),
                                                               _("Klaas-Peter IV"), _("Kees-Jan"), _("Dwin")],
                                                                 style=wx.LB_MULTIPLE)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[_("Grootste klootviool"), _("H**o"), _("Wie lijkt het meest op Dwin"), _("Wie is Kees-Jan")])
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        self.list_box_2.Bind(wx.EVT_LISTBOX, self.onUpdateData)
        self.list_box_3.Bind(wx.EVT_LISTBOX, self.onUpdateNames)
        sel = self.radio_box_1.GetSelection()
        print self.radio_box_1.GetString(sel)
        self.__set_properties()
        self.onUpdateNames(wx.EVT_LISTBOX)
        self.onUpdateData(wx.EVT_LISTBOX)
        
        self.__do_layout()
Ejemplo n.º 7
0
class Stats(wx.Frame):
    def __init__(self, *args, **kwds):
        if os.path.isfile("temp.png"):
            os.remove("temp.png")
            #print "BESTAAT"
        
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetBackgroundColour((92,48,0))
        self.savebutton = wx.Button(self, wx.ID_ANY, "Opslaan")
        self.backbutton = wx.Button(self, wx.ID_ANY, "Terug")
        self.backbutton.Bind(wx.EVT_BUTTON, self.onBack)
        self.savebutton.Bind(wx.EVT_BUTTON, self.onSave)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, ("Soort grafiek"), choices=[("Bar"), ("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        
        pylab.figure(1, figsize=(6,6))
        
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])

        
        #names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        self.data = [0]
        names= [""]
        title = "Placeholder title"
        self.graph = Creation(names, self.data, title)
        #self.graph.buildBar()
        
        perf_plot = 'temp.png'
        names = self.getNames()
        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=names,
                                                                 style=wx.LB_MULTIPLE)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[("Wie haalt het vaakst?"), ("Wie is de grootste wanbetaler?"),
                                                               ("Welke dranken worden het meest gehaald?"), ("Wie geeft het gulst?")])
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        self.list_box_2.Bind(wx.EVT_LISTBOX, self.onUpdateData)
        self.list_box_3.Bind(wx.EVT_LISTBOX, self.onUpdateNames)
        sel = self.radio_box_1.GetSelection()
        ##print self.radio_box_1.GetString(sel)
        self.__set_properties()
        self.onUpdateNames(wx.EVT_LISTBOX)
        self.onUpdateData(wx.EVT_LISTBOX)
        
        self.__do_layout()
    def onSave(self, event):
        newname = str(time.strftime("%y_%m_%d_%H_%M_%S"))
        newname+=".png"
        shutil.copy("temp.png",newname)
    def onBack(self, event):
        self.Hide()
    def getNames(self):
        self.db = BakkieControlDatabase()
        namelist = self.db.getUsers()
        ##print namelist
        newnames = ['iedereen']
        for tup in namelist:
            newnames.append(tup[1])
        return newnames
    def onUpdateNames(self, event):
        self.updateNames()
        
        self.onUpdateData(wx.EVT_LISTBOX)
        
        
        self.onChange(wx.EVT_RADIOBOX)
    def updateNames(self):
        selected = self.list_box_3.GetSelections()
        
        if selected[0] == 0:
            ##print "IEDEREEN"
            
            for name in range(self.list_box_3.GetCount()):
                self.list_box_3.Select(name)
                
                ##print name
            selected = self.list_box_3.GetSelections()[1:]   
        newnames = []
        
        
        for selection in selected:
            newnames.append(str(self.list_box_3.GetString(selection)))
        ##print newnames
        self.graph.setNames(newnames)
        ##print self.graph.getNames()
        data = self.graph.getData()
        self.graph.setData(data[:len(newnames)])
        #self.__do_layout()
    def onUpdateData(self, event):
        self.updateNames()
        stat = self.list_box_2.GetSelection()
        names = self.graph.getNames()
        ##print stat
        if stat == 0:
            freqs = self.db.getUserFreqs()
            
            data_names = []
            data_nums= []
            newdata = []
            for tup in freqs:
                data_names.append(tup[0])
                data_nums.append(tup[1])
            ##print data_names , "D_N"
            
            newdata = []
            for name in names:
                if name in data_names:
                    namenum = data_names.index(name)
                    newdata.append(data_nums[namenum])
                else:
                    newdata.append(0)
                
                    
                
        elif stat == 1:
            debt = self.db.getUserSchulden()
            #print debt
            data_names = []
            data_nums = []
            newdata = []
            for tup in debt:
                data_names.append(tup[0])
                data_nums.append(tup[1])
            for name in names:
                if name in data_names:
                    namenum = data_names.index(name)
                    newdata.append(data_nums[namenum])
                else:
                    newdata.append(0)
        elif stat == 2:
            
            freqs = self.db.getFrequenties()
            data_drinks = []
            data_nums = []
            newdata = []
            for tup in freqs:
                data_drinks.append(tup[0])
                data_nums.append(tup[1])
            
            self.graph.setNames(data_drinks)
            newdata = data_nums
        elif stat == 3:
            loan = self.db.getOpenstaand()
            #print loan
            data_names = []
            data_nums = []
            newdata = []
            for tup in loan:
                data_names.append(tup[0])
                data_nums.append(tup[1])
            for name in names:
                if name in data_names:
                    namenum = data_names.index(name)
                    newdata.append(data_nums[namenum])
                else:
                    newdata.append(0)
        #print self.graph.getData(),"ervoor"
        self.graph.setData(newdata)
        
        self.graph.setTitle(str(self.list_box_2.GetString(stat)))
        #print self.graph.getData(),"erna"
        self.onChange(wx.EVT_RADIOBOX)
    def onChange(self, event):
        graphtype = self.radio_box_1.GetString(self.radio_box_1.GetSelection())
        
        if graphtype == "Circle":
            self.graph.buildPie()
        elif graphtype == "Bar":
            self.graph.buildBar()
            
        self.__do_layout()
    def __set_properties(self):

        self.SetTitle(("Statistieken"))
        self.SetSize((900, 675))
        self.radio_box_1.SetSelection(0)
        self.list_box_3.SetSelection(0)
        self.list_box_2.SetSelection(0)
        #self.radio_box_1.SetBackgroudColour((46,24,0))
    
    def __do_layout(self):

        self.image = wx.Image("temp.png")
        self.image.Rescale(666,500)
        image2 = wx.Bitmap(self.image)
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, image2)
        sizer_1 = wx.BoxSizer(wx.VERTICAL) #sizers
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL) # list boxes1
        sizer_2 = wx.BoxSizer(wx.VERTICAL) #Radiobox, bitmap
        sizer_4 = wx.BoxSizer(wx.HORIZONTAL) # Radiobox, buttons
        sizer_5 = wx.BoxSizer(wx.HORIZONTAL) #Butons
        sizer_4.Add(self.radio_box_1, 2, wx.EXPAND, 0)
        sizer_4.Add(sizer_5, 1, wx.EXPAND, 0)
        sizer_5.Add(self.backbutton, 1, wx.EXPAND, 0)
        sizer_5.Add(self.savebutton, 1, wx.EXPAND, 0)
        sizer_2.Add(sizer_4, 1, wx.EXPAND, 0)
        sizer_2.Add(self.bitmap_1, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
 
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_3, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_2, 1, wx.EXPAND, 0)
        sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
        
        self.SetSizer(sizer_1)
        
        self.Layout()
Ejemplo n.º 8
0
class Stats(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: Stats.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.panel = wx.Panel(self, wx.ID_ANY)
        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=[_("Jan"), _("Joost"), _("Klaas-Peter IV"), _("Kees-Jan"), _("Dwin")], style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[_("Grootste klootviool"), _("H**o"), _("Wie lijkt het meest op Dwin"), _("Wie is Kees-Jan")])

        self.__set_properties()
        self.__do_layout()
      
        """ Start Pie Chart Code"""
        # make a square figure and axes
        pylab.figure(1, figsize=(6,6))
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
        names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        data = [12,15,8,3,18,23,9,12]
        title = "Placeholder title"
        self.graph = Creation(names, data, title)
        self.graph.buildBar()
        self.showGraph()
        perf_plot = 'temp.png'
        self.Fit()
        self.__set_properties()
        self.__do_layout()
        # end wxGlade
    def showGraph(self):
        image = wx.Bitmap("temp.png")
        wx.StaticBitmap(self.panel, wx.ID_ANY, wx.Bitmap("temp.png"))
    def onChange(self, event):
        graphtype = self.radio_box_1.GetString(self.radio_box_1.GetSelection())
        
        if graphtype == "Circle":
            
            self.graph.buildPie()
        elif graphtype == "Bar":
            self.graph.buildBar()
        self.showGraph()

    def __set_properties(self):
        # begin wxGlade: Stats.__set_properties
        self.SetTitle(_("frame_1"))
        self.radio_box_1.SetSelection(0)
        self.list_box_3.SetSelection(0)
        self.list_box_2.SetSelection(0)
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Stats.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.radio_box_1, 0, wx.EXPAND, 0)
        sizer_2.Add(self.panel, 2, wx.EXPAND, 1)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_3, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_2, 1, wx.EXPAND, 0)
        sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
Ejemplo n.º 9
0
class Stats(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: Stats.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        pylab.figure(1, figsize=(6,6))
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
        names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        data = [12,15,8,3,18,23,9,12]
        title = "Placeholder title"
        self.graph = Creation(names, data, title)
        self.graph.buildBar()
    
        perf_plot = 'temp.png'

        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=[_("Jan"), _("Joost"), _("Klaas-Peter IV"), _("Kees-Jan"), _("Dwin")], style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[_("Grootste klootviool"), _("H**o"), _("Wie lijkt het meest op Dwin"), _("Wie is Kees-Jan")])
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        sel = self.radio_box_1.GetSelection()
        print self.radio_box_1.GetString(sel)
        self.__set_properties()
        self.__do_layout()
        # end wxGlade
    def onChange(self, event):
        graphtype = self.radio_box_1.GetString(self.radio_box_1.GetSelection())
        
        if graphtype == "Circle":
            
            self.graph.buildPie()
        elif graphtype == "Bar":
            self.graph.buildBar()
        self.__do_layout()
    def __set_properties(self):
        # begin wxGlade: Stats.__set_properties
        self.SetTitle(_("frame_1"))
        self.SetSize((900, 675))
        self.radio_box_1.SetSelection(0)
        self.list_box_3.SetSelection(0)
        self.list_box_2.SetSelection(0)
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Stats.__do_layout
        self.image = wx.Image("temp.png")
        self.image.Rescale(666,500)
        image2 = wx.Bitmap(self.image)
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, image2)
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.radio_box_1, 0, wx.EXPAND, 0)
        sizer_2.Add(self.bitmap_1, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_3, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_2, 1, wx.EXPAND, 0)
        sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        
        self.Layout()
Ejemplo n.º 10
0
def setup_database():
    create = Creation()

    print("DATABASE DOESN'T EXIST")
    print("CREATING DATABASE...")
    create.create_database()
    print("CREATING PROCEDURE FOR USER...")
    create.create_proc_user()
    print("CREATING PROCEDURE FOR DATA...")
    create.create_proc_user_data()
    print("CREATING PROCEDURE FOR UPDATE DATA...")
    create.create_proc_update_data()
    print("CREATING PROCEDURE FOR GET FILES...")
    create.create_proc_get_files()
    print("CREATING PROCEDURE FOR GET USERS...")
    create.create_proc_get_users()
Ejemplo n.º 11
0
class Stats(wx.Frame):
    def __init__(self, *args, **kwds):
        if os.path.isfile("temp.png"):
            os.remove("temp.png")
            print "BESTAAT"
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, _("radio_box_1"), choices=[_("Bar"), _("Circle")], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        
        pylab.figure(1, figsize=(6,6))
        
        ax = pylab.axes([0.1, 0.1, 0.8, 0.8])

        names = ["Dwin"]
        #names = ["Peter","John","James","Mark","Bart","Jude","Andrew","Simon"]
        self.data = [5]
        title = "Placeholder title"
        self.graph = Creation(names, self.data, title)
        #self.graph.buildBar()
        
        perf_plot = 'temp.png'

        self.list_box_3 = wx.ListBox(self, wx.ID_ANY, choices=[_("Iedereen"),_("Jan"), _("Joost"),
                                                               _("Klaas-Peter IV"), _("Kees-Jan"), _("Dwin")],
                                                                 style=wx.LB_MULTIPLE)
        self.list_box_2 = wx.ListBox(self, wx.ID_ANY, choices=[_("Grootste klootviool"), _("H**o"), _("Wie lijkt het meest op Dwin"), _("Wie is Kees-Jan")])
        self.radio_box_1.Bind(wx.EVT_RADIOBOX, self.onChange)
        self.list_box_2.Bind(wx.EVT_LISTBOX, self.onUpdateData)
        self.list_box_3.Bind(wx.EVT_LISTBOX, self.onUpdateNames)
        sel = self.radio_box_1.GetSelection()
        print self.radio_box_1.GetString(sel)
        self.__set_properties()
        self.onUpdateNames(wx.EVT_LISTBOX)
        self.onUpdateData(wx.EVT_LISTBOX)
        
        self.__do_layout()
    def onUpdateNames(self, event):
  
        selected = self.list_box_3.GetSelections()
        
        if selected[0] == 0:
            print "IEDEREEN"
            
            for name in range(self.list_box_3.GetCount()):
                self.list_box_3.Select(name)
                
                print name
            selected = self.list_box_3.GetSelections()[1:]   
        newnames = []
        data = [1,2,3,4,5,6]
        
        
        for selection in selected:
            newnames.append(str(self.list_box_3.GetString(selection)))
        #print newnames
        self.graph.setNames(newnames)
        #print self.graph.getNames()
        self.graph.setData(data[:len(newnames)])
        #self.__do_layout()
        self.onChange(wx.EVT_RADIOBOX)
    def onUpdateData(self, event):
        stat = self.list_box_2.GetSelection()
        #print stat
        if stat == 0:
            newdata = [1,2,3,4,5,6]
        elif stat == 1:
            newdata = [6,5,4,3,2,1]
        elif stat == 2:
            newdata = [12,10,8,6,13,1]
        elif stat == 3:
            newdata = [7,23,1,17,5,6]
        self.graph.setData(newdata[:len(self.graph.getNames())])
        self.graph.setTitle(str(self.list_box_2.GetString(stat)))
        print self.graph.getData()
        self.onChange(wx.EVT_RADIOBOX)
    def onChange(self, event):
        graphtype = self.radio_box_1.GetString(self.radio_box_1.GetSelection())
        
        if graphtype == "Circle":
            self.graph.buildPie()
        elif graphtype == "Bar":
            self.graph.buildBar()
            
        self.__do_layout()
    def __set_properties(self):

        self.SetTitle(_("frame_1"))
        self.SetSize((900, 675))
        self.radio_box_1.SetSelection(0)
        self.list_box_3.SetSelection(0)
        self.list_box_2.SetSelection(0)

    
    def __do_layout(self):

        self.image = wx.Image("temp.png")
        self.image.Rescale(666,500)
        image2 = wx.Bitmap(self.image)
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, image2)
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.radio_box_1, 0, wx.EXPAND, 0)
        sizer_2.Add(self.bitmap_1, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_3, 1, wx.EXPAND, 0)
        sizer_3.Add(self.list_box_2, 1, wx.EXPAND, 0)
        sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        
        self.Layout()
Ejemplo n.º 12
0
sys.path.append("{}/Class_Server".format(
    os.path.dirname(os.path.realpath(__file__))))
sys.path.append(os.path.dirname(os.path.realpath(__file__)))

from functionDataBase import FunctionDataBase
from home import Home
from creation import Creation
from admin import Admin
from research import Research

DATA_PATH = '../../Data Base/DataBase.db'

db = FunctionDataBase()
a = Home()
c = Creation()
r = Research()
admin = Admin()


@get('/')
def printHome():
    """
	Permit to redirect if 
		nobody is in database
		or to authenticate
	"""
    return a.get_home(DATA_PATH, db)


@post('/')