Userlist Window hinzugefügt
This commit is contained in:
parent
b2ede4d5a4
commit
7eecadf10d
Binary file not shown.
71
ui.py
71
ui.py
@ -7,6 +7,7 @@ locale.setlocale(locale.LC_ALL, '')
|
|||||||
|
|
||||||
from time import strftime
|
from time import strftime
|
||||||
from definitions import app_title, app_version
|
from definitions import app_title, app_version
|
||||||
|
from users import *
|
||||||
|
|
||||||
# Pinpad
|
# Pinpad
|
||||||
|
|
||||||
@ -84,6 +85,62 @@ class win_pinpad(tk.Toplevel):
|
|||||||
|
|
||||||
usernr.focus_set()
|
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):
|
class mainwindow(tk.Tk):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -93,13 +150,21 @@ class mainwindow(tk.Tk):
|
|||||||
|
|
||||||
# place a button on the root window
|
# place a button on the root window
|
||||||
tk.Button(self,
|
tk.Button(self,
|
||||||
text='Login Window',
|
text='PinPad Window',
|
||||||
command=self.open_window).pack(expand=True)
|
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 = win_pinpad(self)
|
||||||
window.grab_set()
|
window.grab_set()
|
||||||
|
|
||||||
|
def open_userlist(self):
|
||||||
|
window = win_userlist(self)
|
||||||
|
window.grab_set()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = mainwindow()
|
app = mainwindow()
|
||||||
|
2
users.py
2
users.py
@ -72,7 +72,7 @@ class user:
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
# Benutzer auflisten
|
# 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))]
|
users = [d for d in os.listdir(userfolder) if os.path.isdir(os.path.join(userfolder, d))]
|
||||||
return users
|
return users
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user