Stempelbuttons im Touchscreen
Erste Stempelfunktionen
This commit is contained in:
parent
a4a50e7d13
commit
9936f30f50
Binary file not shown.
Binary file not shown.
8
users.py
8
users.py
@ -13,9 +13,9 @@ from definitions import userfolder, scriptpath, usersettingsfilename, photofilen
|
|||||||
|
|
||||||
class user:
|
class user:
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.userfolder = scriptpath + "/" + userfolder + "/" + name
|
self.userfolder = f"{scriptpath}/{userfolder}/{name}"
|
||||||
self.settingsfile = self.userfolder + "/" + usersettingsfilename
|
self.settingsfile = f"{self.userfolder}/{usersettingsfilename}"
|
||||||
self.photofile = self.userfolder + "/" + photofilename
|
self.photofile = f"{self.userfolder}/{photofilename}"
|
||||||
|
|
||||||
# Stammdaten einlesen
|
# Stammdaten einlesen
|
||||||
try:
|
try:
|
||||||
@ -33,7 +33,7 @@ class user:
|
|||||||
def get_stamp_file(self):
|
def get_stamp_file(self):
|
||||||
year = str(datetime.datetime.now().year)
|
year = str(datetime.datetime.now().year)
|
||||||
month = str(datetime.datetime.now().month)
|
month = str(datetime.datetime.now().month)
|
||||||
completepath = self.userfolder + "/" + year + "-" + month + ".txt"
|
completepath = f"{self.userfolder}/{year}-{month}.txt"
|
||||||
return completepath
|
return completepath
|
||||||
|
|
||||||
def timestamp(self):
|
def timestamp(self):
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
1744989835
|
||||||
|
1744989837
|
||||||
|
1744989913
|
||||||
|
1744989917
|
@ -6,3 +6,11 @@
|
|||||||
1743966049
|
1743966049
|
||||||
1743967346
|
1743967346
|
||||||
1744889948
|
1744889948
|
||||||
|
1744889966
|
||||||
|
1744989797
|
||||||
|
1744989827
|
||||||
|
1744989830
|
||||||
|
1744989883
|
||||||
|
1744989909
|
||||||
|
1744989914
|
||||||
|
1744989916
|
||||||
|
BIN
users/testuser/photo.jpg
Normal file
BIN
users/testuser/photo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 560 KiB |
@ -1,2 +1,8 @@
|
|||||||
1743966330
|
1743966330
|
||||||
1743966416
|
1743966416
|
||||||
|
1744989832
|
||||||
|
1744989834
|
||||||
|
1744989905
|
||||||
|
1744989907
|
||||||
|
1744989915
|
||||||
|
1744989916
|
||||||
|
28
web_ui.py
28
web_ui.py
@ -1,5 +1,5 @@
|
|||||||
from gi.overrides.keysyms import value
|
from gi.overrides.keysyms import value
|
||||||
from nicegui import ui
|
from nicegui import ui, events
|
||||||
from users import *
|
from users import *
|
||||||
from definitions import *
|
from definitions import *
|
||||||
|
|
||||||
@ -15,16 +15,32 @@ def page_stamping():
|
|||||||
def page_touchscreen():
|
def page_touchscreen():
|
||||||
|
|
||||||
def button_click(name):
|
def button_click(name):
|
||||||
ui.notify(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()
|
userlist = list_users()
|
||||||
number_of_users = len(userlist)
|
number_of_users = len(userlist)
|
||||||
|
buttons = { }
|
||||||
|
|
||||||
for name in userlist:
|
for name in userlist:
|
||||||
current_user = user(name)
|
current_user = user(name)
|
||||||
with ui.row():
|
current_button = ui.button(current_user.fullname, on_click=lambda name=name: button_click(name))
|
||||||
ui.markdown("**" + current_user.fullname + "**")
|
if current_user.stamp_status() == status_in:
|
||||||
ui.toggle([status_in, status_out], value=status_in, on_change=lambda: button_click())
|
current_button.props('color=green')
|
||||||
|
else:
|
||||||
|
current_button.props('color=red')
|
||||||
|
buttons[name] = current_button
|
||||||
|
ui.html("</center>")
|
||||||
|
|
||||||
|
|
||||||
@ui.page('/userlist')
|
@ui.page('/userlist')
|
||||||
def page_userlist():
|
def page_userlist():
|
||||||
@ -32,7 +48,7 @@ def page_userlist():
|
|||||||
def click_button(button):
|
def click_button(button):
|
||||||
ui.notify(button)
|
ui.notify(button)
|
||||||
|
|
||||||
ui.markdown("#" + app_title + " " + app_version)
|
ui.markdown(f"#{app_title} {app_version}")
|
||||||
|
|
||||||
userlist = list_users()
|
userlist = list_users()
|
||||||
buttons = { }
|
buttons = { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user