From 5a4cafe2a2955234fccc40a0c6eeba7708c9142b Mon Sep 17 00:00:00 2001 From: Alexander Malzkuhn Date: Thu, 17 Apr 2025 13:48:02 +0200 Subject: [PATCH] =?UTF-8?q?Design=20Stempelfenster=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __pycache__/users.cpython-311.pyc | Bin 5196 -> 5811 bytes ui.py | 52 +++++++++++++++++++++++++++--- users.py | 14 ++++++++ users/testuser/2025-4.txt | 1 + users/testuser/settings.json | 27 ++++++++++++++++ 5 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 users/testuser/settings.json diff --git a/__pycache__/users.cpython-311.pyc b/__pycache__/users.cpython-311.pyc index 6bfcc6ca8861184921aaaec97726e3f1b52820aa..3659f8b4bc858eb7a18d28817ff5cb0f078ce924 100644 GIT binary patch delta 1294 zcmZuwO=ufO6rS0cU1=q)el1I~Ya+RJEXDOt-K1&j)D6bQDGd#{#?*T;A}bR$yONoe za9bSQgAb-OG-i4TrH35)OD_SP3w5Bk9BR-ZETr_(gKtU`ipe4Fd+WqWz_XffzkTm} zZ|1$x+%2|7qCXi%h`{*IBUhC0b~H;@wukbw)Mh5Lh^5%vQBBp+Ow9?H0Vik%9o^KO zkQt&xA#=oHo5bQjDunzB^Kh79OWh=9WP9_sum&au^WpbYUZmf~bkZ=M%HXvwr&vxq zL#`=}m>k!-WHS_3t}*$$I>wY+y1Z@-Y}5j;5=xdxjeW|N$QoT|mXbS4u}+r#{i6Xq z>?Ke5nG8JqB~Rp;$08q*lKSCeI_B|O*{OKJ)w1iZ)rIBhfLE_*^`>x3hWwX~%zM1P zTB&*b6Sod%*UOftUbgElM6EP!8{mC`Ua8s@k6YzN+2vr( z=jDX55J0u7QF&dN+vsSjp17Y#->}-B~#I8a@vn?~*;j6w?QGHKV7}VUodO=+g2x?)a(0Za>3*_PNKY$l=gkQ4I|`rH0(Ufq zT&KuG8RY%S^htJ^LJ*ABKgxL;&Hxhygnl{Bdufln$cwZfo4lqzM48-;bhn=HJ(?eY zFOOAg4Uadf(EcQTt81d#sE9NwLxHI{=7S@G=KDu9AwLcjdV0VpCICKcC}V<{gh$^)2XWhRuyj`XOLI~Q6B&(G2s_*+L!rpE?$9r zJ}-LYe0YGKZLNi~?1Qry@fN_|lY@hUJ(vf3*av|(sigU}_&X49qZP{$lL)5{{YR^a zbJB~xr}-7l$P=+%I@g+vouTu+sKy%nLdCntW&nO6Vi36>f%ius;9u8W2KeIW=_qk^ zxI>O$K>iV*rGu?-qMsTUKw478D7?g&d?$Gl4yv3Sqo&+W&IWM-XvL`fD_Q8qg}jhm zbsNjrY*);KVM(S_BN<<39A-IzsfH0!av^oPh$?~0Jm2o);5nymHSNljSO5q1%l$## gP7TVtsma$bP}<{9 delta 820 zcmZWnOKTHR6rP*OB$>Q)nq+LNLX$p{p{CK03ZhoB2r8|D*t#gv5}O-3GLwXRr-;Rc z3l{|i3D=c$Cn$<5XYJCJ{ROjhBiThN2wfP@nLsLZhWpK#?>xS9&Wu|;C?r255>W}R znQzkeQ?;8MCmY@TR48D{c5uCWFVlT|HXLmzFQoNY_tn=}077Lrhx?LPC2!*m>AqwH z?jDhn5fbO+V#)}3K~Alv7i`sS$}wK-%d6oe82q**{>V4gz2si<5Z)!XqTC|+Q(&

D|zSXun7IkQ+?rifQP*ZR*O}q;gNJ<=pS_(@6E2=TwT?_Zf^f^qE&6eW@9n+>> zu-&08PkF*jhkDAE)#g-es7t3&$cr>hi(+qVUVK)wlNyk09$+`Q!zo+93f!sNoeB4+ zYRV6$(eEp$jMf{L*`l1yA~^@(DIEsF>;l>{6lM{0g#iqi`I8m>Fh7su>W0I-Ps|X* z{hkW5+WRAX;BK3BJxhLFU06 diff --git a/ui.py b/ui.py index fae4ab2..3255751 100644 --- a/ui.py +++ b/ui.py @@ -6,8 +6,9 @@ import locale locale.setlocale(locale.LC_ALL, '') from time import strftime -from definitions import app_title, app_version -from users import * +from definitions import app_title, app_version, status_in +from users import user as uo +from users import list_users # Pinpad @@ -122,7 +123,8 @@ class win_userlist(tk.Toplevel): button_row_index = button_row_index + 1 class win_stamping(tk.Toplevel): - def __init__(self, user): + def __init__(self, parent, user): + super().__init__(parent) def update_time(): string_time = strftime('%A, der %d.%m.%Y - %H:%M:%S') nonlocal digital_clock @@ -131,13 +133,49 @@ class win_stamping(tk.Toplevel): self.title(app_title + " " + app_version) + # Benutzer feststellen + + current_user = uo(user) + # 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) + # Benutzer anzeigen + tk.Label(self, text=current_user.fullname).grid(row=1, column=0, pady=10, columnspan=3) + + todays_hours = tk.Label(self, text="Arbeitsstunden erscheinen hier") + todays_hours.grid(row=2, column=0, pady=10, columnspan=3) + + in_button = tk.Button(self, text="Einstempeln", bg="green") + out_button = tk.Button(self, text="Ausstempeln", bg="red") + + if current_user.stamp_status() == status_in: + in_button.configure(state="disabled") + out_button.configure(state="active") + out_button.focus_set() + else: + in_button.configure(state="active") + out_button.configure(state="disabled") + in_button.focus_set() + in_button.grid(row=3, column = 0) + out_button.grid(row=3, column=2) + + button_frame = tk.Frame(self, relief="groove") + button_frame.grid(row=4, column=0, columnspan=3, pady=10) + + overview_workinghours = tk.Button(button_frame, text="Übersicht Arbeitszeiten") + overview_missed = tk.Button(button_frame, text="Übersicht Fehlzeiten") + overview_data = tk.Button(button_frame, text="Stammdaten") + + overview_workinghours.grid(row=0, column=0, sticky="ew") + overview_missed.grid(row=1, column=0, sticky="ew") + overview_data.grid(row=2, column=0, sticky="ew") + + button_close = tk.Button(self, text="Schließen") + button_close.grid(row=5, column=1) #======================================================== @@ -155,6 +193,9 @@ class mainwindow(tk.Tk): tk.Button(self, text='Userlist Window', command=self.open_userlist).pack(expand=True) + tk.Button(self, + text='Stamping Window', + command=self.open_stamping).pack(expand=True) def open_pinpad(self): window = win_pinpad(self) @@ -164,6 +205,9 @@ class mainwindow(tk.Tk): window = win_userlist(self) window.grab_set() + def open_stamping(self): + window = win_stamping(self, user="testuser") + window.grab_set() if __name__ == "__main__": diff --git a/users.py b/users.py index 8c0f7dc..ad76842 100644 --- a/users.py +++ b/users.py @@ -5,6 +5,7 @@ import os import datetime import time +import json from definitions import userfolder, scriptpath, usersettingsfilename, photofilename, status_in, status_out @@ -16,6 +17,19 @@ class user: self.settingsfile = self.userfolder + "/" + usersettingsfilename self.photofile = self.userfolder + "/" + photofilename + # Stammdaten einlesen + try: + with open(self.settingsfile) as json_file: + data = json.load(json_file) + json_file.close() + except: + pass + #Hier muss noch Fehlerbehandlungcode hin + + self.fullname = data["name"] + self.password = data["password"] + self.workhours = data["workhours"] + def get_stamp_file(self): year = str(datetime.datetime.now().year) month = str(datetime.datetime.now().month) diff --git a/users/testuser/2025-4.txt b/users/testuser/2025-4.txt index b06d023..421273c 100644 --- a/users/testuser/2025-4.txt +++ b/users/testuser/2025-4.txt @@ -5,3 +5,4 @@ 1743966047 1743966049 1743967346 +1744889948 diff --git a/users/testuser/settings.json b/users/testuser/settings.json new file mode 100644 index 0000000..aa4dbda --- /dev/null +++ b/users/testuser/settings.json @@ -0,0 +1,27 @@ +{ + "username": "testuser", + "name": "Der neue Tester", + "password": "123456789", + "workhours": { + "2024-04-01": { + "0": "0", + "1": "8", + "2": "8", + "3": "8", + "4": "8", + "5": "8", + "6": "0", + "vacation": "30" + }, + "2024-04-07": { + "0": "0", + "1": "6", + "2": "6", + "3": "6", + "4": "8", + "5": "6", + "6": "0", + "vacation": "28" + } + } +} \ No newline at end of file