From f2679a83071c85a360fc0911da05373d7afe9184 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Thu, 6 Jun 2024 23:08:15 +0900 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E5=AE=9A=E3=81=AE=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=82=92=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dislocker_client.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/dislocker_client.py b/dislocker_client.py index 2151a3b..0189fc0 100644 --- a/dislocker_client.py +++ b/dislocker_client.py @@ -3,21 +3,32 @@ import os import json import customtkinter from winotify import Notification, audio +import keyboard class App(customtkinter.CTk): def __init__(self): super().__init__() - - self.title("Dislocker ロック中") self.attributes('-fullscreen', True) - Lock() + self.frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color='transparent') + self.frame.grid(row=0, column=0, sticky='nsew') + + self.restore_button = customtkinter.CTkButton(self.frame, text='認証ウィンドウを再表示', command=self.handler_close, width=240) + self.restore_button.grid(row=0, column=0) + self.block_key() + lock = Lock() + def exit(self): self.toast() self.destroy() + def block_key(self): + block_keys = ['ctrl', 'alt', 'windows', 'shift', 'delete'] + for i in block_keys: + keyboard.block_key(i) + def toast(self): resource_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "resource") success = Notification( @@ -29,13 +40,19 @@ class App(customtkinter.CTk): success.set_audio(audio.Default, loop=False) success.show() + def handler_close(self): + pass + + class Lock(customtkinter.CTkToplevel): def __init__(self): super().__init__() self.title('Dislocker | PC番号 10 | ロックされています') - self.geometry('400x500') + self.geometry('400x200') self.resizable(height=False, width=False) + self.attributes('-topmost', True) self.lift() + self.protocol("WM_DELETE_WINDOW", self.handler_close) self.msg_title_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color='transparent') self.msg_title_frame.grid(row=0, column=0, sticky="nsew") @@ -74,6 +91,12 @@ class Lock(customtkinter.CTkToplevel): app.exit() else: self.msg_subtitle_1.configure(text='サインインするには、パスワードが必要です。\nパスワードが違います!') + + def handler_close(self): + pass + + def exit(self): + self.destroy() @@ -100,4 +123,5 @@ elif os.path.isfile(db_config_path): if __name__ == '__main__': app = App() + app.protocol("WM_DELETE_WINDOW", app.handler_close) app.mainloop()