From 90668b1e7aa8beef6a8cd4ee236d35800082e0c3 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:17:01 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20view.py=E3=81=AB=E3=80=81=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E9=A0=85=E7=9B=AE=20mic=5Fhost=20mic=5Fdevice=20speak?= =?UTF-8?q?er=5Fdevice=E3=81=AE=E6=9B=B4=E6=96=B0=E3=80=81=E3=82=BB?= =?UTF-8?q?=E3=83=83=E3=83=88=E9=96=A2=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=80=82=20model.py=E3=81=A7=E5=AE=9F=E9=9A=9B=E3=81=ABdevice?= =?UTF-8?q?=E3=81=AA=E3=81=A9=E3=82=92=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B?= =?UTF-8?q?=E9=96=A2=E6=95=B0=E3=82=82=E5=85=A5=E3=82=8C=E8=BE=BC=E3=81=BF?= =?UTF-8?q?(=E5=85=83=E3=80=85=E3=81=82=E3=81=A3=E3=81=9F=E3=82=82?= =?UTF-8?q?=E3=81=AE=E3=82=92=E7=A7=BB=E6=A4=8D)=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E3=80=81=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E4=B8=8A=E3=81=A7=E8=A6=8B=E3=81=9F=E7=9B=AE=E3=81=A0=E3=81=91?= =?UTF-8?q?=E3=81=AF=E5=AE=9F=E9=9A=9B=E3=81=AE=E5=80=A4=E3=81=A7=E5=8B=95?= =?UTF-8?q?=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 9 +++++++-- view.py | 34 ++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 149ed4e0..4a36015e 100644 --- a/main.py +++ b/main.py @@ -247,6 +247,10 @@ def callbackSetDeeplAuthkey(value): def callbackSetMicHost(value): print("callbackSetMicHost", value) config.CHOICE_MIC_HOST = value + config.CHOICE_MIC_DEVICE = model.getInputDefaultDevice() + + view.updateSelected_MicDevice(config.CHOICE_MIC_DEVICE) + view.updateList_MicDevice(model.getListInputDevice()) def callbackSetMicDevice(value): print("callbackSetMicDevice", value) @@ -415,9 +419,9 @@ view.register( # Transcription Tab (Mic) "callback_set_mic_host": callbackSetMicHost, - "list_mic_host": ["list_mic_host"], + "list_mic_host": model.getListInputHost(), "callback_set_mic_device": callbackSetMicDevice, - "list_mic_device": ["list_mic_device"], + "list_mic_device": model.getListInputDevice(), "callback_set_mic_energy_threshold": callbackSetMicEnergyThreshold, "callback_set_mic_dynamic_energy_threshold": callbackSetMicDynamicEnergyThreshold, "callback_check_mic_threshold": callbackCheckMicThreshold, @@ -428,6 +432,7 @@ view.register( # Transcription Tab (Speaker) "callback_set_speaker_device": callbackSetSpeakerDevice, + "list_speaker_device": model.getListOutputDevice(), "callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold, "callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold, "callback_check_speaker_threshold": callbackCheckSpeakerThreshold, diff --git a/view.py b/view.py index 26d7adbe..6d625a2e 100644 --- a/view.py +++ b/view.py @@ -105,13 +105,13 @@ class View(): # Transcription Tab (Mic) VAR_LABEL_MIC_HOST=StringVar(value="Mic Host"), VAR_DESC_MIC_HOST=StringVar(value="Select the mic host. (Default: ?)"), - LIST_MIC_HOST=[], # model.getListInputHost(), + LIST_MIC_HOST=[], CALLBACK_SET_MIC_HOST=None, VAR_MIC_HOST=StringVar(value=config.CHOICE_MIC_HOST), VAR_LABEL_MIC_DEVICE=StringVar(value="Mic Device"), VAR_DESC_MIC_DEVICE=StringVar(value="Select the mic devise. (Default: ?)"), - LIST_MIC_DEVICE=[], # model.getListInputDevice(), + LIST_MIC_DEVICE=[], CALLBACK_SET_MIC_DEVICE=None, VAR_MIC_DEVICE=StringVar(value=config.CHOICE_MIC_DEVICE), @@ -150,7 +150,7 @@ class View(): # Transcription Tab (Speaker) VAR_LABEL_SPEAKER_DEVICE=StringVar(value="Speaker Device"), VAR_DESC_SPEAKER_DEVICE=StringVar(value="Select the speaker devise. (Default: ?)"), - LIST_SPEAKER_DEVICE=[], # model.getListOutputDevice(), + LIST_SPEAKER_DEVICE=[], CALLBACK_SET_SPEAKER_DEVICE=None, VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE), @@ -276,11 +276,11 @@ class View(): # Transcription Tab (Mic) vrct_gui.config_window.CALLBACK_SET_MIC_HOST = config_window["callback_set_mic_host"] - # vrct_gui.config_window.LIST_MIC_HOST = config_window["list_mic_host"] - self.updateList_MicHost(vrct_gui.config_window.LIST_MIC_HOST) + self.updateList_MicHost(config_window["list_mic_host"]) vrct_gui.config_window.CALLBACK_SET_MIC_DEVICE = config_window["callback_set_mic_device"] - vrct_gui.config_window.LIST_MIC_DEVISE = config_window["list_mic_device"] + self.updateList_MicDevice(config_window["list_mic_device"]) + vrct_gui.config_window.CALLBACK_SET_MIC_ENERGY_THRESHOLD = config_window["callback_set_mic_energy_threshold"] vrct_gui.config_window.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD = config_window["callback_set_mic_dynamic_energy_threshold"] @@ -292,6 +292,8 @@ class View(): # Transcription Tab (Speaker) vrct_gui.config_window.CALLBACK_SET_SPEAKER_DEVICE = config_window["callback_set_speaker_device"] + self.updateList_SpeakerDevice(config_window["list_speaker_device"]) + vrct_gui.config_window.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD = config_window["callback_set_speaker_energy_threshold"] vrct_gui.config_window.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = config_window["callback_set_speaker_dynamic_energy_threshold"] vrct_gui.config_window.CALLBACK_CHECK_SPEAKER_THRESHOLD = config_window["callback_check_speaker_threshold"] @@ -422,8 +424,24 @@ class View(): vrct_gui.config_window.reloadConfigWindowSettingBoxContainer() - def updateList_MicHost(self, list__mic_host): - vrct_gui.config_window.LIST_MIC_HOST = list__mic_host + def updateList_MicHost(self, new_mic_host_list:list): + vrct_gui.config_window.LIST_MIC_HOST = new_mic_host_list + vrct_gui.config_window.sb__optionmenu_mic_host.configure(values=new_mic_host_list) + def updateSelected_MicHost(self, selected_mic_host_name:str): + vrct_gui.config_window.VAR_MIC_HOST.set(selected_mic_host_name) + + def updateList_MicDevice(self, new_mic_device_list): + vrct_gui.config_window.LIST_MIC_DEVICE = new_mic_device_list + vrct_gui.config_window.sb__optionmenu_mic_device.configure(values=new_mic_device_list) + + def updateSelected_MicDevice(self, default_selected_mic_device_name:str): + self.view_variable.VAR_MIC_DEVICE.set(default_selected_mic_device_name) + + + + def updateList_SpeakerDevice(self, new_speaker_device_list): + vrct_gui.config_window.LIST_SPEAKER_DEVICE = new_speaker_device_list + vrct_gui.config_window.sb__optionmenu_speaker_device.configure(values=new_speaker_device_list) view = View() \ No newline at end of file