ヘルプ、サインアウトの関数を追加

This commit is contained in:
suti7yk5032 2024-07-08 11:41:38 +09:00
parent 889c464c5f
commit d76ba87887

View file

@ -122,16 +122,19 @@ class Lock(customtkinter.CTkToplevel):
self.signin_button = customtkinter.CTkButton(self.button_frame, text='サインイン', command=self.auth, font=self.button_font)
self.signin_button.grid(row=0, column=2, padx=10, sticky="e")
self.logout_button = customtkinter.CTkButton(self.button_frame, text='ログアウト', command=self.handler_close, font=self.button_font)
self.logout_button = customtkinter.CTkButton(self.button_frame, text='ログアウト', command=self.logout, font=self.button_font)
self.logout_button.grid(row=0, column=1, padx=10, sticky="e")
self.signin_button = customtkinter.CTkButton(self.button_frame, text='ヘルプ', command=self.handler_close, font=self.button_font)
self.signin_button = customtkinter.CTkButton(self.button_frame, text='ヘルプ', command=self.help_wakeup, font=self.button_font)
self.signin_button.grid(row=0, column=0, padx=10, sticky="w")
self.keyboard_listener_thread = threading.Thread(target=self.keyboard_listener)
self.keyboard_listener_thread.daemon = True
self.keyboard_listener_thread.start()
def help_wakeup(self):
help = Help()
def keyboard_listener(self):
keyboard.add_hotkey('ctrl+shift+q', self.exit)
@ -162,6 +165,11 @@ class Lock(customtkinter.CTkToplevel):
print("マスターパスワードで認証できませんでした。")
self.msg_subtitle_1.configure(text='ネットワークエラーが発生しています。\n続行するには、マスターパスワードを入力して下さい。 ')
def logout(self):
self.destroy()
logout_command = subprocess.run(['shutdown', '/l', '/f'])
print(logout_command)
def handler_close(self):
pass
@ -170,6 +178,27 @@ class Lock(customtkinter.CTkToplevel):
self.destroy()
app.exit()
class Help(customtkinter.CTkToplevel):
def __init__(self):
super().__init__()
if client_config["testing"] == 1:
self.title(f'{app_name} | ヘルプ | テストモード')
else:
self.title(f'{app_name} | ヘルプ')
self.geometry("600x400")
self.resizable(height=False, width=False)
self.attributes('-topmost', True)
self.grab_set()
self.lift()
self.protocol("WM_DELETE_WINDOW", self.handler_close)
def handler_close(self):
self.destroy()
def master_password_gen():
numbers = string.digits # (1)
password = ''.join(random.choice(numbers) for _ in range(10)) # (2)