diff --git a/app/gui.py b/app/gui.py index 0efca8c..5c30050 100644 --- a/app/gui.py +++ b/app/gui.py @@ -47,6 +47,7 @@ class MainWindow(wx.Frame): if user.longname == longn: self.user = user if not self.user.isblack: + self.panelUser.l_user.SetLabel(self.user.longname) self.active = 1 #getränkeauswahl else: self.active = 0 #start TODO: Sorry Bro Panel @@ -93,8 +94,8 @@ class PanelStart (wx.Panel): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320)) #panel = wx.Panel(self, -1) self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./app/static/start.png", wx.BITMAP_TYPE_ANY)) - self.Bind(wx.EVT_LEFT_UP, parent.onStart) - self.bitmap_1.Bind(wx.EVT_LEFT_UP, parent.onStart) + self.Bind(wx.EVT_LEFT_DOWN, parent.onStart) + self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart) def on_quit(self, e): print "close" @@ -106,7 +107,7 @@ class PanelThanks (wx.Panel): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320)) #panel = wx.Panel(self, -1) self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./app/static/thanks.png", wx.BITMAP_TYPE_ANY)) - self.Bind(wx.EVT_LEFT_UP, parent.onStart) + self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart) self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100)) self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) @@ -127,26 +128,29 @@ class Panel1 (wx.Panel): for product in products: if product.isshown: #480x320 - but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + "%0.2f" % product.price, pos=(0+i*120, 0), size=(120, 120)) - but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) + self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + "%0.2f" % product.price, pos=(0+i*120, 0), size=(120, 120)) + self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) print "Button %s created" % product.name - self.Bind(wx.EVT_BUTTON, parent.onProduct, id=but.Id) + self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id) i = i+1 self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,240), size=(120, 80)) self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - self.Bind(wx.EVT_BUTTON, self.onLess, id=self.b_less.Id) + self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id) self.l_amount = wx.StaticText(self, wx.ID_ANY, "1", pos=(145,245), style=wx.ALIGN_CENTER) self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans")) self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,240), size=(120, 80)) self.b_more.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - self.Bind(wx.EVT_BUTTON, self.onMore, id=self.b_more.Id) + self.b_more.Bind(wx.EVT_LEFT_DOWN, self.onMore, id=self.b_more.Id) self.b_exit = wx.Button(self, id = wx.ID_ANY, label=u"x", pos=(360,240), size=(120, 80)) self.b_exit.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - self.Bind(wx.EVT_BUTTON, parent.onExit, id=self.b_exit.Id) + self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id) + + self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=(20,170), style=wx.ALIGN_CENTER) + self.l_user.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) self.Bind(wx.EVT_CLOSE, self.on_quit) #self.Show(True) @@ -188,24 +192,23 @@ class Panel2 (wx.Panel): i = 0 for name in names: #480x320 - but = wx.Button(self, id=wx.ID_ANY, label=name, pos=(0,0+i*40), size=(400, 40)) - but.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - self.Bind(wx.EVT_BUTTON, parent.onUser, id=but.Id) - self.but_names.append(but) + self.but = wx.Button(self, id=wx.ID_ANY, label=name, pos=(0,0+i*40), size=(400, 40)) + self.but.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) + self.but.Bind(wx.EVT_LEFT_DOWN, parent.onUser, id=self.but.Id) + self.but_names.append(self.but) i += 1 - b_up = wx.Button(self, id=wx.ID_ANY, label=u"\u25B2", pos=(400,0), size=(80, 80)) - b_up.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - self.Bind(wx.EVT_BUTTON, self.on_up, id=b_up.Id) + self.b_up = wx.Button(self, id=wx.ID_ANY, label=u"\u25B2", pos=(400,0), size=(80, 80)) + self.b_up.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) + self.b_up.Bind(wx.EVT_LEFT_DOWN, self.on_up, id=self.b_up.Id) self.b_down = wx.Button(self, id=wx.ID_ANY, label=u"\u25BC", pos=(400,240), size=(80, 80)) self.b_down.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - self.Bind(wx.EVT_BUTTON, self.on_down, id=self.b_down.Id) - - b_exit = wx.Button(self, id=wx.ID_ANY, label="X", pos=(400,120), size=(80, 80)) - b_exit.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) - b_exit.Bind(wx.EVT_BUTTON, parent.onExit, id=b_exit.Id) + self.b_down.Bind(wx.EVT_LEFT_DOWN, self.on_down, id=self.b_down.Id) + self.b_exit = wx.Button(self, id=wx.ID_ANY, label="X", pos=(400,120), size=(80, 80)) + self.b_exit.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) + self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id) self.Bind(wx.EVT_CLOSE, self.on_quit) #self.Show(True) @@ -213,10 +216,12 @@ class Panel2 (wx.Panel): def on_down(self,e , id=-1): for button in self.but_names: button.SetPosition((button.GetPosition()[0],button.GetPosition()[1]-320)) + self.Layout() def on_up(self,e , id=-1): for button in self.but_names: button.SetPosition((button.GetPosition()[0],button.GetPosition()[1]+320)) + self.Layout() def on_button_press(self,e, id=-1): print e.Id