update click config motion

翻訳/文字起こし機能が動作中はコンフィグを変更できないように変更
This commit is contained in:
misyaguziya
2023-07-01 23:54:49 +09:00
parent 6b7230ff4f
commit 248317a1a5
2 changed files with 26 additions and 0 deletions

18
VRCT.py
View File

@@ -411,6 +411,9 @@ class App(customtkinter.CTk):
def button_config_callback(self):
if self.config_window is None or not self.config_window.winfo_exists():
self.config_window = window_config.ToplevelWindowConfig(self)
self.checkbox_translation.configure(state="disabled")
self.checkbox_transcription_send.configure(state="disabled")
self.checkbox_transcription_receive.configure(state="disabled")
self.config_window.focus()
def button_information_callback(self):
@@ -421,9 +424,14 @@ class App(customtkinter.CTk):
def checkbox_translation_callback(self):
self.ENABLE_TRANSLATION = self.checkbox_translation.get()
if self.ENABLE_TRANSLATION:
self.button_config.configure(state="disabled")
utils.print_textbox(self.textbox_message_log, "Start translation", "INFO")
utils.print_textbox(self.textbox_message_system_log, "Start translation", "INFO")
else:
if ((self.checkbox_translation.get() is False) and
(self.checkbox_transcription_send.get() is False) and
(self.checkbox_transcription_receive.get() is False)):
self.button_config.configure(state="normal")
utils.print_textbox(self.textbox_message_log, "Stop translation", "INFO")
utils.print_textbox(self.textbox_message_system_log, "Stop translation", "INFO")
utils.save_json(self.PATH_CONFIG, "ENABLE_TRANSLATION", self.ENABLE_TRANSLATION)
@@ -431,6 +439,7 @@ class App(customtkinter.CTk):
def checkbox_transcription_send_callback(self):
self.ENABLE_TRANSCRIPTION_SEND = self.checkbox_transcription_send.get()
if self.ENABLE_TRANSCRIPTION_SEND is True:
self.button_config.configure(state="disabled")
self.mic_audio_queue = queue.Queue()
mic_device = [device for device in audio_utils.get_input_device_list() if device["name"] == self.CHOICE_MIC_DEVICE][0]
self.mic_audio_recorder = audio_recorder.SelectedMicRecorder(
@@ -481,6 +490,10 @@ class App(customtkinter.CTk):
utils.print_textbox(self.textbox_message_log, "Start voice2chatbox", "INFO")
utils.print_textbox(self.textbox_message_system_log, "Start voice2chatbox", "INFO")
else:
if ((self.checkbox_translation.get() is False) and
(self.checkbox_transcription_send.get() is False) and
(self.checkbox_transcription_receive.get() is False)):
self.button_config.configure(state="normal")
if isinstance(self.mic_print_transcript, utils.thread_fnc):
self.mic_print_transcript.stop()
if self.mic_audio_recorder.stop != None:
@@ -494,6 +507,7 @@ class App(customtkinter.CTk):
def checkbox_transcription_receive_callback(self):
self.ENABLE_TRANSCRIPTION_RECEIVE = self.checkbox_transcription_receive.get()
if self.ENABLE_TRANSCRIPTION_RECEIVE is True:
self.button_config.configure(state="disabled")
self.spk_audio_queue = queue.Queue()
spk_device = [device for device in audio_utils.get_output_device_list() if device["name"] == self.CHOICE_SPEAKER_DEVICE][0]
self.spk_audio_recorder = audio_recorder.SelectedSpeakerRecorder(
@@ -543,6 +557,10 @@ class App(customtkinter.CTk):
utils.print_textbox(self.textbox_message_log, "Start speaker2log", "INFO")
utils.print_textbox(self.textbox_message_system_log, "Start speaker2log", "INFO")
else:
if ((self.checkbox_translation.get() is False) and
(self.checkbox_transcription_send.get() is False) and
(self.checkbox_transcription_receive.get() is False)):
self.button_config.configure(state="normal")
if isinstance(self.spk_print_transcript, utils.thread_fnc):
self.spk_print_transcript.stop()
if self.spk_audio_recorder.stop != None:

View File

@@ -546,6 +546,8 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel):
self.entry_message_format.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew")
self.entry_message_format.bind("<Any-KeyRelease>", self.entry_message_format_callback)
self.protocol("WM_DELETE_WINDOW", self.delete_window)
def slider_transparency_callback(self, value):
self.parent.wm_attributes("-alpha", value/100)
self.parent.TRANSPARENCY = value
@@ -772,6 +774,12 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel):
else:
pass
def delete_window(self):
self.parent.checkbox_translation.configure(state="normal")
self.parent.checkbox_transcription_send.configure(state="normal")
self.parent.checkbox_transcription_receive.configure(state="normal")
self.parent.config_window.destroy()
def entry_message_format_callback(self, event):
value = self.entry_message_format.get()
if len(value) > 0: