issue #7 の解決案(ボタン無効化)を適用

This commit is contained in:
suti7yk5032 2024-08-21 12:59:45 +09:00
parent 9dc9938732
commit 19afc4a57a

View file

@ -214,11 +214,11 @@ class Lock(customtkinter.CTkToplevel):
self.signin_button = customtkinter.CTkButton(self.button_frame, text='サインイン', command=self.auth_start, 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.logout, font=self.button_font)
self.logout_button.grid(row=0, column=1, padx=10, sticky="e")
self.signout_button = customtkinter.CTkButton(self.button_frame, text='サインアウト', command=self.signout, font=self.button_font)
self.signout_button.grid(row=0, column=1, padx=10, sticky="e")
self.signin_button = customtkinter.CTkButton(self.button_frame, text='ヘルプ', command=self.help_dummy, font=self.button_font)
self.signin_button.grid(row=0, column=0, padx=10, sticky="w")
self.help_button = customtkinter.CTkButton(self.button_frame, text='ヘルプ', command=self.help_dummy, font=self.button_font)
self.help_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
@ -246,6 +246,9 @@ class Lock(customtkinter.CTkToplevel):
def auth(self):
self.help_button.configure(state="disabled", fg_color="gray")
self.signin_button.configure(state="disabled", fg_color="gray")
self.signout_button.configure(state="disabled", fg_color="gray")
password = str(self.password_entry.get())
if len(password) == 10:
print("マスターパスワードで認証を試行します。")
@ -255,6 +258,9 @@ class Lock(customtkinter.CTkToplevel):
self.exit()
else:
print("マスターパスワードで認証できませんでした。")
self.help_button.configure(state="normal", fg_color="blue")
self.signin_button.configure(state="normal", fg_color="blue")
self.signout_button.configure(state="normal", fg_color="blue")
print("認証サーバーにアクセスします。")
@ -273,9 +279,10 @@ class Lock(customtkinter.CTkToplevel):
self.withdraw()
msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | 誤ったパスワード", message=f"パスワードが間違っています!")
self.msg_subtitle_1.configure(text='パスワードが間違っています! ')
self.help_button.configure(state="normal", fg_color="blue")
self.signin_button.configure(state="normal", fg_color="blue")
self.signout_button.configure(state="normal", fg_color="blue")
self.deiconify()
except:
print("認証サーバーにアクセスできません。マスターパスワードで認証を試行します。")
master_password_hash = self.hash_genarate(str(self.password_entry.get()))
@ -287,13 +294,16 @@ class Lock(customtkinter.CTkToplevel):
self.withdraw()
msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | ネットワークエラー", message=f"認証サーバーにアクセスできませんでした。\n続行するには、マスターパスワードを入力してください。")
self.msg_subtitle_1.configure(text='ネットワークエラーが発生しています。\n続行するには、マスターパスワードを入力して下さい。 ')
self.help_button.configure(state="normal", fg_color="blue")
self.signin_button.configure(state="normal", fg_color="blue")
self.signout_button.configure(state="normal", fg_color="blue")
self.deiconify()
def logout(self):
def signout(self):
app.unlock_taskmgr()
self.destroy()
logout_command = subprocess.run(['shutdown', '/l', '/f'])
print(logout_command)
signout_command = subprocess.run(['shutdown', '/l', '/f'])
print(signout_command)
def handler_close(self):
@ -365,7 +375,7 @@ class Monitor():
self.shutdown()
def shutdown(self):
logout_command = subprocess.run(['shutdown', '/s', '/t', '1'])
shutdown_command = subprocess.run(['shutdown', '/s', '/t', '1'])
def run(self):