Änderungen GUI-Tests

This commit is contained in:
Alexander Malzkuhn 2025-04-09 17:37:06 +02:00
parent 900e3cfd5a
commit 0e18bed48d
7 changed files with 18 additions and 10 deletions

Binary file not shown.

Binary file not shown.

13
ui.py
View File

@ -1,7 +1,5 @@
# Zeiterfassung
# UI
from wx.lib.agw.aui import aero_up_single
from definitions import *
import tkinter as tk
@ -20,7 +18,7 @@ def ui_stempeln(button, label):
else:
buttons[button].configure(relief="sunken", bg="green")
def stempeln(userlist):
def win_stempeln(userlist):
stempeln = tk.Tk()
stempeln.title(program_name + " " + program_version)
stempeln.geometry("600x400")
@ -29,17 +27,18 @@ def stempeln(userlist):
global buttons
buttons = [ ]
button_index = 0
windowSize = stempeln.winfo_height()
stempeln.columnconfigure(0, weight=1)
stempeln.rowconfigure(0, weight=1)
for i in userlist:
buttonheight = int(windowSize / len(userlist) - 10)
button = tk.Button(stempeln, text=i, height=buttonheight, command=lambda b=button_index, label=i: ui_stempeln(b, label))
button = tk.Button(stempeln, text=i, height=5, command=lambda b=button_index, label=i: ui_stempeln(b, label))
if len_timestamps(determine_filename(i)) % 2 == 0:
button.configure(relief="raised", bg ="red")
else:
button.configure(relief="sunken", bg="green")
button.pack(fill="x", pady=5)
button.grid(row=button_index, column=0, sticky="ew")
buttons.append(button)
button_index+=1

View File

@ -7,7 +7,8 @@ import datetime
from definitions import *
# Benutzer anhand Verzeichnisse auflisten
def list_users(directory):
def list_users():
directory = scriptpath() + "/" + userfolder
users = [d for d in os.listdir(directory) if os.path.isdir(os.path.join(directory, d))]
return users
@ -23,7 +24,7 @@ def determine_filename(user, type="stamping"):
# Benutzerliste anzeigen
def printUserList():
userlist = list_users(scriptpath() + "/" + userfolder)
userlist = list_users()
for i in range(0, len(userlist)):
print(str(i + 1) + ": " + str(userlist[i]))
return(userlist)

View File

@ -72,3 +72,5 @@
1744198071
1744198392
1744198393
1744210902
1744210904

View File

@ -18,3 +18,9 @@
1744197306
1744197767
1744197768
1744210910
1744210912
1744210913
1744210914
1744211937
1744211939

View File

@ -15,7 +15,7 @@ from ui import *
def main():
userList = printUserList()
stempeln(userList)
win_stempeln(userList)
exit()
# Konsole