- web-if and gui now respect isshown and isblack flags
This commit is contained in:
@@ -100,7 +100,7 @@ def add_user(u):
|
||||
|
||||
def update_user(u):
|
||||
#query_db("UPDATE users SET (NAME, LONGNAME, EMAIL, RFID_ID, ISBLACK, ISBARON, ISSHOWN) VALUES (?, ?, ?, ?, ?, ?, ?) WHERE ID=?", (u.name, u.longname, u.email, u.rfid_id, u.isblack, u.isbaron, u.isshown, u.id))
|
||||
query_db("UPDATE users SET NAME=?, PASSWORD=?, LONGNAME=?, EMAIL=?, RFID_ID=?, ISBLACK=?, ISBARON=?, ISSHOWN=? WHERE ID=?", (u.name, u.password, u.longname, u.email, u.rfid_id, u.isblack, u.isbaron, u.isshown, u.id))
|
||||
query_db("UPDATE users SET NAME=?, LONGNAME=?, EMAIL=?, RFID_ID=?, ISBLACK=?, ISBARON=?, ISSHOWN=? WHERE ID=?", (u.name, u.longname, u.email, u.rfid_id, u.isblack, u.isbaron, u.isshown, u.id))
|
||||
get_db().commit()
|
||||
|
||||
|
||||
|
||||
33
app/gui.py
33
app/gui.py
@@ -2,8 +2,8 @@
|
||||
import wx
|
||||
from plot import *
|
||||
from database import *
|
||||
|
||||
import flask as fla
|
||||
|
||||
class MainWindow(wx.Frame):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -42,13 +42,14 @@ class MainWindow(wx.Frame):
|
||||
self.switchPanels()
|
||||
|
||||
def onUser(self, e):
|
||||
self.active = 1
|
||||
longn = e.GetEventObject().GetLabelText()
|
||||
for user in get_users():
|
||||
if user.longname == longn:
|
||||
self.user = user
|
||||
print self.user.id
|
||||
print self.user.email
|
||||
if not self.user.isblack:
|
||||
self.active = 1 #getränkeauswahl
|
||||
else:
|
||||
self.active = 0 #start TODO: Sorry Bro Panel
|
||||
self.switchPanels()
|
||||
|
||||
def onProduct(self, e):
|
||||
@@ -124,12 +125,13 @@ class Panel1 (wx.Panel):
|
||||
buttonids = []
|
||||
i = 0
|
||||
for product in products:
|
||||
#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"))
|
||||
print "Button %s created" % product.name
|
||||
self.Bind(wx.EVT_BUTTON, parent.onProduct, id=but.Id)
|
||||
i = i+1
|
||||
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"))
|
||||
print "Button %s created" % product.name
|
||||
self.Bind(wx.EVT_BUTTON, parent.onProduct, id=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"))
|
||||
@@ -178,18 +180,19 @@ class Panel2 (wx.Panel):
|
||||
users = get_users()
|
||||
names = list()
|
||||
for user in users:
|
||||
names.append(user.longname)
|
||||
if user.isshown:
|
||||
names.append(user.longname)
|
||||
|
||||
i = 0
|
||||
|
||||
self.but_names = list()
|
||||
for user in users:
|
||||
i = 0
|
||||
for name in names:
|
||||
#480x320
|
||||
but = wx.Button(self, id=wx.ID_ANY, label=names[i], pos=(0,0+i*40), size=(400, 40))
|
||||
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)
|
||||
i = i+1
|
||||
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"))
|
||||
|
||||
@@ -10,9 +10,15 @@
|
||||
<p> {{ message }} </p>
|
||||
{% endif %}
|
||||
<p>
|
||||
Möchtest du etwas konsumieren?
|
||||
{% for product in products %}
|
||||
<div><p> {{ product.id }}, <a href="/consume?prodid={{product.id}}"> {{product.name}} </a>, {{"%0.2f" % product.price}} € </p> </div>
|
||||
{% endfor %}
|
||||
{% if user.isblack %}
|
||||
Sorry, du bist geschwärzt!
|
||||
{% else %}
|
||||
Möchtest du etwas konsumieren?
|
||||
{% for product in products %}
|
||||
{% if product.isshown %}
|
||||
<div><p> {{ product.id }}, <a href="/consume?prodid={{product.id}}"> {{product.name}} </a>, {{"%0.2f" % product.price}} € </p> </div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
BIN
test/database.db
BIN
test/database.db
Binary file not shown.
Reference in New Issue
Block a user