Touchscreen einstellbar
This commit is contained in:
parent
4def6c50fa
commit
78c8aab781
18
admin.py
18
admin.py
@ -611,8 +611,11 @@ Dies kann nicht rückgängig gemacht werden!''')
|
|||||||
output_dict["admin_password"] = data["admin_password"]
|
output_dict["admin_password"] = data["admin_password"]
|
||||||
output_dict["port"] = port.value
|
output_dict["port"] = port.value
|
||||||
output_dict["secret"] = secret
|
output_dict["secret"] = secret
|
||||||
|
output_dict["touchscreen"] = touchscreen_switch.value
|
||||||
output_dict["times_on_touchscreen"] = timestamp_switch.value
|
output_dict["times_on_touchscreen"] = timestamp_switch.value
|
||||||
output_dict["photos_on_touchscreen"] = photo_switch.value
|
output_dict["photos_on_touchscreen"] = photo_switch.value
|
||||||
|
output_dict["picture_height"] = picture_height_input.value
|
||||||
|
output_dict["button_height"] = button_height_input.value
|
||||||
output_dict["holidays"] = data["holidays"]
|
output_dict["holidays"] = data["holidays"]
|
||||||
json_dict = json.dumps(output_dict, indent=4)
|
json_dict = json.dumps(output_dict, indent=4)
|
||||||
with open(os.path.join(scriptpath, usersettingsfilename), "w") as outputfile:
|
with open(os.path.join(scriptpath, usersettingsfilename), "w") as outputfile:
|
||||||
@ -652,12 +655,14 @@ Dies kann nicht rückgängig gemacht werden!''')
|
|||||||
|
|
||||||
|
|
||||||
with ui.card():
|
with ui.card():
|
||||||
ui.markdown("**Einstellungen für das Stempelterminal:**")
|
ui.markdown("**Einstellungen für das Touchscreenterminal:**")
|
||||||
with ui.column():
|
with ui.column():
|
||||||
timestamp_switch = ui.switch("Stempelzeiten anzeigen")
|
touchscreen_switch = ui.switch("Touchscreenterminal aktivieren")
|
||||||
photo_switch = ui.switch("Fotos anzeigen")
|
touchscreen_switch.value = data["touchscreen"]
|
||||||
|
timestamp_switch = ui.switch("Stempelzeiten anzeigen").bind_visibility_from(touchscreen_switch, 'value')
|
||||||
|
photo_switch = ui.switch("Fotos anzeigen").bind_visibility_from(touchscreen_switch, 'value')
|
||||||
timestamp_switch.value = bool(data["times_on_touchscreen"])
|
timestamp_switch.value = bool(data["times_on_touchscreen"])
|
||||||
with ui.row():
|
with ui.row().bind_visibility_from(touchscreen_switch, 'value'):
|
||||||
photo_switch.value = bool(data["photos_on_touchscreen"])
|
photo_switch.value = bool(data["photos_on_touchscreen"])
|
||||||
with ui.row().bind_visibility_from(photo_switch, 'value'):
|
with ui.row().bind_visibility_from(photo_switch, 'value'):
|
||||||
ui.markdown("Maximale Bilderöhe")
|
ui.markdown("Maximale Bilderöhe")
|
||||||
@ -665,8 +670,8 @@ Dies kann nicht rückgängig gemacht werden!''')
|
|||||||
"Größe muss größer 0 sein": lambda value: int(value)>0}).props('size=5')
|
"Größe muss größer 0 sein": lambda value: int(value)>0}).props('size=5')
|
||||||
picture_height_input.value = data["picture_height"]
|
picture_height_input.value = data["picture_height"]
|
||||||
ui.markdown('px')
|
ui.markdown('px')
|
||||||
with ui.row():
|
with ui.row().bind_visibility_from(touchscreen_switch, 'value'):
|
||||||
ui.markdown("Maximale Buttonhöhe")
|
ui.markdown("Minimale Buttonhöhe")
|
||||||
def compare_button_height(height):
|
def compare_button_height(height):
|
||||||
if not photo_switch.value:
|
if not photo_switch.value:
|
||||||
return True
|
return True
|
||||||
@ -680,6 +685,7 @@ Dies kann nicht rückgängig gemacht werden!''')
|
|||||||
"Buttons dürfen nicht kleiner als die Fotos sein": lambda value: compare_button_height(value)}).props('size=5')
|
"Buttons dürfen nicht kleiner als die Fotos sein": lambda value: compare_button_height(value)}).props('size=5')
|
||||||
button_height_input.value = data["button_height"]
|
button_height_input.value = data["button_height"]
|
||||||
photo_switch.on_value_change(button_height_input.validate)
|
photo_switch.on_value_change(button_height_input.validate)
|
||||||
|
picture_height_input.on_value_change(button_height_input.validate)
|
||||||
ui.markdown('px')
|
ui.markdown('px')
|
||||||
|
|
||||||
def holiday_section():
|
def holiday_section():
|
||||||
|
@ -28,6 +28,7 @@ standard_adminsettings = { "admin_user": "admin",
|
|||||||
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
||||||
"times_on_touchscreen": True,
|
"times_on_touchscreen": True,
|
||||||
"photos_on_touchscreen": True,
|
"photos_on_touchscreen": True,
|
||||||
|
"touchscreen": True,
|
||||||
"picure_height": 200,
|
"picure_height": 200,
|
||||||
"button_height": 300,
|
"button_height": 300,
|
||||||
"holidays": { }
|
"holidays": { }
|
||||||
|
1
main.py
1
main.py
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Zeiterfassung
|
# Zeiterfassung
|
||||||
|
|
||||||
from web_ui import *
|
from web_ui import *
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
"admin_password": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918",
|
"admin_password": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918",
|
||||||
"port": "8090",
|
"port": "8090",
|
||||||
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
||||||
|
"touchscreen": true,
|
||||||
"times_on_touchscreen": true,
|
"times_on_touchscreen": true,
|
||||||
"photos_on_touchscreen": true,
|
"photos_on_touchscreen": true,
|
||||||
"picture_height": 200,
|
"picture_height": "100",
|
||||||
"button_height": 300,
|
"button_height": "120",
|
||||||
"holidays": {
|
"holidays": {
|
||||||
"2025-01-01": "Neujahr",
|
"2025-01-01": "Neujahr",
|
||||||
"2025-04-18": "Karfreitag",
|
"2025-04-18": "Karfreitag",
|
||||||
|
@ -14,6 +14,8 @@ import locale
|
|||||||
@ui.page('/touchscreen')
|
@ui.page('/touchscreen')
|
||||||
def page_touchscreen():
|
def page_touchscreen():
|
||||||
|
|
||||||
|
if load_adminsettings()["touchscreen"]:
|
||||||
|
|
||||||
def button_click(name):
|
def button_click(name):
|
||||||
#nonlocal buttons
|
#nonlocal buttons
|
||||||
current_user = user(name)
|
current_user = user(name)
|
||||||
@ -44,14 +46,14 @@ def page_touchscreen():
|
|||||||
with ui.grid(columns=number_of_columns).classes('w-full center'):
|
with ui.grid(columns=number_of_columns).classes('w-full center'):
|
||||||
for name in userlist:
|
for name in userlist:
|
||||||
current_user = user(name)
|
current_user = user(name)
|
||||||
current_button = ui.button(on_click=lambda name=name: button_click(name)).classes('w-md h-full min-h-[250px]')
|
current_button = ui.button(on_click=lambda name=name: button_click(name)).classes(f'w-md h-full min-h-[{admin_settings["button_height"]}px]')
|
||||||
with current_button:
|
with current_button:
|
||||||
if admin_settings["photos_on_touchscreen"]:
|
if admin_settings["photos_on_touchscreen"]:
|
||||||
try:
|
try:
|
||||||
with open(current_user.photofile, 'r') as file:
|
with open(current_user.photofile, 'r') as file:
|
||||||
pass
|
pass
|
||||||
file.close()
|
file.close()
|
||||||
ui.image(current_user.photofile).classes('max-h-[200px]').props('fit=scale-down')
|
ui.image(current_user.photofile).classes(f'max-h-[{admin_settings["picture_height"]}px]').props('fit=scale-down')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
column_classes = "w-full items-center"
|
column_classes = "w-full items-center"
|
||||||
@ -78,3 +80,6 @@ def page_touchscreen():
|
|||||||
current_button.props('color=red')
|
current_button.props('color=red')
|
||||||
buttons[name] = current_button
|
buttons[name] = current_button
|
||||||
user_buttons()
|
user_buttons()
|
||||||
|
|
||||||
|
else:
|
||||||
|
pageheader("Interface deaktiviert")
|
2
users.py
2
users.py
@ -95,7 +95,7 @@ class user:
|
|||||||
# Zähle die Zeilen
|
# Zähle die Zeilen
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
if len(lines)== 0:
|
if len(lines)== 0:
|
||||||
print(f"Keine Einträge")
|
pass
|
||||||
elif len(lines) % 2 == 0:
|
elif len(lines) % 2 == 0:
|
||||||
return status_out
|
return status_out
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user