Userlist Window hinzugefügt

This commit is contained in:
Alexander Malzkuhn 2025-04-17 11:27:35 +02:00
parent b2ede4d5a4
commit 7eecadf10d
3 changed files with 69 additions and 4 deletions

Binary file not shown.

71
ui.py
View File

@ -7,6 +7,7 @@ locale.setlocale(locale.LC_ALL, '')
from time import strftime
from definitions import app_title, app_version
from users import *
# Pinpad
@ -84,6 +85,62 @@ class win_pinpad(tk.Toplevel):
usernr.focus_set()
class win_userlist(tk.Toplevel):
def __init__(self, parent):
super().__init__(parent)
def update_time():
string_time = strftime('%A, der %d.%m.%Y - %H:%M:%S')
nonlocal digital_clock
digital_clock.config(text=string_time)
digital_clock.after(1000, update_time)
self.title(app_title + " " + app_version)
# Digital clock label configuration
digital_clock = tk.Label(self)
digital_clock.grid(row=0, column=0, columnspan=3, padx=10, pady=10)
# Initial call to update_time function
update_time()
tk.Label(self, text="Benutzer auswählen").grid(row=1, column=0, columnspan=2)
# Button Frame
button_frame = tk.Frame(self)
button_frame.grid(row=2, column=0, columnspan=2, padx=0, pady=10)
userlist = list_users()
# Button Dictionary
buttons = { }
button_row_index = 0
for name in userlist:
button = tk.Button(button_frame, text=name)
button.grid(row=button_row_index, column=0, pady=5, sticky="ew")
buttons[name] = button
button_row_index = button_row_index + 1
class win_stamping(tk.Toplevel):
def __init__(self, user):
def update_time():
string_time = strftime('%A, der %d.%m.%Y - %H:%M:%S')
nonlocal digital_clock
digital_clock.config(text=string_time)
digital_clock.after(1000, update_time)
self.title(app_title + " " + app_version)
# Digital clock label configuration
digital_clock = tk.Label(self)
digital_clock.grid(row=0, column=0, columnspan=3, padx=10, pady=10)
# Initial call to update_time function
update_time()
stamping = tk.Button(self)
#========================================================
class mainwindow(tk.Tk):
def __init__(self):
super().__init__()
@ -93,13 +150,21 @@ class mainwindow(tk.Tk):
# place a button on the root window
tk.Button(self,
text='Login Window',
command=self.open_window).pack(expand=True)
text='PinPad Window',
command=self.open_pinpad).pack(expand=True)
tk.Button(self,
text='Userlist Window',
command=self.open_userlist).pack(expand=True)
def open_window(self):
def open_pinpad(self):
window = win_pinpad(self)
window.grab_set()
def open_userlist(self):
window = win_userlist(self)
window.grab_set()
if __name__ == "__main__":
app = mainwindow()

View File

@ -72,7 +72,7 @@ class user:
return -1
# Benutzer auflisten
def list_users(user):
def list_users():
users = [d for d in os.listdir(userfolder) if os.path.isdir(os.path.join(userfolder, d))]
return users