Merge branch 'bugfix#20_poposuke' into develop
This commit is contained in:
19
VRCT.py
19
VRCT.py
@@ -508,22 +508,16 @@ class App(CTk):
|
||||
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()
|
||||
|
||||
self.ENABLE_TRANSCRIPTION_SEND = self.checkbox_transcription_send.get()
|
||||
if self.ENABLE_TRANSCRIPTION_SEND is True:
|
||||
th_transcription_send_start = Thread(target=self.transcription_send_start)
|
||||
th_transcription_send_start.daemon = True
|
||||
th_transcription_send_start.start()
|
||||
else:
|
||||
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_stop = Thread(target=self.transcription_send_stop)
|
||||
th_transcription_send_stop.daemon = True
|
||||
th_transcription_send_stop.start()
|
||||
@@ -599,21 +593,16 @@ class App(CTk):
|
||||
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()
|
||||
|
||||
self.ENABLE_TRANSCRIPTION_RECEIVE = self.checkbox_transcription_receive.get()
|
||||
if self.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||
th_transcription_receive_start = Thread(target=self.transcription_receive_start)
|
||||
th_transcription_receive_start.daemon = True
|
||||
th_transcription_receive_start.start()
|
||||
else:
|
||||
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_stop = Thread(target=self.transcription_receive_stop)
|
||||
th_transcription_receive_stop.daemon = True
|
||||
th_transcription_receive_stop.start()
|
||||
|
||||
@@ -7,6 +7,7 @@ import customtkinter
|
||||
from customtkinter import CTkToplevel, CTkTabview, CTkFont, CTkLabel, CTkSlider, CTkOptionMenu, StringVar, CTkEntry, CTkCheckBox, CTkProgressBar
|
||||
from flashtext import KeywordProcessor
|
||||
|
||||
from threading import Thread
|
||||
from utils import save_json, print_textbox, thread_fnc, get_localized_text, get_key_by_value, widget_config_window_label_setter
|
||||
from audio_utils import get_input_device_list, get_output_device_list, get_default_output_device
|
||||
from audio_recorder import SelectedMicEnergyRecorder, SelectedSpeakeEnergyRecorder
|
||||
@@ -306,8 +307,7 @@ class ToplevelWindowConfig(CTkToplevel):
|
||||
pass
|
||||
sleep(0.01)
|
||||
|
||||
def checkbox_input_mic_threshold_check_callback(self):
|
||||
if self.checkbox_input_mic_threshold_check.get():
|
||||
def mic_threshold_check_start(self):
|
||||
self.mic_energy_queue = Queue()
|
||||
mic_device = [device for device in get_input_device_list()[self.parent.CHOICE_MIC_HOST] if device["name"] == self.parent.CHOICE_MIC_DEVICE][0]
|
||||
self.mic_energy_recorder = SelectedMicEnergyRecorder(mic_device)
|
||||
@@ -315,12 +315,30 @@ class ToplevelWindowConfig(CTkToplevel):
|
||||
self.mic_energy_plot_progressbar = thread_fnc(self.progressBar_input_mic_energy_plot)
|
||||
self.mic_energy_plot_progressbar.daemon = True
|
||||
self.mic_energy_plot_progressbar.start()
|
||||
else:
|
||||
self.checkbox_input_mic_threshold_check.configure(state="normal")
|
||||
self.checkbox_input_speaker_threshold_check.configure(state="normal")
|
||||
|
||||
def mic_threshold_check_stop(self):
|
||||
if self.mic_energy_recorder != None:
|
||||
self.mic_energy_recorder.stop()
|
||||
if self.mic_energy_plot_progressbar != None:
|
||||
self.mic_energy_plot_progressbar.stop()
|
||||
self.progressBar_input_mic_energy_threshold.set(0)
|
||||
self.checkbox_input_mic_threshold_check.configure(state="normal")
|
||||
self.checkbox_input_speaker_threshold_check.configure(state="normal")
|
||||
|
||||
def checkbox_input_mic_threshold_check_callback(self):
|
||||
self.checkbox_input_mic_threshold_check.configure(state="disabled")
|
||||
self.checkbox_input_speaker_threshold_check.configure(state="disabled")
|
||||
self.update()
|
||||
if self.checkbox_input_mic_threshold_check.get():
|
||||
th_mic_threshold_check_start = Thread(target=self.mic_threshold_check_start)
|
||||
th_mic_threshold_check_start.daemon = True
|
||||
th_mic_threshold_check_start.start()
|
||||
else:
|
||||
th_mic_threshold_check_stop = Thread(target=self.mic_threshold_check_stop)
|
||||
th_mic_threshold_check_stop.daemon = True
|
||||
th_mic_threshold_check_stop.start()
|
||||
|
||||
def slider_input_mic_energy_threshold_callback(self, value):
|
||||
self.parent.INPUT_MIC_ENERGY_THRESHOLD = int(value)
|
||||
@@ -387,12 +405,11 @@ class ToplevelWindowConfig(CTkToplevel):
|
||||
energy = self.speaker_energy_recorder.recorder.listen_energy(source)
|
||||
self.speaker_energy_queue.put(energy)
|
||||
|
||||
def checkbox_input_speaker_threshold_check_callback(self):
|
||||
if self.checkbox_input_speaker_threshold_check.get():
|
||||
self.speaker_energy_queue = Queue()
|
||||
def speaker_threshold_check_start(self):
|
||||
speaker_device = [device for device in get_output_device_list() if device["name"] == self.parent.CHOICE_SPEAKER_DEVICE][0]
|
||||
|
||||
if get_default_output_device()["index"] == speaker_device["index"]:
|
||||
self.speaker_energy_queue = Queue()
|
||||
self.speaker_energy_recorder = SelectedSpeakeEnergyRecorder(speaker_device)
|
||||
self.speaker_energy_get_progressbar = thread_fnc(self.progressBar_input_speaker_energy_get)
|
||||
self.speaker_energy_get_progressbar.daemon = True
|
||||
@@ -404,12 +421,31 @@ class ToplevelWindowConfig(CTkToplevel):
|
||||
print_textbox(self.parent.textbox_message_log, "Windows playback device and selected device do not match. Change the Windows playback device.", "ERROR")
|
||||
print_textbox(self.parent.textbox_message_system_log, "Windows playback device and selected device do not match. Change the Windows playback device.", "ERROR")
|
||||
self.checkbox_input_speaker_threshold_check.deselect()
|
||||
else:
|
||||
self.checkbox_input_mic_threshold_check.configure(state="normal")
|
||||
self.checkbox_input_speaker_threshold_check.configure(state="normal")
|
||||
|
||||
def speaker_threshold_check_stop(self):
|
||||
if self.speaker_energy_get_progressbar != None:
|
||||
self.speaker_energy_get_progressbar.stop()
|
||||
if self.speaker_energy_plot_progressbar != None:
|
||||
self.speaker_energy_plot_progressbar.stop()
|
||||
|
||||
self.progressBar_input_speaker_energy_threshold.set(0)
|
||||
self.checkbox_input_mic_threshold_check.configure(state="normal")
|
||||
self.checkbox_input_speaker_threshold_check.configure(state="normal")
|
||||
|
||||
def checkbox_input_speaker_threshold_check_callback(self):
|
||||
self.checkbox_input_mic_threshold_check.configure(state="disabled")
|
||||
self.checkbox_input_speaker_threshold_check.configure(state="disabled")
|
||||
self.update()
|
||||
if self.checkbox_input_speaker_threshold_check.get():
|
||||
th_speaker_threshold_check_start = Thread(target=self.speaker_threshold_check_start)
|
||||
th_speaker_threshold_check_start.daemon = True
|
||||
th_speaker_threshold_check_start.start()
|
||||
else:
|
||||
th_speaker_threshold_check_stop = Thread(target=self.speaker_threshold_check_stop)
|
||||
th_speaker_threshold_check_stop.daemon = True
|
||||
th_speaker_threshold_check_stop.start()
|
||||
|
||||
def slider_input_speaker_energy_threshold_callback(self, value):
|
||||
self.parent.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value)
|
||||
|
||||
Reference in New Issue
Block a user