63 lines
1.5 KiB
Python
63 lines
1.5 KiB
Python
from gi.overrides.keysyms import value
|
|
from nicegui import ui, events
|
|
from users import *
|
|
from definitions import *
|
|
|
|
@ui.page('/login')
|
|
def page_login():
|
|
ui.label('Loginseite')
|
|
|
|
@ui.page('/stamping')
|
|
def page_stamping():
|
|
ui.label('Stempelsteite')
|
|
|
|
@ui.page('/touchscreen')
|
|
def page_touchscreen():
|
|
|
|
def button_click(name):
|
|
nonlocal buttons
|
|
current_user = user(name)
|
|
current_user.timestamp()
|
|
if current_user.stamp_status() == status_in:
|
|
buttons[name].props('color=green')
|
|
ui.notify(status_in)
|
|
else:
|
|
buttons[name].props('color=red')
|
|
ui.notify(status_out)
|
|
|
|
ui.markdown(f"##{app_title} {app_version}")
|
|
ui.html('<center>')
|
|
userlist = list_users()
|
|
number_of_users = len(userlist)
|
|
buttons = { }
|
|
|
|
for name in userlist:
|
|
current_user = user(name)
|
|
current_button = ui.button(current_user.fullname, on_click=lambda name=name: button_click(name))
|
|
if current_user.stamp_status() == status_in:
|
|
current_button.props('color=green')
|
|
else:
|
|
current_button.props('color=red')
|
|
buttons[name] = current_button
|
|
ui.html("</center>")
|
|
|
|
|
|
@ui.page('/userlist')
|
|
def page_userlist():
|
|
|
|
def click_button(button):
|
|
ui.notify(button)
|
|
|
|
ui.markdown(f"#{app_title} {app_version}")
|
|
|
|
userlist = list_users()
|
|
buttons = { }
|
|
|
|
for name in userlist:
|
|
button = ui.button(text=name, on_click=lambda name=name:click_button(name) )
|
|
buttons[name] = button
|
|
|
|
ui.run(port=8090)
|
|
|
|
|