From 470e1cbabe4b65eaba9d1ac975e1cd37f36930b5 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Wed, 26 Jul 2023 12:54:45 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20information=20window=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=9F=E6=99=82=E3=81=AB=E6=9C=80?= =?UTF-8?q?=E5=89=8D=E9=9D=A2=E3=81=AB=E3=81=AA=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VRCT.py | 15 ++++++++------- window_information.py | 7 ++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/VRCT.py b/VRCT.py index bb1fd21e..d027e81b 100644 --- a/VRCT.py +++ b/VRCT.py @@ -411,6 +411,7 @@ class App(CTk): self.protocol("WM_DELETE_WINDOW", self.delete_window) self.config_window = ToplevelWindowConfig(self) + self.information_window = ToplevelWindowInformation(self) # start receive osc th_receive_osc_parameters = Thread(target=receive_osc_parameters, args=(self.check_osc_receive,)) @@ -441,8 +442,8 @@ class App(CTk): self.config_window.grab_set() def button_information_callback(self): - if self.information_window is None or not self.information_window.winfo_exists(): - self.information_window = ToplevelWindowInformation(self) + self.information_window.deiconify() + self.information_window.focus_set() self.information_window.focus() def checkbox_translation_callback(self): @@ -454,7 +455,6 @@ class App(CTk): print_textbox(self.textbox_message_log, "Stop translation", "INFO") print_textbox(self.textbox_message_system_log, "Stop translation", "INFO") - def transcription_send_start(self): self.mic_audio_queue = Queue() mic_device = [device for device in get_input_device_list()[self.CHOICE_MIC_HOST] if device["name"] == self.CHOICE_MIC_DEVICE][0] @@ -682,10 +682,11 @@ class App(CTk): print_textbox(self.textbox_message_system_log, "Start foreground", "INFO") def foreground_stop(self): - self.ENABLE_FOREGROUND = False - self.attributes("-topmost", False) - print_textbox(self.textbox_message_log, "Stop foreground", "INFO") - print_textbox(self.textbox_message_system_log, "Stop foreground", "INFO") + if self.ENABLE_FOREGROUND: + self.attributes("-topmost", False) + print_textbox(self.textbox_message_log, "Stop foreground", "INFO") + print_textbox(self.textbox_message_system_log, "Stop foreground", "INFO") + self.ENABLE_FOREGROUND = False def entry_message_box_press_key_enter(self, event): # send OSC typing diff --git a/window_information.py b/window_information.py index aa5d05a6..cc0d3b7f 100644 --- a/window_information.py +++ b/window_information.py @@ -4,6 +4,7 @@ from customtkinter import CTkToplevel, CTkTextbox, CTkFont class ToplevelWindowInformation(CTkToplevel): def __init__(self, parent, *args, **kwargs): super().__init__(parent, *args, **kwargs) + self.withdraw() self.parent = parent self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) @@ -146,4 +147,8 @@ https://twitter.com/misya_ai """ self.textbox_information.insert("end", textbox_information_message) - self.textbox_information.configure(state='disabled') \ No newline at end of file + self.textbox_information.configure(state='disabled') + self.protocol("WM_DELETE_WINDOW", self.delete_window) + + def delete_window(self): + self.withdraw() \ No newline at end of file