diff --git a/users/testuser2/photo.jpg b/users/testuser2/photo.jpg new file mode 100644 index 0000000..57c5a04 Binary files /dev/null and b/users/testuser2/photo.jpg differ diff --git a/web_ui.py b/web_ui.py index 8cffb07..59d5ce6 100644 --- a/web_ui.py +++ b/web_ui.py @@ -26,20 +26,35 @@ def page_touchscreen(): ui.notify(status_out) ui.markdown(f"##{app_title} {app_version}") - ui.html('
') + 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("
") + if number_of_users > 5: + number_of_columns = 5 + else: + number_of_columns = number_of_users + + + with ui.grid(columns=number_of_columns): + for name in userlist: + current_user = user(name) + current_button = ui.button(on_click=lambda name=name: button_click(name)) + with current_button: + try: + with open(current_user.photofile, 'r') as file: + pass + file.close() + ui.image(current_user.photofile) + except: + pass + ui.label(current_user.fullname) + if current_user.stamp_status() == status_in: + current_button.props('color=green') + else: + current_button.props('color=red') + buttons[name] = current_button @ui.page('/userlist')