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 1/4] =?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 From f3f549494ef8f0e126f4625621efffe8cb9dce54 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 1 Sep 2023 03:10:43 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Config=20Window:=20Transcription=20Tab=20Th?= =?UTF-8?q?reshold=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF(Mic,=20Speaker)?= =?UTF-8?q?=E3=81=AECallback=E9=96=A2=E6=95=B0=E3=82=92main.py=E3=81=8B?= =?UTF-8?q?=E3=82=89=E5=91=BC=E3=81=B9=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=80=82=20=E5=90=84=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE?= =?UTF-8?q?=E3=81=8C=E3=81=A1=E3=82=83=E3=82=93=E3=81=A8main.py=E3=81=A7?= =?UTF-8?q?=E5=91=BC=E3=81=B0=E3=82=8C=E3=81=A6=E3=81=84=E3=82=8B=E3=81=8B?= =?UTF-8?q?=E7=A2=BA=E8=AA=8D=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81=E3=81=AB?= =?UTF-8?q?print=E6=96=87=E8=BF=BD=E5=8A=A0=E3=80=82=E3=81=8A=E3=81=8B?= =?UTF-8?q?=E3=81=92=E3=81=A7=E6=8C=87=E5=AE=9A=E3=81=97=E5=BF=98=E3=82=8C?= =?UTF-8?q?=E3=81=AA=E3=81=A9=E3=81=8C=E5=88=86=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E3=81=9D=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=80=82?= =?UTF-8?q?=20=E8=B5=B7=E5=8B=95=E6=99=82OSC=E3=83=81=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=82=AF=E5=87=A6=E7=90=86=E3=81=AE=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88=E6=88=BB=E3=81=99=E3=81=AE?= =?UTF-8?q?=E3=82=92=E5=BF=98=E3=82=8C=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3(=E9=96=8B=E7=99=BA=E4=B8=8A?= =?UTF-8?q?=E3=81=97=E3=81=84=E3=81=AA=E3=81=8C=E3=82=88=E3=81=8F=E3=82=84?= =?UTF-8?q?=E3=82=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 76 ++++++++++++------- view.py | 2 + vrct_gui/config_window/ConfigWindow.py | 2 + .../createSettingBox_Others.py | 2 +- .../createSettingBox_Mic.py | 8 +- .../createSettingBox_Speaker.py | 2 +- 6 files changed, 59 insertions(+), 33 deletions(-) diff --git a/main.py b/main.py index b455bf17..17eb02b8 100644 --- a/main.py +++ b/main.py @@ -224,30 +224,31 @@ def callbackDisableConfigWindowCompactMode(): # Appearance Tab def callbackSetTransparency(value): - print(int(value)) - # self.parent.wm_attributes("-alpha", int(value/100)) + print("callbackSetTransparency", int(value)) config.TRANSPARENCY = int(value) + # self.parent.wm_attributes("-alpha", int(value/100)) def callbackSetAppearance(value): - print(value) + print("callbackSetAppearance", value) config.APPEARANCE_THEME = value def callbackSetUiScaling(value): - print(value) + print("callbackSetUiScaling", value) config.UI_SCALING = value new_scaling_float = int(value.replace("%", "")) / 100 + print("callbackSetUiScaling_new_scaling_float", new_scaling_float) def callbackSetFontFamily(value): - print(value) + print("callbackSetFontFamily", value) config.FONT_FAMILY = value def callbackSetUiLanguage(value): - print(value) + print("callbackSetUiLanguage", value) config.UI_LANGUAGE = value # Translation Tab def callbackSetDeeplAuthkey(value): - print(str(value)) + print("callbackSetDeeplAuthkey", 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: @@ -258,38 +259,48 @@ def callbackSetDeeplAuthkey(value): # Transcription Tab (Mic) def callbackSetMicHost(value): - print(value) + print("callbackSetMicHost", value) config.CHOICE_MIC_HOST = value def callbackSetMicDevice(value): - print(value) + print("callbackSetMicDevice", value) config.CHOICE_MIC_DEVICE = value def callbackSetMicEnergyThreshold(value): - print(int(value)) + print("callbackSetMicEnergyThreshold", int(value)) config.INPUT_MIC_ENERGY_THRESHOLD = int(value) def callbackSetMicDynamicEnergyThreshold(value): - print(value) + print("callbackSetMicDynamicEnergyThreshold", value) config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = value +def callbackCheckMicThreshold(is_turned_on): + print("callbackCheckMicThreshold", is_turned_on) + if is_turned_on is True: + # UIの処理あり + pass + else: + # UIの処理あり + pass + def callbackSetMicRecordTimeout(value): - print(int(value)) + print("callbackSetMicRecordTimeout", int(value)) config.INPUT_MIC_RECORD_TIMEOUT = int(value) def callbackSetMicPhraseTimeout(value): - print(int(value)) + print("callbackSetMicPhraseTimeout", int(value)) config.INPUT_MIC_PHRASE_TIMEOUT = int(value) def callbackSetMicMaxPhrases(value): - print(int(value)) + print("callbackSetMicMaxPhrases", int(value)) config.INPUT_MIC_MAX_PHRASES = int(value) def callbackSetMicWordFilter(value): + print("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) + print("callbackSetMicWordFilter_afterSplitting", word_filter) if len(word_filter) > 0: config.INPUT_MIC_WORD_FILTER = word_filter.split(",") else: @@ -299,52 +310,61 @@ def callbackSetMicWordFilter(value): # Transcription Tab (Speaker) def callbackSetSpeakerDevice(value): - print(value) + print("callbackSetSpeakerDevice", value) config.CHOICE_SPEAKER_DEVICE = value def callbackSetSpeakerEnergyThreshold(value): - print(int(value)) + print("callbackSetSpeakerEnergyThreshold", int(value)) config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value) def callbackSetSpeakerDynamicEnergyThreshold(value): - print(value) + print("callbackSetSpeakerDynamicEnergyThreshold", value) config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value +def callbackCheckSpeakerThreshold(is_turned_on): + print("callbackCheckSpeakerThreshold", is_turned_on) + if is_turned_on is True: + # UIの処理あり + pass + else: + # UIの処理あり + pass + def callbackSetSpeakerRecordTimeout(value): - print(int(value)) + print("callbackSetSpeakerRecordTimeout", int(value)) config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value) def callbackSetSpeakerPhraseTimeout(value): - print(int(value)) + print("callbackSetSpeakerPhraseTimeout", int(value)) config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value) def callbackSetSpeakerMaxPhrases(value): - print(int(value)) + print("callbackSetSpeakerMaxPhrases", int(value)) config.INPUT_SPEAKER_MAX_PHRASES = int(value) # Others Tab def callbackSetEnableAutoClearChatbox(value): - print(value) + print("callbackSetEnableAutoClearChatbox", value) config.ENABLE_AUTO_CLEAR_CHATBOX = value def callbackSetEnableNoticeXsoverlay(value): - print(value) + print("callbackSetEnableNoticeXsoverlay", value) config.ENABLE_NOTICE_XSOVERLAY = value def callbackSetMessageFormat(value): - print(value) + print("callbackSetMessageFormat", value) if len(value) > 0: config.MESSAGE_FORMAT = value # Advanced Settings Tab def callbackSetOscIpAddress(value): - print(value) + print("callbackSetOscIpAddress", value) config.OSC_IP_ADDRESS = value def callbackSetOscPort(value): - print(int(value)) + print("callbackSetOscPort", int(value)) config.OSC_PORT = int(value) @@ -361,7 +381,7 @@ if model.authenticationTranslator() is False: model.addKeywords() # check OSC started -# model.checkOSCStarted() +model.checkOSCStarted() # check Software Updated model.checkSoftwareUpdated() @@ -410,6 +430,7 @@ view.register( "callback_set_mic_device": callbackSetMicDevice, "callback_set_mic_energy_threshold": callbackSetMicEnergyThreshold, "callback_set_mic_dynamic_energy_threshold": callbackSetMicDynamicEnergyThreshold, + "callback_check_mic_threshold": callbackCheckMicThreshold, "callback_set_mic_record_timeout": callbackSetMicRecordTimeout, "callback_set_mic_phrase_timeout": callbackSetMicPhraseTimeout, "callback_set_mic_max_phrases": callbackSetMicMaxPhrases, @@ -419,6 +440,7 @@ view.register( "callback_set_speaker_device": callbackSetSpeakerDevice, "callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold, "callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold, + "callback_check_speaker_threshold": callbackCheckSpeakerThreshold, "callback_set_speaker_record_timeout": callbackSetSpeakerRecordTimeout, "callback_set_speaker_phrase_timeout": callbackSetSpeakerPhraseTimeout, "callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases, diff --git a/view.py b/view.py index f23adffa..56132574 100644 --- a/view.py +++ b/view.py @@ -86,6 +86,7 @@ class View(): 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_CHECK_MIC_THRESHOLD = config_window["callback_check_mic_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"] @@ -95,6 +96,7 @@ class View(): 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_CHECK_SPEAKER_THRESHOLD = config_window["callback_check_speaker_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"] diff --git a/vrct_gui/config_window/ConfigWindow.py b/vrct_gui/config_window/ConfigWindow.py index 64dda3cf..f561a370 100644 --- a/vrct_gui/config_window/ConfigWindow.py +++ b/vrct_gui/config_window/ConfigWindow.py @@ -35,6 +35,7 @@ class ConfigWindow(CTkToplevel): self.CALLBACK_SET_MIC_DEVICE = None self.CALLBACK_SET_MIC_ENERGY_THRESHOLD = None self.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD = None + self.CALLBACK_CHECK_MIC_THRESHOLD = None self.CALLBACK_SET_MIC_RECORD_TIMEOUT = None self.CALLBACK_SET_MIC_PHRASE_TIMEOUT = None self.CALLBACK_SET_MIC_MAX_PHRASES = None @@ -44,6 +45,7 @@ class ConfigWindow(CTkToplevel): self.CALLBACK_SET_SPEAKER_DEVICE = None self.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD = None self.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = None + self.CALLBACK_CHECK_SPEAKER_THRESHOLD = None self.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT = None self.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = None self.CALLBACK_SET_SPEAKER_MAX_PHRASES = None 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 a92249c7..c5cb4fb2 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 @@ -16,7 +16,7 @@ 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): - callFunctionIfCallable(config_window.CALLBACK_SET_DEEPL_AUTHKEY, checkbox_box_widget.get()) + callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_CHATBOX, checkbox_box_widget.get()) def checkbox_notice_xsoverlay_callback(checkbox_box_widget): callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) 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 68b6a39d..e4e550c2 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 @@ -16,8 +16,8 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): createSettingBoxEntry = sbg.createSettingBoxEntry - def checkbox_input_speaker_threshold_check_callback(e, passive_button_wrapper_widget, active_button_wrapper_widget, is_turned_on): - print("is_turned_on", is_turned_on) + def checkbox_input_mic_threshold_check_callback(e, passive_button_wrapper_widget, active_button_wrapper_widget, is_turned_on): + callFunctionIfCallable(config_window.CALLBACK_CHECK_MIC_THRESHOLD, is_turned_on) if is_turned_on is True: passive_button_widget = passive_button_wrapper_widget.children["!ctklabel"] @@ -112,14 +112,14 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): progressbar_attr_name="sb__progressbar_x_slider__progressbar_mic_energy_threshold", passive_button_attr_name="sb__progressbar_x_slider__passive_button_mic_energy_threshold", - passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( + passive_button_command=lambda e: checkbox_input_mic_threshold_check_callback( e, config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold, config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold, is_turned_on=True, ), active_button_attr_name="sb__progressbar_x_slider__active_button_mic_energy_threshold", - active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( + active_button_command=lambda e: checkbox_input_mic_threshold_check_callback( e, config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold, config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold, 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 70cf726d..a4237b82 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 @@ -17,7 +17,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings): def checkbox_input_speaker_threshold_check_callback(e, passive_button_wrapper_widget, active_button_wrapper_widget, is_turned_on): - print("is_turned_on", is_turned_on) + callFunctionIfCallable(config_window.CALLBACK_CHECK_SPEAKER_THRESHOLD, is_turned_on) if is_turned_on is True: passive_button_widget = passive_button_wrapper_widget.children["!ctklabel"] From 19b2cbb010efff8e6627f3577f2b3a036e550aab Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 1 Sep 2023 03:29:33 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A4=89=E6=95=B0=E5=90=8D=20=E9=96=A2?= =?UTF-8?q?=E6=95=B0=E5=90=8D=E5=A4=89=E6=9B=B4:=20chatbox=20->=20message?= =?UTF-8?q?=20box.=20=E3=83=A1=E3=82=A4=E3=83=B3=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=AE=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E6=AC=84=E3=81=AE=E4=BA=8B=E3=81=AFmessage=20box.=20chatbox?= =?UTF-8?q?=E3=81=AFvrc=E5=86=85=E3=81=AEchatbox=E3=82=82=E3=81=82?= =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=81=A7=E5=91=BC=E3=81=B3=E6=96=B9=E3=82=92?= =?UTF-8?q?=E5=88=86=E3=81=91=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 12 ++++++------ main.py | 10 +++++----- view.py | 2 +- vrct_gui/config_window/ConfigWindow.py | 2 +- .../setting_box_others/createSettingBox_Others.py | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config.py b/config.py index a66921a4..1e86fa4a 100644 --- a/config.py +++ b/config.py @@ -359,13 +359,13 @@ class Config: saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property - def ENABLE_AUTO_CLEAR_CHATBOX(self): - return self._ENABLE_AUTO_CLEAR_CHATBOX + def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self): + return self._ENABLE_AUTO_CLEAR_MESSAGE_BOX - @ENABLE_AUTO_CLEAR_CHATBOX.setter - def ENABLE_AUTO_CLEAR_CHATBOX(self, value): + @ENABLE_AUTO_CLEAR_MESSAGE_BOX.setter + def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self, value): if type(value) is bool: - self._ENABLE_AUTO_CLEAR_CHATBOX = value + self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property @@ -493,7 +493,7 @@ class Config: "Google(web)": None, } self._MESSAGE_FORMAT = "[message]([translation])" - self._ENABLE_AUTO_CLEAR_CHATBOX = False + self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = False self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_OSC = False self._UPDATE_FLAG = False diff --git a/main.py b/main.py index 17eb02b8..c939d26b 100644 --- a/main.py +++ b/main.py @@ -90,7 +90,7 @@ def sendChatMessage(message): view.printToTextbox_SentMessage(message, translation) # delete message in entry message box - if config.ENABLE_AUTO_CLEAR_CHATBOX is True: + if config.ENABLE_AUTO_CLEAR_MESSAGE_BOX is True: view.clearMessageBox() def messageBoxPressKeyEnter(e): @@ -344,9 +344,9 @@ def callbackSetSpeakerMaxPhrases(value): # Others Tab -def callbackSetEnableAutoClearChatbox(value): - print("callbackSetEnableAutoClearChatbox", value) - config.ENABLE_AUTO_CLEAR_CHATBOX = value +def callbackSetEnableAutoClearMessageBox(value): + print("callbackSetEnableAutoClearMessageBox", value) + config.ENABLE_AUTO_CLEAR_MESSAGE_BOX = value def callbackSetEnableNoticeXsoverlay(value): print("callbackSetEnableNoticeXsoverlay", value) @@ -446,7 +446,7 @@ view.register( "callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases, # Others Tab - "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearChatbox, + "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_message_format": callbackSetMessageFormat, diff --git a/view.py b/view.py index 56132574..975921f8 100644 --- a/view.py +++ b/view.py @@ -102,7 +102,7 @@ class View(): 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_AUTO_CLEAR_MESSAGE_BOX = 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"] diff --git a/vrct_gui/config_window/ConfigWindow.py b/vrct_gui/config_window/ConfigWindow.py index f561a370..25e03688 100644 --- a/vrct_gui/config_window/ConfigWindow.py +++ b/vrct_gui/config_window/ConfigWindow.py @@ -51,7 +51,7 @@ class ConfigWindow(CTkToplevel): self.CALLBACK_SET_SPEAKER_MAX_PHRASES = None # Others Tab - self.CALLBACK_SET_ENABLE_AUTO_CLEAR_CHATBOX = None + self.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = None self.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = None self.CALLBACK_SET_MESSAGE_FORMAT = None 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 c5cb4fb2..b0d77325 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 @@ -14,9 +14,9 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings): createSettingBoxEntry = sbg.createSettingBoxEntry - # 関数名 chatbox から messagebox に変える予定 config.ENABLE_AUTO_CLEAR_CHATBOX も MESSAGEBOXに変えるかな。 - def checkbox_auto_clear_chatbox_callback(checkbox_box_widget): - callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_CHATBOX, checkbox_box_widget.get()) + # 元 checkbox_auto_clear_chatbox_callback + def checkbox_auto_clear_message_box_callback(checkbox_box_widget): + callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX, checkbox_box_widget.get()) def checkbox_notice_xsoverlay_callback(checkbox_box_widget): callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) @@ -26,15 +26,15 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings): row=0 - config_window.sb__auto_clear_chatbox = createSettingBoxCheckbox( + config_window.sb__auto_clear_message_box = createSettingBoxCheckbox( parent_widget=setting_box_wrapper, label_text="Auto Clear The Message Box", desc_text="Clear the message box after sending your message.", - checkbox_attr_name="sb__checkbox_auto_clear_chatbox", - command=lambda: checkbox_auto_clear_chatbox_callback(config_window.sb__checkbox_auto_clear_chatbox), + checkbox_attr_name="sb__checkbox_auto_clear_message_box", + command=lambda: checkbox_auto_clear_message_box_callback(config_window.sb__checkbox_auto_clear_message_box), is_checked=False ) - config_window.sb__auto_clear_chatbox.grid(row=row) + config_window.sb__auto_clear_message_box.grid(row=row) row+=1 From 55ee9e6325703eec43ff0c462f5a70f212f35d0f Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 1 Sep 2023 03:36:33 +0900 Subject: [PATCH 4/4] [Chore] remove the code that is no longer in use. --- .../_createSettingBoxContainer.py | 1 - .../createSettingBox_AdvancedSettings.py | 2 -- .../setting_box_appearance/createSettingBox_Appearance.py | 6 +----- .../setting_box_others/createSettingBox_Others.py | 2 -- .../setting_box_translation/createSettingBox_Translation.py | 2 -- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py index a8219006..dd01d49c 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py @@ -19,7 +19,6 @@ def _createSettingBoxContainer(config_window, settings, setting_box_container_se return setting_box_wrapper_section_title_frame - # Common setting # Setting box container setting_box_container_widget = CTkFrame(config_window.main_setting_box_bg_wrapper, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0) 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 32a01e06..10fdb6f8 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 @@ -1,5 +1,3 @@ -from time import sleep - from customtkinter import StringVar, IntVar from utils import callFunctionIfCallable 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 e8dda661..fc9567ba 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 @@ -1,11 +1,8 @@ -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, callFunctionIfCallable - from .._SettingBoxGenerator import _SettingBoxGenerator from config import config @@ -16,7 +13,7 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): createSettingBoxSlider = sbg.createSettingBoxSlider # 関数名は変えるかもしれない。 - # テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中\ + # テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中 def slider_transparency_callback(value): callFunctionIfCallable(config_window.CALLBACK_SET_TRANSPARENCY, value) @@ -25,7 +22,6 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): def optionmenu_ui_scaling_callback(value): callFunctionIfCallable(config_window.CALLBACK_SET_UI_SCALING, value) - # self.optionmenu_ui_scaling.set(choice) def optionmenu_font_family_callback(value): callFunctionIfCallable(config_window.CALLBACK_SET_FONT_FAMILY, value) 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 b0d77325..7b5811c9 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 @@ -1,5 +1,3 @@ -from time import sleep - from customtkinter import StringVar, IntVar from utils import callFunctionIfCallable 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 974e6f33..5c635edd 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 @@ -1,5 +1,3 @@ -from time import sleep - from customtkinter import StringVar, IntVar from utils import callFunctionIfCallable