- 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):
|
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, 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()
|
get_db().commit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
33
app/gui.py
33
app/gui.py
@@ -2,8 +2,8 @@
|
|||||||
import wx
|
import wx
|
||||||
from plot import *
|
from plot import *
|
||||||
from database import *
|
from database import *
|
||||||
|
|
||||||
import flask as fla
|
import flask as fla
|
||||||
|
|
||||||
class MainWindow(wx.Frame):
|
class MainWindow(wx.Frame):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -42,13 +42,14 @@ class MainWindow(wx.Frame):
|
|||||||
self.switchPanels()
|
self.switchPanels()
|
||||||
|
|
||||||
def onUser(self, e):
|
def onUser(self, e):
|
||||||
self.active = 1
|
|
||||||
longn = e.GetEventObject().GetLabelText()
|
longn = e.GetEventObject().GetLabelText()
|
||||||
for user in get_users():
|
for user in get_users():
|
||||||
if user.longname == longn:
|
if user.longname == longn:
|
||||||
self.user = user
|
self.user = user
|
||||||
print self.user.id
|
if not self.user.isblack:
|
||||||
print self.user.email
|
self.active = 1 #getränkeauswahl
|
||||||
|
else:
|
||||||
|
self.active = 0 #start TODO: Sorry Bro Panel
|
||||||
self.switchPanels()
|
self.switchPanels()
|
||||||
|
|
||||||
def onProduct(self, e):
|
def onProduct(self, e):
|
||||||
@@ -124,12 +125,13 @@ class Panel1 (wx.Panel):
|
|||||||
buttonids = []
|
buttonids = []
|
||||||
i = 0
|
i = 0
|
||||||
for product in products:
|
for product in products:
|
||||||
#480x320
|
if product.isshown:
|
||||||
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))
|
#480x320
|
||||||
but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
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))
|
||||||
print "Button %s created" % product.name
|
but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
self.Bind(wx.EVT_BUTTON, parent.onProduct, id=but.Id)
|
print "Button %s created" % product.name
|
||||||
i = i+1
|
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 = 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.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()
|
users = get_users()
|
||||||
names = list()
|
names = list()
|
||||||
for user in users:
|
for user in users:
|
||||||
names.append(user.longname)
|
if user.isshown:
|
||||||
|
names.append(user.longname)
|
||||||
|
|
||||||
i = 0
|
|
||||||
|
|
||||||
self.but_names = list()
|
self.but_names = list()
|
||||||
for user in users:
|
i = 0
|
||||||
|
for name in names:
|
||||||
#480x320
|
#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"))
|
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.Bind(wx.EVT_BUTTON, parent.onUser, id=but.Id)
|
||||||
self.but_names.append(but)
|
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 = 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"))
|
b_up.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
|
|||||||
@@ -10,9 +10,15 @@
|
|||||||
<p> {{ message }} </p>
|
<p> {{ message }} </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>
|
<p>
|
||||||
Möchtest du etwas konsumieren?
|
{% if user.isblack %}
|
||||||
{% for product in products %}
|
Sorry, du bist geschwärzt!
|
||||||
<div><p> {{ product.id }}, <a href="/consume?prodid={{product.id}}"> {{product.name}} </a>, {{"%0.2f" % product.price}} € </p> </div>
|
{% else %}
|
||||||
{% endfor %}
|
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>
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
BIN
test/database.db
BIN
test/database.db
Binary file not shown.
Reference in New Issue
Block a user