From 799a1a27bb378b6022a779c954cc75f31fb2e5ae Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 1 Sep 2023 02:25:00 +0900 Subject: [PATCH] =?UTF-8?q?Config=20Window=E3=81=AE=E5=90=84=E9=A0=85?= =?UTF-8?q?=E7=9B=AECallback=E9=96=A2=E6=95=B0=E3=82=92main.py=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=83=AD=E3=83=BC=E3=83=A9=E3=81=A7=E5=AE=9F?= =?UTF-8?q?=E8=A1=8C=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 168 +++++++++++++++++- utils.py | 5 +- view.py | 39 ++++ vrct_gui/config_window/ConfigWindow.py | 38 ++++ .../createSettingBox_AdvancedSettings.py | 5 +- .../createSettingBox_Appearance.py | 21 +-- .../createSettingBox_Others.py | 10 +- .../createSettingBox_Mic.py | 30 +--- .../createSettingBox_Speaker.py | 17 +- .../createSettingBox_Translation.py | 10 +- 10 files changed, 282 insertions(+), 61 deletions(-) diff --git a/main.py b/main.py index d6f7b199..b455bf17 100644 --- a/main.py +++ b/main.py @@ -213,6 +213,7 @@ def callbackToggleForeground(): # Config Window +# Compact Mode Switch def callbackEnableConfigWindowCompactMode(): config.IS_CONFIG_WINDOW_COMPACT_MODE = True view.reloadConfigWindowSettingBoxContainer() @@ -221,6 +222,133 @@ def callbackDisableConfigWindowCompactMode(): config.IS_CONFIG_WINDOW_COMPACT_MODE = False view.reloadConfigWindowSettingBoxContainer() +# Appearance Tab +def callbackSetTransparency(value): + print(int(value)) + # self.parent.wm_attributes("-alpha", int(value/100)) + config.TRANSPARENCY = int(value) + +def callbackSetAppearance(value): + print(value) + config.APPEARANCE_THEME = value + +def callbackSetUiScaling(value): + print(value) + config.UI_SCALING = value + new_scaling_float = int(value.replace("%", "")) / 100 + +def callbackSetFontFamily(value): + print(value) + config.FONT_FAMILY = value + +def callbackSetUiLanguage(value): + print(value) + config.UI_LANGUAGE = value + +# Translation Tab +def callbackSetDeeplAuthkey(value): + print(str(value)) + # config.AUTH_KEYS["DeepL(auth)"] = str(value) + # if len(value) > 0: + # if model.authenticationTranslator(choice_translator="DeepL(auth)", auth_key=value) is True: + # print_textbox(self.parent.textbox_message_log, "Auth key update completed", "INFO") + # print_textbox(self.parent.textbox_message_system_log, "Auth key update completed", "INFO") + # else: + # pass + +# Transcription Tab (Mic) +def callbackSetMicHost(value): + print(value) + config.CHOICE_MIC_HOST = value + +def callbackSetMicDevice(value): + print(value) + config.CHOICE_MIC_DEVICE = value + +def callbackSetMicEnergyThreshold(value): + print(int(value)) + config.INPUT_MIC_ENERGY_THRESHOLD = int(value) + +def callbackSetMicDynamicEnergyThreshold(value): + print(value) + config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = value + +def callbackSetMicRecordTimeout(value): + print(int(value)) + config.INPUT_MIC_RECORD_TIMEOUT = int(value) + +def callbackSetMicPhraseTimeout(value): + print(int(value)) + config.INPUT_MIC_PHRASE_TIMEOUT = int(value) + +def callbackSetMicMaxPhrases(value): + print(int(value)) + config.INPUT_MIC_MAX_PHRASES = int(value) + +def callbackSetMicWordFilter(value): + word_filter = str(value) + word_filter = [w.strip() for w in word_filter.split(",") if len(w.strip()) > 0] + word_filter = ",".join(word_filter) + print(word_filter) + if len(word_filter) > 0: + config.INPUT_MIC_WORD_FILTER = word_filter.split(",") + else: + config.INPUT_MIC_WORD_FILTER = [] + # model.resetKeywordProcessor() + # model.addKeywords() + +# Transcription Tab (Speaker) +def callbackSetSpeakerDevice(value): + print(value) + config.CHOICE_SPEAKER_DEVICE = value + +def callbackSetSpeakerEnergyThreshold(value): + print(int(value)) + config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value) + +def callbackSetSpeakerDynamicEnergyThreshold(value): + print(value) + config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value + +def callbackSetSpeakerRecordTimeout(value): + print(int(value)) + config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value) + +def callbackSetSpeakerPhraseTimeout(value): + print(int(value)) + config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value) + +def callbackSetSpeakerMaxPhrases(value): + print(int(value)) + config.INPUT_SPEAKER_MAX_PHRASES = int(value) + + +# Others Tab +def callbackSetEnableAutoClearChatbox(value): + print(value) + config.ENABLE_AUTO_CLEAR_CHATBOX = value + +def callbackSetEnableNoticeXsoverlay(value): + print(value) + config.ENABLE_NOTICE_XSOVERLAY = value + +def callbackSetMessageFormat(value): + print(value) + if len(value) > 0: + config.MESSAGE_FORMAT = value + + +# Advanced Settings Tab +def callbackSetOscIpAddress(value): + print(value) + config.OSC_IP_ADDRESS = value + +def callbackSetOscPort(value): + print(int(value)) + config.OSC_PORT = int(value) + + + # create GUI view.createGUI() @@ -233,7 +361,7 @@ if model.authenticationTranslator() is False: model.addKeywords() # check OSC started -model.checkOSCStarted() +# model.checkOSCStarted() # check Software Updated model.checkSoftwareUpdated() @@ -263,8 +391,46 @@ view.register( }, config_window={ + # Compact Mode Switch "callback_disable_config_window_compact_mode": callbackEnableConfigWindowCompactMode, "callback_enable_config_window_compact_mode": callbackDisableConfigWindowCompactMode, + + # Appearance Tab + "callback_set_transparency": callbackSetTransparency, + "callback_set_appearance": callbackSetAppearance, + "callback_set_ui_scaling": callbackSetUiScaling, + "callback_set_font_family": callbackSetFontFamily, + "callback_set_ui_language": callbackSetUiLanguage, + + # Translation Tab + "callback_set_deepl_authkey": callbackSetDeeplAuthkey, + + # Transcription Tab (Mic) + "callback_set_mic_host": callbackSetMicHost, + "callback_set_mic_device": callbackSetMicDevice, + "callback_set_mic_energy_threshold": callbackSetMicEnergyThreshold, + "callback_set_mic_dynamic_energy_threshold": callbackSetMicDynamicEnergyThreshold, + "callback_set_mic_record_timeout": callbackSetMicRecordTimeout, + "callback_set_mic_phrase_timeout": callbackSetMicPhraseTimeout, + "callback_set_mic_max_phrases": callbackSetMicMaxPhrases, + "callback_set_mic_word_filter": callbackSetMicWordFilter, + + # Transcription Tab (Speaker) + "callback_set_speaker_device": callbackSetSpeakerDevice, + "callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold, + "callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold, + "callback_set_speaker_record_timeout": callbackSetSpeakerRecordTimeout, + "callback_set_speaker_phrase_timeout": callbackSetSpeakerPhraseTimeout, + "callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases, + + # Others Tab + "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearChatbox, + "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, + "callback_set_message_format": callbackSetMessageFormat, + + # Advanced Settings Tab + "callback_set_osc_ip_address": callbackSetOscIpAddress, + "callback_set_osc_port": callbackSetOscPort, }, ) diff --git a/utils.py b/utils.py index a68474fb..d15b169c 100644 --- a/utils.py +++ b/utils.py @@ -9,4 +9,7 @@ def get_key_by_value(dictionary, value): for key, val in dictionary.items(): if val == value: return key - return None \ No newline at end of file + return None + +def callFunctionIfCallable(function, *args): + if callable(function) is True: function(*args) \ No newline at end of file diff --git a/view.py b/view.py index 3868fde7..f23adffa 100644 --- a/view.py +++ b/view.py @@ -64,10 +64,49 @@ class View(): entry_message_box.bind("", self._foregroundOnForcefully) + # Config Window + # Compact Mode Switch vrct_gui.config_window.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE = config_window["callback_disable_config_window_compact_mode"] vrct_gui.config_window.CALLBACK_DISABLE_CONFIG_WINDOW_COMPACT_MODE = config_window["callback_enable_config_window_compact_mode"] + # Appearance Tab + vrct_gui.config_window.CALLBACK_SET_TRANSPARENCY = config_window["callback_set_transparency"] + vrct_gui.config_window.CALLBACK_SET_APPEARANCE = config_window["callback_set_appearance"] + vrct_gui.config_window.CALLBACK_SET_UI_SCALING = config_window["callback_set_ui_scaling"] + vrct_gui.config_window.CALLBACK_SET_FONT_FAMILY = config_window["callback_set_font_family"] + vrct_gui.config_window.CALLBACK_SET_UI_LANGUAGE = config_window["callback_set_ui_language"] + + + # Translation Tab + vrct_gui.config_window.CALLBACK_SET_DEEPL_AUTHKEY = config_window["callback_set_deepl_authkey"] + + # Transcription Tab (Mic) + vrct_gui.config_window.CALLBACK_SET_MIC_HOST = config_window["callback_set_mic_host"] + vrct_gui.config_window.CALLBACK_SET_MIC_DEVICE = config_window["callback_set_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"] + vrct_gui.config_window.CALLBACK_SET_MIC_RECORD_TIMEOUT = config_window["callback_set_mic_record_timeout"] + vrct_gui.config_window.CALLBACK_SET_MIC_PHRASE_TIMEOUT = config_window["callback_set_mic_phrase_timeout"] + vrct_gui.config_window.CALLBACK_SET_MIC_MAX_PHRASES = config_window["callback_set_mic_max_phrases"] + vrct_gui.config_window.CALLBACK_SET_MIC_WORD_FILTER = config_window["callback_set_mic_word_filter"] + + # Transcription Tab (Speaker) + vrct_gui.config_window.CALLBACK_SET_SPEAKER_DEVICE = config_window["callback_set_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_SET_SPEAKER_RECORD_TIMEOUT = config_window["callback_set_speaker_record_timeout"] + vrct_gui.config_window.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = config_window["callback_set_speaker_phrase_timeout"] + vrct_gui.config_window.CALLBACK_SET_SPEAKER_MAX_PHRASES = config_window["callback_set_speaker_max_phrases"] + + # Others Tab + vrct_gui.config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_CHATBOX = config_window["callback_set_enable_auto_clear_chatbox"] + vrct_gui.config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = config_window["callback_set_enable_notice_xsoverlay"] + vrct_gui.config_window.CALLBACK_SET_MESSAGE_FORMAT = config_window["callback_set_message_format"] + + # Advanced Settings Tab + vrct_gui.config_window.CALLBACK_SET_OSC_IP_ADDRESS = config_window["callback_set_osc_ip_address"] + vrct_gui.config_window.CALLBACK_SET_OSC_PORT = config_window["callback_set_osc_port"] diff --git a/vrct_gui/config_window/ConfigWindow.py b/vrct_gui/config_window/ConfigWindow.py index 3143fc19..64dda3cf 100644 --- a/vrct_gui/config_window/ConfigWindow.py +++ b/vrct_gui/config_window/ConfigWindow.py @@ -20,6 +20,44 @@ class ConfigWindow(CTkToplevel): self.settings = settings + # Appearance Tab + self.CALLBACK_SET_TRANSPARENCY = None + self.CALLBACK_SET_APPEARANCE = None + self.CALLBACK_SET_UI_SCALING = None + self.CALLBACK_SET_FONT_FAMILY = None + self.CALLBACK_SET_UI_LANGUAGE = None + + # Translation Tab + self.CALLBACK_SET_DEEPL_AUTHKEY = None + + # Transcription Tab (Mic) + self.CALLBACK_SET_MIC_HOST = None + self.CALLBACK_SET_MIC_DEVICE = None + self.CALLBACK_SET_MIC_ENERGY_THRESHOLD = None + self.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD = None + self.CALLBACK_SET_MIC_RECORD_TIMEOUT = None + self.CALLBACK_SET_MIC_PHRASE_TIMEOUT = None + self.CALLBACK_SET_MIC_MAX_PHRASES = None + self.CALLBACK_SET_MIC_WORD_FILTER = None + + # Transcription Tab (Speaker) + self.CALLBACK_SET_SPEAKER_DEVICE = None + self.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD = None + self.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = None + self.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT = None + self.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = None + self.CALLBACK_SET_SPEAKER_MAX_PHRASES = None + + # Others Tab + self.CALLBACK_SET_ENABLE_AUTO_CLEAR_CHATBOX = None + self.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = None + self.CALLBACK_SET_MESSAGE_FORMAT = None + + # Advanced Settings Tab + self.CALLBACK_SET_OSC_IP_ADDRESS = None + self.CALLBACK_SET_OSC_PORT = None + + createConfigWindowTitle(config_window=self, settings=settings) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py index b28b75a4..32a01e06 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py @@ -2,6 +2,7 @@ from time import sleep from customtkinter import StringVar, IntVar +from utils import callFunctionIfCallable from .._SettingBoxGenerator import _SettingBoxGenerator @@ -13,10 +14,10 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin def entry_ip_address_callback(value): - config.OSC_IP_ADDRESS = str(value) + callFunctionIfCallable(config_window.CALLBACK_SET_OSC_IP_ADDRESS, value) def entry_port_callback(value): - config.OSC_PORT = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_OSC_PORT, value) row=0 config_window.sb__ip_address = createSettingBoxEntry( diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py index 77bdb10c..e8dda661 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py @@ -3,7 +3,7 @@ from time import sleep from customtkinter import StringVar, IntVar from tkinter import font as tk_font from languages import selectable_languages -from utils import get_key_by_value +from utils import get_key_by_value, callFunctionIfCallable from .._SettingBoxGenerator import _SettingBoxGenerator @@ -15,28 +15,25 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu createSettingBoxSlider = sbg.createSettingBoxSlider - # 関数名は変えるかもしれない。 - # テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中 - - + # テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中\ def slider_transparency_callback(value): - # self.parent.wm_attributes("-alpha", int(value/100)) - config.TRANSPARENCY = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_TRANSPARENCY, value) def optionmenu_appearance_theme_callback(value): - config.APPEARANCE_THEME = value + callFunctionIfCallable(config_window.CALLBACK_SET_APPEARANCE, value) def optionmenu_ui_scaling_callback(value): + callFunctionIfCallable(config_window.CALLBACK_SET_UI_SCALING, value) # self.optionmenu_ui_scaling.set(choice) - # new_scaling_float = int(choice.replace("%", "")) / 100 - config.UI_SCALING = value def optionmenu_font_family_callback(value): - config.FONT_FAMILY = value + callFunctionIfCallable(config_window.CALLBACK_SET_FONT_FAMILY, value) def optionmenu_ui_language_callback(value): - config.UI_LANGUAGE = get_key_by_value(selectable_languages, value) + value = get_key_by_value(selectable_languages, value) + callFunctionIfCallable(config_window.CALLBACK_SET_UI_LANGUAGE, value) + row=0 config_window.sb__transparency = createSettingBoxSlider( diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index f65858c6..a92249c7 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -2,6 +2,7 @@ from time import sleep from customtkinter import StringVar, IntVar +from utils import callFunctionIfCallable from .._SettingBoxGenerator import _SettingBoxGenerator @@ -15,16 +16,13 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings): # 関数名 chatbox から messagebox に変える予定 config.ENABLE_AUTO_CLEAR_CHATBOX も MESSAGEBOXに変えるかな。 def checkbox_auto_clear_chatbox_callback(checkbox_box_widget): - print(checkbox_box_widget.get()) - config.ENABLE_AUTO_CLEAR_CHATBOX = checkbox_box_widget.get() + callFunctionIfCallable(config_window.CALLBACK_SET_DEEPL_AUTHKEY, checkbox_box_widget.get()) def checkbox_notice_xsoverlay_callback(checkbox_box_widget): - print(checkbox_box_widget.get()) - config.ENABLE_NOTICE_XSOVERLAY = checkbox_box_widget.get() + callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) def entry_message_format_callback(value): - if len(value) > 0: - config.MESSAGE_FORMAT = value + callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, value) row=0 diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py index 8cc5f1d1..68b6a39d 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py @@ -2,6 +2,7 @@ from time import sleep from customtkinter import StringVar, IntVar +from utils import callFunctionIfCallable from .._SettingBoxGenerator import _SettingBoxGenerator @@ -39,42 +40,29 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): passive_button_wrapper_widget.grid() def optionmenu_mic_host_callback(value): - config.CHOICE_MIC_HOST = value + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_HOST, value) def optionmenu_input_mic_device_callback(value): - config.CHOICE_MIC_DEVICE = value + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_DEVICE, value) def slider_input_mic_energy_threshold_callback(value): - config.INPUT_MIC_ENERGY_THRESHOLD = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_ENERGY_THRESHOLD, value) def checkbox_input_mic_dynamic_energy_threshold_callback(checkbox_box_widget): - print(checkbox_box_widget.get()) - config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = checkbox_box_widget.get() + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD, checkbox_box_widget.get()) def entry_input_mic_record_timeout_callback(value): - print(int(value)) - config.INPUT_MIC_RECORD_TIMEOUT = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_RECORD_TIMEOUT, value) def entry_input_mic_phrase_timeout_callback(value): - print(int(value)) - config.INPUT_MIC_PHRASE_TIMEOUT = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_PHRASE_TIMEOUT, value) def entry_input_mic_max_phrases_callback(value): - print(int(value)) - config.INPUT_MIC_MAX_PHRASES = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_MAX_PHRASES, value) def entry_input_mic_word_filters_callback(value): - word_filter = str(value) - word_filter = [w.strip() for w in word_filter.split(",") if len(w.strip()) > 0] - word_filter = ",".join(word_filter) - print(word_filter) - if len(word_filter) > 0: - config.INPUT_MIC_WORD_FILTER = word_filter.split(",") - else: - config.INPUT_MIC_WORD_FILTER = [] - # model.resetKeywordProcessor() - # model.addKeywords() + callFunctionIfCallable(config_window.CALLBACK_SET_MIC_WORD_FILTER, value) row=0 diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py index 9069abeb..70cf726d 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py @@ -2,6 +2,7 @@ from time import sleep from customtkinter import StringVar, IntVar +from utils import callFunctionIfCallable from .._SettingBoxGenerator import _SettingBoxGenerator @@ -39,27 +40,23 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings): passive_button_wrapper_widget.grid() def optionmenu_input_speaker_device_callback(value): - config.CHOICE_SPEAKER_DEVICE = value + callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_DEVICE, value) def slider_input_speaker_energy_threshold_callback(value): - config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD, value) def checkbox_input_speaker_dynamic_energy_threshold_callback(checkbox_box_widget): - print(checkbox_box_widget.get()) - config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = checkbox_box_widget.get() + callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, checkbox_box_widget.get()) def entry_input_speaker_record_timeout_callback(value): - print(int(value)) - config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT, value) def entry_input_speaker_phrase_timeout_callback(value): - print(int(value)) - config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT, value) def entry_input_speaker_max_phrases_callback(value): - print(int(value)) - config.INPUT_SPEAKER_MAX_PHRASES = int(value) + callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_MAX_PHRASES, value) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py index 1bc4ba0d..974e6f33 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py @@ -2,6 +2,7 @@ from time import sleep from customtkinter import StringVar, IntVar +from utils import callFunctionIfCallable from .._SettingBoxGenerator import _SettingBoxGenerator @@ -13,14 +14,7 @@ def createSettingBox_Translation(setting_box_wrapper, config_window, settings): def deepl_authkey_callback(value): - print(str(value)) - # config.AUTH_KEYS["DeepL(auth)"] = str(value) - # if len(value) > 0: - # if model.authenticationTranslator(choice_translator="DeepL(auth)", auth_key=value) is True: - # print_textbox(self.parent.textbox_message_log, "Auth key update completed", "INFO") - # print_textbox(self.parent.textbox_message_system_log, "Auth key update completed", "INFO") - # else: - # pass + callFunctionIfCallable(config_window.CALLBACK_SET_DEEPL_AUTHKEY, value) row=0