issue #7 の解決案(ボタン無効化)を適用
This commit is contained in:
parent
9dc9938732
commit
19afc4a57a
1 changed files with 20 additions and 10 deletions
|
@ -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 = 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.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.signout_button = customtkinter.CTkButton(self.button_frame, text='サインアウト', command=self.signout, font=self.button_font)
|
||||||
self.logout_button.grid(row=0, column=1, padx=10, sticky="e")
|
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.help_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.grid(row=0, column=0, padx=10, sticky="w")
|
||||||
|
|
||||||
self.keyboard_listener_thread = threading.Thread(target=self.keyboard_listener)
|
self.keyboard_listener_thread = threading.Thread(target=self.keyboard_listener)
|
||||||
self.keyboard_listener_thread.daemon = True
|
self.keyboard_listener_thread.daemon = True
|
||||||
|
@ -246,6 +246,9 @@ class Lock(customtkinter.CTkToplevel):
|
||||||
|
|
||||||
|
|
||||||
def auth(self):
|
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())
|
password = str(self.password_entry.get())
|
||||||
if len(password) == 10:
|
if len(password) == 10:
|
||||||
print("マスターパスワードで認証を試行します。")
|
print("マスターパスワードで認証を試行します。")
|
||||||
|
@ -255,6 +258,9 @@ class Lock(customtkinter.CTkToplevel):
|
||||||
self.exit()
|
self.exit()
|
||||||
else:
|
else:
|
||||||
print("マスターパスワードで認証できませんでした。")
|
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("認証サーバーにアクセスします。")
|
print("認証サーバーにアクセスします。")
|
||||||
|
@ -273,9 +279,10 @@ class Lock(customtkinter.CTkToplevel):
|
||||||
self.withdraw()
|
self.withdraw()
|
||||||
msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | 誤ったパスワード", message=f"パスワードが間違っています!")
|
msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | 誤ったパスワード", message=f"パスワードが間違っています!")
|
||||||
self.msg_subtitle_1.configure(text='パスワードが間違っています! ')
|
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()
|
self.deiconify()
|
||||||
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print("認証サーバーにアクセスできません。マスターパスワードで認証を試行します。")
|
print("認証サーバーにアクセスできません。マスターパスワードで認証を試行します。")
|
||||||
master_password_hash = self.hash_genarate(str(self.password_entry.get()))
|
master_password_hash = self.hash_genarate(str(self.password_entry.get()))
|
||||||
|
@ -287,13 +294,16 @@ class Lock(customtkinter.CTkToplevel):
|
||||||
self.withdraw()
|
self.withdraw()
|
||||||
msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | ネットワークエラー", message=f"認証サーバーにアクセスできませんでした。\n続行するには、マスターパスワードを入力してください。")
|
msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | ネットワークエラー", message=f"認証サーバーにアクセスできませんでした。\n続行するには、マスターパスワードを入力してください。")
|
||||||
self.msg_subtitle_1.configure(text='ネットワークエラーが発生しています。\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()
|
self.deiconify()
|
||||||
|
|
||||||
def logout(self):
|
def signout(self):
|
||||||
app.unlock_taskmgr()
|
app.unlock_taskmgr()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
logout_command = subprocess.run(['shutdown', '/l', '/f'])
|
signout_command = subprocess.run(['shutdown', '/l', '/f'])
|
||||||
print(logout_command)
|
print(signout_command)
|
||||||
|
|
||||||
|
|
||||||
def handler_close(self):
|
def handler_close(self):
|
||||||
|
@ -365,7 +375,7 @@ class Monitor():
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
logout_command = subprocess.run(['shutdown', '/s', '/t', '1'])
|
shutdown_command = subprocess.run(['shutdown', '/s', '/t', '1'])
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
Loading…
Reference in a new issue