Design Stempelfenster hinzugefügt
This commit is contained in:
parent
7eecadf10d
commit
5a4cafe2a2
Binary file not shown.
52
ui.py
52
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__":
|
||||
|
14
users.py
14
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)
|
||||
|
@ -5,3 +5,4 @@
|
||||
1743966047
|
||||
1743966049
|
||||
1743967346
|
||||
1744889948
|
||||
|
27
users/testuser/settings.json
Normal file
27
users/testuser/settings.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user