Erste Versuche WebUI mit NiceGUI
This commit is contained in:
parent
5a4cafe2a2
commit
a4a50e7d13
Binary file not shown.
@ -13,7 +13,7 @@ userfolder = "users"
|
||||
# Dateinamen
|
||||
|
||||
usersettingsfilename = "settings.json"
|
||||
photofilename = "photo.png"
|
||||
photofilename = "photo.jpg"
|
||||
|
||||
# Status
|
||||
|
||||
|
@ -1,12 +1,28 @@
|
||||
from nicegui import ui
|
||||
from users import *
|
||||
from definitions import *
|
||||
|
||||
def pinpad():
|
||||
@ui.page('/login')
|
||||
def page_login():
|
||||
ui.label('Loginseite')
|
||||
|
||||
def update_time():
|
||||
string_time = strftime('%A, der %d.%m.%Y - %H:%M:%S')
|
||||
nonlocal digital_clock
|
||||
digital_clock
|
||||
digital_clock.after(1000, update_time)
|
||||
@ui.page('/stamping')
|
||||
def page_stamping():
|
||||
ui.label('Stempelsteite')
|
||||
|
||||
digital_clock = ui.label()
|
||||
update_time()
|
||||
@ui.page('/userlist')
|
||||
def page_userlist():
|
||||
|
||||
def click_button(button):
|
||||
ui.notify(button)
|
||||
|
||||
ui.label(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)
|
||||
|
27
users/test/settings.json
Normal file
27
users/test/settings.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"username": "test",
|
||||
"name": "Karl Klammer",
|
||||
"password": "123456789",
|
||||
"workhours": {
|
||||
"2024-04-01": {
|
||||
"0": "0",
|
||||
"1": "8",
|
||||
"2": "8",
|
||||
"3": "8",
|
||||
"4": "8",
|
||||
"5": "8",
|
||||
"6": "0",
|
||||
"vacation": "30"
|
||||
},
|
||||
"2024-04-07": {
|
||||
"0": "0",
|
||||
"1": "6",
|
||||
"2": "6",
|
||||
"3": "6",
|
||||
"4": "8",
|
||||
"5": "6",
|
||||
"6": "0",
|
||||
"vacation": "28"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"username": "testuser",
|
||||
"name": "Der neue Tester",
|
||||
"name": "Otto Octavius",
|
||||
"password": "123456789",
|
||||
"workhours": {
|
||||
"2024-04-01": {
|
||||
|
27
users/testuser2/settings.json
Normal file
27
users/testuser2/settings.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"username": "testuser",
|
||||
"name": "Peter Pan",
|
||||
"password": "123456789",
|
||||
"workhours": {
|
||||
"2024-04-01": {
|
||||
"0": "0",
|
||||
"1": "8",
|
||||
"2": "8",
|
||||
"3": "8",
|
||||
"4": "8",
|
||||
"5": "8",
|
||||
"6": "0",
|
||||
"vacation": "30"
|
||||
},
|
||||
"2024-04-07": {
|
||||
"0": "0",
|
||||
"1": "6",
|
||||
"2": "6",
|
||||
"3": "6",
|
||||
"4": "8",
|
||||
"5": "6",
|
||||
"6": "0",
|
||||
"vacation": "28"
|
||||
}
|
||||
}
|
||||
}
|
46
web_ui.py
Normal file
46
web_ui.py
Normal file
@ -0,0 +1,46 @@
|
||||
from gi.overrides.keysyms import value
|
||||
from nicegui import ui
|
||||
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):
|
||||
ui.notify(name)
|
||||
|
||||
userlist = list_users()
|
||||
number_of_users = len(userlist)
|
||||
|
||||
for name in userlist:
|
||||
current_user = user(name)
|
||||
with ui.row():
|
||||
ui.markdown("**" + current_user.fullname + "**")
|
||||
ui.toggle([status_in, status_out], value=status_in, on_change=lambda: button_click())
|
||||
|
||||
@ui.page('/userlist')
|
||||
def page_userlist():
|
||||
|
||||
def click_button(button):
|
||||
ui.notify(button)
|
||||
|
||||
ui.markdown("#" + 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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user