[bugfix]VRCT.py
メインウィンドウのcheckboxをclick連打すると落ちる現象に対策
This commit is contained in:
40
VRCT.py
40
VRCT.py
@@ -8,6 +8,7 @@ from customtkinter import CTk, CTkFrame, CTkCheckBox, CTkFont, CTkButton, CTkIma
|
|||||||
from PIL.Image import open as Image_open
|
from PIL.Image import open as Image_open
|
||||||
from flashtext import KeywordProcessor
|
from flashtext import KeywordProcessor
|
||||||
|
|
||||||
|
from threading import Thread
|
||||||
from utils import save_json, print_textbox, thread_fnc, get_localized_text, widget_main_window_label_setter
|
from utils import save_json, print_textbox, thread_fnc, get_localized_text, widget_main_window_label_setter
|
||||||
from osc_tools import send_typing, send_message
|
from osc_tools import send_typing, send_message
|
||||||
from window_config import ToplevelWindowConfig
|
from window_config import ToplevelWindowConfig
|
||||||
@@ -432,10 +433,7 @@ class App(CTk):
|
|||||||
print_textbox(self.textbox_message_system_log, "Stop translation", "INFO")
|
print_textbox(self.textbox_message_system_log, "Stop translation", "INFO")
|
||||||
save_json(self.PATH_CONFIG, "ENABLE_TRANSLATION", self.ENABLE_TRANSLATION)
|
save_json(self.PATH_CONFIG, "ENABLE_TRANSLATION", self.ENABLE_TRANSLATION)
|
||||||
|
|
||||||
def checkbox_transcription_send_callback(self):
|
def transcription_send(self):
|
||||||
self.ENABLE_TRANSCRIPTION_SEND = self.checkbox_transcription_send.get()
|
|
||||||
if self.ENABLE_TRANSCRIPTION_SEND is True:
|
|
||||||
self.button_config.configure(state="disabled", fg_color=["gray92", "gray14"])
|
|
||||||
self.mic_audio_queue = Queue()
|
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]
|
mic_device = [device for device in get_input_device_list()[self.CHOICE_MIC_HOST] if device["name"] == self.CHOICE_MIC_DEVICE][0]
|
||||||
self.mic_audio_recorder = SelectedMicRecorder(
|
self.mic_audio_recorder = SelectedMicRecorder(
|
||||||
@@ -488,9 +486,22 @@ class App(CTk):
|
|||||||
self.mic_print_transcript = thread_fnc(mic_transcript_to_chatbox)
|
self.mic_print_transcript = thread_fnc(mic_transcript_to_chatbox)
|
||||||
self.mic_print_transcript.daemon = True
|
self.mic_print_transcript.daemon = True
|
||||||
self.mic_print_transcript.start()
|
self.mic_print_transcript.start()
|
||||||
|
|
||||||
print_textbox(self.textbox_message_log, "Start voice2chatbox", "INFO")
|
print_textbox(self.textbox_message_log, "Start voice2chatbox", "INFO")
|
||||||
print_textbox(self.textbox_message_system_log, "Start voice2chatbox", "INFO")
|
print_textbox(self.textbox_message_system_log, "Start voice2chatbox", "INFO")
|
||||||
|
self.checkbox_transcription_send.configure(state="normal")
|
||||||
|
self.checkbox_transcription_receive.configure(state="normal")
|
||||||
|
|
||||||
|
def checkbox_transcription_send_callback(self):
|
||||||
|
self.ENABLE_TRANSCRIPTION_SEND = self.checkbox_transcription_send.get()
|
||||||
|
if self.ENABLE_TRANSCRIPTION_SEND is True:
|
||||||
|
self.checkbox_transcription_send.configure(state="disabled")
|
||||||
|
self.checkbox_transcription_receive.configure(state="disabled")
|
||||||
|
self.button_config.configure(state="disabled", fg_color=["gray92", "gray14"])
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
th_transcription_send = Thread(target=self.transcription_send)
|
||||||
|
th_transcription_send.daemon = True
|
||||||
|
th_transcription_send.start()
|
||||||
else:
|
else:
|
||||||
if ((self.checkbox_translation.get() is False) and
|
if ((self.checkbox_translation.get() is False) and
|
||||||
(self.checkbox_transcription_send.get() is False) and
|
(self.checkbox_transcription_send.get() is False) and
|
||||||
@@ -506,10 +517,7 @@ class App(CTk):
|
|||||||
print_textbox(self.textbox_message_system_log, "Stop voice2chatbox", "INFO")
|
print_textbox(self.textbox_message_system_log, "Stop voice2chatbox", "INFO")
|
||||||
save_json(self.PATH_CONFIG, "ENABLE_TRANSCRIPTION_SEND", self.ENABLE_TRANSCRIPTION_SEND)
|
save_json(self.PATH_CONFIG, "ENABLE_TRANSCRIPTION_SEND", self.ENABLE_TRANSCRIPTION_SEND)
|
||||||
|
|
||||||
def checkbox_transcription_receive_callback(self):
|
def transcription_receive(self):
|
||||||
self.ENABLE_TRANSCRIPTION_RECEIVE = self.checkbox_transcription_receive.get()
|
|
||||||
if self.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
|
||||||
self.button_config.configure(state="disabled", fg_color=["gray92", "gray14"])
|
|
||||||
self.spk_audio_queue = Queue()
|
self.spk_audio_queue = Queue()
|
||||||
spk_device = [device for device in get_output_device_list() if device["name"] == self.CHOICE_SPEAKER_DEVICE][0]
|
spk_device = [device for device in get_output_device_list() if device["name"] == self.CHOICE_SPEAKER_DEVICE][0]
|
||||||
self.spk_audio_recorder = SelectedSpeakerRecorder(
|
self.spk_audio_recorder = SelectedSpeakerRecorder(
|
||||||
@@ -559,6 +567,20 @@ class App(CTk):
|
|||||||
self.spk_print_transcript.start()
|
self.spk_print_transcript.start()
|
||||||
print_textbox(self.textbox_message_log, "Start speaker2log", "INFO")
|
print_textbox(self.textbox_message_log, "Start speaker2log", "INFO")
|
||||||
print_textbox(self.textbox_message_system_log, "Start speaker2log", "INFO")
|
print_textbox(self.textbox_message_system_log, "Start speaker2log", "INFO")
|
||||||
|
self.checkbox_transcription_send.configure(state="normal")
|
||||||
|
self.checkbox_transcription_receive.configure(state="normal")
|
||||||
|
|
||||||
|
def checkbox_transcription_receive_callback(self):
|
||||||
|
self.ENABLE_TRANSCRIPTION_RECEIVE = self.checkbox_transcription_receive.get()
|
||||||
|
if self.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
|
self.checkbox_transcription_send.configure(state="disabled")
|
||||||
|
self.checkbox_transcription_receive.configure(state="disabled")
|
||||||
|
self.button_config.configure(state="disabled", fg_color=["gray92", "gray14"])
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
th_transcription_receive = Thread(target=self.transcription_receive)
|
||||||
|
th_transcription_receive.daemon = True
|
||||||
|
th_transcription_receive.start()
|
||||||
else:
|
else:
|
||||||
if ((self.checkbox_translation.get() is False) and
|
if ((self.checkbox_translation.get() is False) and
|
||||||
(self.checkbox_transcription_send.get() is False) and
|
(self.checkbox_transcription_send.get() is False) and
|
||||||
|
|||||||
Reference in New Issue
Block a user