From 6b593b99d692a917e22796e2883aa222e84ea369 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:32:23 +0900 Subject: [PATCH 1/5] Setting box: add items Speaker Device, Speaker Energy Threshold include Dynamic one, Speaker Record Timeout, Speaker Phrase Timeout, Speaker Max Phrases. Fixed typo and remove the code that is not using anymore in createSettingBox_Mic.py. --- .../createSideMenuAndSettingsBoxContainers.py | 3 +- .../setting_box_containers/__init__.py | 2 +- .../setting_box_transcription/__init__.py | 3 +- .../createSettingBox_Mic.py | 147 +-------------- .../createSettingBox_Speaker.py | 170 ++++++++++++++++++ 5 files changed, 180 insertions(+), 145 deletions(-) create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index e31ec0e8..60f4cc1e 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -6,7 +6,7 @@ from .addConfigSideMenuItem import addConfigSideMenuItem from .createSettingBoxContainer import createSettingBoxContainer -from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic +from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker def createSideMenuAndSettingsBoxContainers(config_window, settings): @@ -77,6 +77,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings): "setting_box_container_attr_name": "setting_box_container_transcription", "setting_boxes": [ { "section_title": "Mic", "setting_box": createSettingBox_Mic }, + { "section_title": "Speaker", "setting_box": createSettingBox_Speaker }, ] }, "activate_by_default": True, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py index 9b5a1f7e..a5fa59f6 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py @@ -1,2 +1,2 @@ from .setting_box_appearance import createSettingBox_Appearance -from .setting_box_transcription import createSettingBox_Mic \ No newline at end of file +from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/__init__.py index 8ab3fc7e..5383094e 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/__init__.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/__init__.py @@ -1 +1,2 @@ -from .createSettingBox_Mic import createSettingBox_Mic \ No newline at end of file +from .createSettingBox_Mic import createSettingBox_Mic +from .createSettingBox_Speaker import createSettingBox_Speaker \ No newline at end of file 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 ffa96775..200acb8d 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 @@ -20,24 +20,6 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): createSettingBoxEntry = sbg.createSettingBoxEntry - - # def dropdownMenuFun(selected_value): - # print(selected_value) - # config.INPUT_SOURCE_LANG = selected_value - - # def switchFun(_, switch_box_widget): - # print(switch_box_widget.get()) - - # def checkboxFun(_, checkbox_box_widget): - # print(checkbox_box_widget.get()) - - # def sliderFun(value): - # print(value) - - # def entryFun(value): - # config_window.INPUT_MIC_PHRASE_TIMEOUT = int(value) - # print(config_window.INPUT_MIC_PHRASE_TIMEOUT) - 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) @@ -81,11 +63,11 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): def entry_input_mic_phrase_timeout_callback(value): print(int(value)) - config.INPUT_MIC_RECORD_TIMEOUT = int(value) + config.INPUT_MIC_PHRASE_TIMEOUT = int(value) def entry_input_mic_max_phrases_callback(value): - print(str(value)) - config.INPUT_MIC_MAX_PHRASES = str(value) + print(int(value)) + config.INPUT_MIC_MAX_PHRASES = int(value) def entry_input_mic_word_filters_callback(value): word_filter = str(value) @@ -119,7 +101,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): config_window.sb__mic_device = createSettingBoxDropdownMenu( parent_widget=setting_box_wrapper, label_text="Mic Device", - desc_text="Select the mic host. (Default: ?)", + desc_text="Select the mic devise. (Default: ?)", optionmenu_attr_name="sb__mic_device_optionmenu", dropdown_menu_attr_name="sb__mic_device_dropdown", # dropdown_menu_values=model.getListInputDevice(), @@ -232,123 +214,4 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): entry_textvariable=entry_textvariable, ) config_window.sb__mic_word_filter.grid(row=row) - row+=1 - - - - - # config_window.sb__switch_1 = createSettingBoxSwitch( - # parent_widget=setting_box_wrapper, - # label_text="Switch", - # desc_text="Turning this switch on will bring happiness.\nAs for turning it off... I leave that to your imagination", - # switch_attr_name="switch_attr_name_1", - # command=lambda: switchFun(config_window.switch_attr_name_1), - # is_checked=True, - # ) - # config_window.sb__switch_1.grid(row=row) - # row+=1 - - # config_window.sb__checkbox_1 = createSettingBoxCheckbox( - # parent_widget=setting_box_wrapper, - # label_text="Checkbox", - # desc_text="Checkbox ticked, a checkmark.", - # checkbox_attr_name="checkbox_attr_name_1", - # command=lambda: checkboxFun(config_window.checkbox_attr_name_1), - # is_checked=False, - # ) - # config_window.sb__checkbox_1.grid(row=row) - # row+=1 - - # config_window.sb__slider_1 = createSettingBoxSlider( - # parent_widget=setting_box_wrapper, - # label_text="Slider", - # desc_text="Adjust using the slider; the balance is up to you.", - # slider_attr_name="slider_attr_name_1", - # slider_range=(0, config_window.MAX_SPEAKER_ENERGY_THRESHOLD), - # slider_number_of_steps=config_window.MAX_SPEAKER_ENERGY_THRESHOLD, - # command=lambda value: sliderFun(value, config_window.slider_attr_name_1), - # variable=IntVar(value=config_window.INPUT_SPEAKER_ENERGY_THRESHOLD), - # ) - # config_window.sb__slider_1.grid(row=row) - # row+=1 - - - # config_window.sb__progressbar_x_slider_1 = createSettingBoxProgressbarXSlider( - # parent_widget=setting_box_wrapper, - # label_text="Progressbar and Slider for check the threshold", - # desc_text="just the slider to modify the threshold for activating voice input.\nPress the microphone button to start input, and you can adjust it while monitoring the actual volume.", - # command=set_input_threshold, # ? - # variable=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD), - # entry_attr_name="progressbar_x_slider__entry_attr_name_1", - - - # slider_attr_name="progressbar_x_slider__slider_attr_name_1", - # slider_range=(0, config_window.MAX_SPEAKER_ENERGY_THRESHOLD), - # slider_number_of_steps=config_window.MAX_SPEAKER_ENERGY_THRESHOLD, - - # progressbar_attr_name="progressbar_x_slider__progressbar_attr_name_1", - - # passive_button_attr_name="progressbar_x_slider__passive_button_attr_name_1", - # passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - # e, - # config_window.progressbar_x_slider__passive_button_attr_name_1, - # config_window.progressbar_x_slider__active_button_attr_name_1, - # is_turned_on=True, - # ), - # active_button_attr_name="progressbar_x_slider__active_button_attr_name_1", - # active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - # e, - # config_window.progressbar_x_slider__passive_button_attr_name_1, - # config_window.progressbar_x_slider__active_button_attr_name_1, - # is_turned_on=False, - # ), - # button_image_filename="mic_icon_white.png" - # ) - # config_window.sb__progressbar_x_slider_1.grid(row=row) - # row+=1 - - # config_window.sb__progressbar_x_slider_2 = createSettingBoxProgressbarXSlider( - # parent_widget=setting_box_wrapper, - # label_text="Progressbar and Slider for check the threshold2", - # desc_text="just the slider to modify the threshold for activating voice input.\nPress the microphone button to start input, and you can adjust it while monitoring the actual volume.", - # command=set_input_threshold, # ? - # variable=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD), - - # entry_attr_name="progressbar_x_slider__entry_attr_name_2", - - - # slider_attr_name="progressbar_x_slider__slider_attr_name_2", - # slider_range=(0, config_window.MAX_SPEAKER_ENERGY_THRESHOLD), - # slider_number_of_steps=config_window.MAX_SPEAKER_ENERGY_THRESHOLD, - # progressbar_attr_name="progressbar_x_slider__progressbar_attr_name_2", - - # passive_button_attr_name="progressbar_x_slider__passive_button_attr_name_2", - # passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - # e, - # config_window.progressbar_x_slider__passive_button_attr_name_2, - # config_window.progressbar_x_slider__active_button_attr_name_2, - # is_turned_on=True, - # ), - # active_button_attr_name="progressbar_x_slider__active_button_attr_name_2", - # active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - # e, - # config_window.progressbar_x_slider__passive_button_attr_name_2, - # config_window.progressbar_x_slider__active_button_attr_name_2, - # is_turned_on=False, - # ), - # button_image_filename="headphones_icon_white.png" - # ) - # config_window.sb__progressbar_x_slider_2.grid(row=row) - # row+=1 - - # config_window.sb__entry_1 = createSettingBoxEntry( - # parent_widget=setting_box_wrapper, - # label_text="Entry", - # desc_text="Please input a numerical value.", - # entry_attr_name="entry_attr_name_1", - # entry_width=settings.uism.SB__ENTRY_WIDTH_100, - # entry_bind__Any_KeyRelease=lambda value: entryFun(value, config_window.entry_attr_name_1), - # entry_textvariable=IntVar(value=config_window.INPUT_MIC_PHRASE_TIMEOUT), - # ) - # config_window.sb__entry_1.grid(row=row, pady=0) - # row+=1 \ No newline at end of file + row+=1 \ No newline at end of file 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 new file mode 100644 index 00000000..b7d6574a --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py @@ -0,0 +1,170 @@ +from time import sleep + +from customtkinter import StringVar, IntVar + + +from ..SettingBoxGenerator import SettingBoxGenerator + +from config import config + +def createSettingBox_Speaker(setting_box_wrapper, config_window, settings): + + + sbg = SettingBoxGenerator(config_window, settings) + + createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu + createSettingBoxSwitch = sbg.createSettingBoxSwitch + createSettingBoxCheckbox = sbg.createSettingBoxCheckbox + createSettingBoxSlider = sbg.createSettingBoxSlider + createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider + 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) + + if is_turned_on is True: + passive_button_widget = passive_button_wrapper_widget.children["!ctklabel"] + passive_button_wrapper_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) + passive_button_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) + passive_button_wrapper_widget.update_idletasks() + sleep(1) + + passive_button_wrapper_widget.grid_remove() + active_button_wrapper_widget.grid() + + elif is_turned_on is False: + # active_button_widget = active_button_wrapper_widget.children["!ctklabel"] + # active_button_wrapper_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) + # active_button_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) + # active_button_wrapper_widget.update_idletasks() + # sleep(3) + + active_button_wrapper_widget.grid_remove() + passive_button_wrapper_widget.grid() + + def optionmenu_input_speaker_device_callback(value): + config.CHOICE_SPEAKER_DEVICE = value + + def slider_input_speaker_energy_threshold_callback(value): + config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(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() + + + def entry_input_speaker_record_timeout_callback(value): + print(int(value)) + config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value) + + def entry_input_speaker_phrase_timeout_callback(value): + print(int(value)) + config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value) + + def entry_input_speaker_max_phrases_callback(value): + print(int(value)) + config.INPUT_SPEAKER_MAX_PHRASES = int(value) + + + + row=0 + config_window.sb__speaker_device = createSettingBoxDropdownMenu( + parent_widget=setting_box_wrapper, + label_text="Speaker Device", + desc_text="Select the speaker devise. (Default: ?)", + optionmenu_attr_name="sb__speaker_device_optionmenu", + dropdown_menu_attr_name="sb__speaker_device_dropdown", + # dropdown_menu_values=model.getListOutputDevice(), + dropdown_menu_values=["device1", "device2", "device3"], + command=lambda value: optionmenu_input_speaker_device_callback(value), + variable=StringVar(value=config.CHOICE_SPEAKER_DEVICE) + ) + config_window.sb__speaker_device.grid(row=row) + row+=1 + + + config_window.sb__speaker_energy_threshold = createSettingBoxProgressbarXSlider( + parent_widget=setting_box_wrapper, + label_text="Speaker Energy Threshold", + desc_text="Slider to modify the threshold for activating voice input.\nPress the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. 0 to 4000 (Default: 300)", + command=slider_input_speaker_energy_threshold_callback, + variable=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD), + entry_attr_name="sb__progressbar_x_slider__entry_speaker_energy_threshold", + + + slider_attr_name="progressbar_x_slider__slider_speaker_energy_threshold", + slider_range=(0, config.MAX_SPEAKER_ENERGY_THRESHOLD), + slider_number_of_steps=config.MAX_SPEAKER_ENERGY_THRESHOLD, + + progressbar_attr_name="sb__progressbar_x_slider__progressbar_speaker_energy_threshold", + + passive_button_attr_name="sb__progressbar_x_slider__passive_button_speaker_energy_threshold", + passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( + e, + config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold, + config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold, + is_turned_on=True, + ), + active_button_attr_name="sb__progressbar_x_slider__active_button_speaker_energy_threshold", + active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( + e, + config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold, + config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold, + is_turned_on=False, + ), + button_image_filename="headphones_icon_white.png" + ) + config_window.sb__speaker_energy_threshold.grid(row=row) + row+=1 + + # Speaker Dynamic Energy Thresholdも上に引っ付ける予定 + config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxCheckbox( + parent_widget=setting_box_wrapper, + label_text="Speaker Dynamic Energy Threshold", + desc_text="When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold.", + checkbox_attr_name="sb__checkbox_speaker_dynamic_energy_threshold", + command=lambda: checkbox_input_speaker_dynamic_energy_threshold_callback(config_window.sb__checkbox_speaker_dynamic_energy_threshold), + is_checked=False + ) + config_window.sb__speaker_dynamic_energy_threshold.grid(row=row) + row+=1 + + + # 以下3つも一つの項目にまとめるかもしれない + config_window.sb__speaker_record_timeout = createSettingBoxEntry( + parent_widget=setting_box_wrapper, + label_text="Speaker Record Timeout", + desc_text="(Default: 3)", + entry_attr_name="sb__entry_speaker_record_timeout", + entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_record_timeout_callback(value), + entry_textvariable=IntVar(value=config.INPUT_SPEAKER_RECORD_TIMEOUT), + ) + config_window.sb__speaker_record_timeout.grid(row=row) + row+=1 + + config_window.sb__speaker_phrase_timeout = createSettingBoxEntry( + parent_widget=setting_box_wrapper, + label_text="Speaker Phrase Timeout", + desc_text="It will stop recording and receive the recordings when the set second(s) is reached. (Default: 3)", + entry_attr_name="sb__entry_speaker_phrase_timeout", + entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_phrase_timeout_callback(value), + entry_textvariable=IntVar(value=config.INPUT_SPEAKER_PHRASE_TIMEOUT), + ) + config_window.sb__speaker_phrase_timeout.grid(row=row) + row+=1 + + config_window.sb__speaker_max_phrases = createSettingBoxEntry( + parent_widget=setting_box_wrapper, + label_text="Speaker Max Phrases", + desc_text="It will stop recording and receive the recordings when the set count of phrase(s) is reached. (Default: 10)", + entry_attr_name="sb__entry_speaker_max_phrases", + entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_max_phrases_callback(value), + entry_textvariable=IntVar(value=config.INPUT_SPEAKER_MAX_PHRASES), + ) + config_window.sb__speaker_max_phrases.grid(row=row) + row+=1 + # __________ \ No newline at end of file From 4b9a90e6d3848f1fd3775e3a564f9c6a2ecdb211 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:48:04 +0900 Subject: [PATCH 2/5] Chore: Change the name of variable optionmenu_attr_name and dropdown_menu_attr_name in Setting Boxes. --- .../createSettingBox_Appearance.py | 16 ++++++++-------- .../createSettingBox_Mic.py | 8 ++++---- .../createSettingBox_Speaker.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) 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 e209e8af..209d278b 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 @@ -59,8 +59,8 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="Theme", desc_text="Change the color theme from \"Light\" and \"Dark\". If you select \"System\", It will adjust based on your Windows theme. (Default: System)", - optionmenu_attr_name="sb__appearance_theme_optionmenu", - dropdown_menu_attr_name="sb__appearance_theme_dropdown", + optionmenu_attr_name="sb__optionmenu_appearance_theme", + dropdown_menu_attr_name="sb__dropdown_appearance_theme", dropdown_menu_values=["Light", "Dark", "System"], command=lambda value: optionmenu_appearance_theme_callback(value), variable=StringVar(value=config.APPEARANCE_THEME) @@ -73,8 +73,8 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="UI Size", desc_text="(Default: 100%)", - optionmenu_attr_name="sb__ui_scaling_optionmenu", - dropdown_menu_attr_name="sb__ui_scaling_dropdown", + optionmenu_attr_name="sb__optionmenu_ui_scaling", + dropdown_menu_attr_name="sb__dropdown_ui_scaling", dropdown_menu_values=["80%", "90%", "100%", "110%", "120%"], command=lambda value: optionmenu_ui_scaling_callback(value), variable=StringVar(value=config.UI_SCALING) @@ -88,8 +88,8 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="Font Family", desc_text="(Default: Yu Gothic UI)", - optionmenu_attr_name="sb__font_family_optionmenu", - dropdown_menu_attr_name="sb__font_family_dropdown", + optionmenu_attr_name="sb__optionmenu_font_family", + dropdown_menu_attr_name="sb__dropdown_font_family", dropdown_menu_values=["Font A", "Font B"], # dropdown_menu_values=font_families, command=lambda value: optionmenu_font_family_callback(value), @@ -104,8 +104,8 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="UI Language", desc_text="(Default: English)", - optionmenu_attr_name="sb__ui_language_optionmenu", - dropdown_menu_attr_name="sb__ui_language_dropdown", + optionmenu_attr_name="sb__optionmenu_ui_language", + dropdown_menu_attr_name="sb__dropdown_ui_language", dropdown_menu_values=selectable_languages_values, command=lambda value: optionmenu_ui_language_callback(value), variable=StringVar(value=selectable_languages[config.UI_LANGUAGE]), 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 200acb8d..a30c4b85 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 @@ -88,8 +88,8 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="Mic Host", desc_text="Select the mic host. (Default: ?)", - optionmenu_attr_name="sb__mic_host_optionmenu", - dropdown_menu_attr_name="sb__mic_host_dropdown", + optionmenu_attr_name="sb__optionmenu_mic_host", + dropdown_menu_attr_name="sb__dropdown_mic_host", # dropdown_menu_values=model.getListInputHost(), dropdown_menu_values=["host1", "host2", "host3"], command=lambda value: optionmenu_mic_host_callback(value), @@ -102,8 +102,8 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="Mic Device", desc_text="Select the mic devise. (Default: ?)", - optionmenu_attr_name="sb__mic_device_optionmenu", - dropdown_menu_attr_name="sb__mic_device_dropdown", + optionmenu_attr_name="sb__optionmenu_mic_device", + dropdown_menu_attr_name="sb__dropdown_mic_device", # dropdown_menu_values=model.getListInputDevice(), dropdown_menu_values=["device1", "device2", "device3"], command=lambda value: optionmenu_input_mic_device_callback(value), 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 b7d6574a..64ee5fb4 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 @@ -73,8 +73,8 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings): parent_widget=setting_box_wrapper, label_text="Speaker Device", desc_text="Select the speaker devise. (Default: ?)", - optionmenu_attr_name="sb__speaker_device_optionmenu", - dropdown_menu_attr_name="sb__speaker_device_dropdown", + optionmenu_attr_name="sb__optionmenu_speaker_device", + dropdown_menu_attr_name="sb__dropdown_speaker_device", # dropdown_menu_values=model.getListOutputDevice(), dropdown_menu_values=["device1", "device2", "device3"], command=lambda value: optionmenu_input_speaker_device_callback(value), From 246409fe2c5f0f1f383e8bfef13a1681398c7493 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:54:51 +0900 Subject: [PATCH 3/5] Setting box: add Others tab. add items Auto Clear The Message Box, Notification XSOverlay and Message Format. --- .../createSideMenuAndSettingsBoxContainers.py | 8 +-- .../setting_box_containers/__init__.py | 3 +- .../setting_box_others/__init__.py | 1 + .../createSettingBox_Others.py | 72 +++++++++++++++++++ vrct_gui/ui_managers/UiScalingManager.py | 2 +- 5 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index 60f4cc1e..fe965a39 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -6,7 +6,7 @@ from .addConfigSideMenuItem import addConfigSideMenuItem from .createSettingBoxContainer import createSettingBoxContainer -from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker +from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others def createSideMenuAndSettingsBoxContainers(config_window, settings): @@ -80,7 +80,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings): { "section_title": "Speaker", "setting_box": createSettingBox_Speaker }, ] }, - "activate_by_default": True, }, { "side_menu_tab_attr_name": "side_menu_tab_parameters", @@ -97,14 +96,15 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings): { "side_menu_tab_attr_name": "side_menu_tab_others", "label_attr_name": "label_others", - "selected_mark_attr_name": "selected_mark_foreground", + "selected_mark_attr_name": "selected_mark_others", "text": "Others", "setting_box_container_settings": { "setting_box_container_attr_name": "setting_box_container_others", "setting_boxes": [ - { "section_title": None, "setting_box": None }, + { "section_title": None, "setting_box": createSettingBox_Others }, ] }, + "activate_by_default": True, }, ] diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py index a5fa59f6..ba34d66c 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py @@ -1,2 +1,3 @@ from .setting_box_appearance import createSettingBox_Appearance -from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker \ No newline at end of file +from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker +from .setting_box_others import createSettingBox_Others \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py new file mode 100644 index 00000000..c115d627 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py @@ -0,0 +1 @@ +from .createSettingBox_Others import createSettingBox_Others \ No newline at end of file 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 new file mode 100644 index 00000000..a813d3f4 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -0,0 +1,72 @@ +from time import sleep + +from customtkinter import StringVar, IntVar + + +from ..SettingBoxGenerator import SettingBoxGenerator + +from config import config + +def createSettingBox_Others(setting_box_wrapper, config_window, settings): + + + sbg = SettingBoxGenerator(config_window, settings) + + createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu + createSettingBoxSwitch = sbg.createSettingBoxSwitch + createSettingBoxCheckbox = sbg.createSettingBoxCheckbox + createSettingBoxSlider = sbg.createSettingBoxSlider + createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider + createSettingBoxEntry = sbg.createSettingBoxEntry + + + # 関数名 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() + + def checkbox_notice_xsoverlay_callback(checkbox_box_widget): + print(checkbox_box_widget.get()) + config.ENABLE_NOTICE_XSOVERLAY = checkbox_box_widget.get() + + def entry_message_format_callback(value): + if len(value) > 0: + config.MESSAGE_FORMAT = value + + + row=0 + config_window.sb__auto_clear_chatbox = 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), + is_checked=False + ) + config_window.sb__auto_clear_chatbox.grid(row=row) + row+=1 + + + config_window.sb__notice_xsoverlay = createSettingBoxCheckbox( + parent_widget=setting_box_wrapper, + label_text="Notification XSOverlay (VR Only)", + desc_text="Notify received messages by using XSOverlay's notification feature.", + checkbox_attr_name="sb__checkbox_notice_xsoverlay", + command=lambda: checkbox_notice_xsoverlay_callback(config_window.sb__checkbox_notice_xsoverlay), + is_checked=False + ) + config_window.sb__notice_xsoverlay.grid(row=row) + row+=1 + + + config_window.sb__message_format = createSettingBoxEntry( + parent_widget=setting_box_wrapper, + label_text="Message Format", + desc_text="You can change the decoration of the message you want to send. (Default: \"[message]([translation])\" )", + entry_attr_name="sb__entry_message_format", + entry_width=settings.uism.SB__ENTRY_WIDTH_250, + entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value), + entry_textvariable=StringVar(value=config.MESSAGE_FORMAT), + ) + config_window.sb__message_format.grid(row=row) + row+=1 \ No newline at end of file diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 8d013108..2cbb2142 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -157,7 +157,7 @@ class UiScalingManager(): self.config_window.SB__ENTRY_HEIGHT = self._calculateUiSize(30) # SB__ENTRY_WIDTH_10 ... SB__ENTRY_WIDTH_200 - for i in range(10, 201, 10): + for i in range(10, 301, 10): setattr(self.config_window, f'SB__ENTRY_WIDTH_{i}', self._calculateUiSize(i)) From 47b80da50212ca9453b0ca64903e422f5ed674ba Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:01:48 +0900 Subject: [PATCH 4/5] Chore: Remove the code that is no longer in use and __tmp.py from the setting_box_containers directory because it's no longer needed. --- .../setting_box_containers/__tmp.py | 225 ------------------ .../createSettingBox_Others.py | 4 - .../createSettingBox_Mic.py | 2 - .../createSettingBox_Speaker.py | 2 - 4 files changed, 233 deletions(-) delete mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__tmp.py diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__tmp.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__tmp.py deleted file mode 100644 index 5f0c3abc..00000000 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__tmp.py +++ /dev/null @@ -1,225 +0,0 @@ -from time import sleep - -from customtkinter import StringVar, IntVar - - -from .SettingBoxGenerator import SettingBoxGenerator - -from config import config - -def __tmp(setting_box_wrapper, config_window, settings): - - - sbg = SettingBoxGenerator(config_window, settings) - - createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu - createSettingBoxSwitch = sbg.createSettingBoxSwitch - createSettingBoxCheckbox = sbg.createSettingBoxCheckbox - createSettingBoxSlider = sbg.createSettingBoxSlider - createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider - 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) - - if is_turned_on is True: - passive_button_widget = passive_button_wrapper_widget.children["!ctklabel"] - passive_button_wrapper_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) - passive_button_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) - passive_button_wrapper_widget.update_idletasks() - sleep(1) - - passive_button_wrapper_widget.grid_remove() - active_button_wrapper_widget.grid() - - elif is_turned_on is False: - # active_button_widget = active_button_wrapper_widget.children["!ctklabel"] - # active_button_wrapper_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) - # active_button_widget.configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR) - # active_button_wrapper_widget.update_idletasks() - # sleep(3) - - active_button_wrapper_widget.grid_remove() - passive_button_wrapper_widget.grid() - - # def slider_input_speaker_energy_threshold_callback(self, value): - # config_window.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value) - - def set_input_threshold(value): - print(value) - config.INPUT_SPEAKER_ENERGY_THRESHOLD = value - print(config.INPUT_SPEAKER_ENERGY_THRESHOLD) - - - - - - - - - - def dropdownMenuFun(selected_value, optionmenu_widget, dropdown_menu_widget): - print(selected_value) - config.INPUT_SOURCE_LANG = selected_value - - def switchFun(_, switch_box_widget): - print(switch_box_widget.get()) - - def checkboxFun(_, checkbox_box_widget): - print(checkbox_box_widget.get()) - - def sliderFun(_, value, slider_widget): - print(value) - - def entryFun(e, entry_widget): - print(e.widget.get()) - config_window.INPUT_MIC_PHRASE_TIMEOUT = int(e.widget.get()) - print(config_window.INPUT_MIC_PHRASE_TIMEOUT) - - - - row=0 - config_window.sb__dropdown_menu_1 = createSettingBoxDropdownMenu( - parent_widget=setting_box_wrapper, - label_text="Option Menu", - desc_text="Select your preferences from the options menu.\nYou can choose your preferred language.", - optionmenu_attr_name="optionmenu_attr_name_1", - dropdown_menu_attr_name="dropdown_menu_attr_name_1", - dropdown_menu_values=["tt", "Japanese", "English"], - command=lambda value: dropdownMenuFun(value, config_window.optionmenu_attr_name_1, config_window.dropdown_menu_attr_name_1), - variable=StringVar(value=config.INPUT_SOURCE_LANG) - ) - config_window.sb__dropdown_menu_1.grid(row=row) - row+=1 - - - config_window.sb__dropdown_menu_2 = createSettingBoxDropdownMenu( - parent_widget=setting_box_wrapper, - label_text="Option Menu", - desc_text="Select your preferences from the options menu.\nYou can choose your preferred language.", - optionmenu_attr_name="optionmenu_attr_name_2", - dropdown_menu_attr_name="dropdown_menu_attr_name_1", - dropdown_menu_values=["tt", "Japanese", "English"], - command=lambda value: dropdownMenuFun(value, config_window.optionmenu_attr_name_2, config_window.dropdown_menu_attr_name_1), - variable=StringVar(value=config.INPUT_SOURCE_LANG) - ) - config_window.sb__dropdown_menu_2.grid(row=row) - row+=1 - - config_window.sb__switch_1 = createSettingBoxSwitch( - parent_widget=setting_box_wrapper, - label_text="Switch", - desc_text="Turning this switch on will bring happiness.\nAs for turning it off... I leave that to your imagination", - switch_attr_name="switch_attr_name_1", - command=lambda: switchFun(config_window.switch_attr_name_1), - is_checked=True, - ) - config_window.sb__switch_1.grid(row=row) - row+=1 - - config_window.sb__checkbox_1 = createSettingBoxCheckbox( - parent_widget=setting_box_wrapper, - label_text="Checkbox", - desc_text="Checkbox ticked, a checkmark.", - checkbox_attr_name="checkbox_attr_name_1", - command=lambda: checkboxFun(config_window.checkbox_attr_name_1), - is_checked=False, - ) - config_window.sb__checkbox_1.grid(row=row) - row+=1 - - config_window.sb__slider_1 = createSettingBoxSlider( - parent_widget=setting_box_wrapper, - label_text="Slider", - desc_text="Adjust using the slider; the balance is up to you.", - slider_attr_name="slider_attr_name_1", - slider_range=(0, config_window.MAX_SPEAKER_ENERGY_THRESHOLD), - slider_number_of_steps=config_window.MAX_SPEAKER_ENERGY_THRESHOLD, - command=lambda value: sliderFun(value, config_window.slider_attr_name_1), - variable=IntVar(value=config_window.INPUT_SPEAKER_ENERGY_THRESHOLD), - ) - config_window.sb__slider_1.grid(row=row) - row+=1 - - - config_window.sb__progressbar_x_slider_1 = createSettingBoxProgressbarXSlider( - parent_widget=setting_box_wrapper, - label_text="Progressbar and Slider for check the threshold", - desc_text="just the slider to modify the threshold for activating voice input.\nPress the microphone button to start input, and you can adjust it while monitoring the actual volume.", - command=set_input_threshold, # ? - variable=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD), - entry_attr_name="progressbar_x_slider__entry_attr_name_1", - - - slider_attr_name="progressbar_x_slider__slider_attr_name_1", - slider_range=(0, config_window.MAX_SPEAKER_ENERGY_THRESHOLD), - slider_number_of_steps=config_window.MAX_SPEAKER_ENERGY_THRESHOLD, - - progressbar_attr_name="progressbar_x_slider__progressbar_attr_name_1", - - passive_button_attr_name="progressbar_x_slider__passive_button_attr_name_1", - passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - e, - config_window.progressbar_x_slider__passive_button_attr_name_1, - config_window.progressbar_x_slider__active_button_attr_name_1, - is_turned_on=True, - ), - active_button_attr_name="progressbar_x_slider__active_button_attr_name_1", - active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - e, - config_window.progressbar_x_slider__passive_button_attr_name_1, - config_window.progressbar_x_slider__active_button_attr_name_1, - is_turned_on=False, - ), - button_image_filename="mic_icon_white.png" - ) - config_window.sb__progressbar_x_slider_1.grid(row=row) - row+=1 - - config_window.sb__progressbar_x_slider_2 = createSettingBoxProgressbarXSlider( - parent_widget=setting_box_wrapper, - label_text="Progressbar and Slider for check the threshold2", - desc_text="just the slider to modify the threshold for activating voice input.\nPress the microphone button to start input, and you can adjust it while monitoring the actual volume.", - command=set_input_threshold, # ? - variable=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD), - - entry_attr_name="progressbar_x_slider__entry_attr_name_2", - - - slider_attr_name="progressbar_x_slider__slider_attr_name_2", - slider_range=(0, config_window.MAX_SPEAKER_ENERGY_THRESHOLD), - slider_number_of_steps=config_window.MAX_SPEAKER_ENERGY_THRESHOLD, - progressbar_attr_name="progressbar_x_slider__progressbar_attr_name_2", - - passive_button_attr_name="progressbar_x_slider__passive_button_attr_name_2", - passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - e, - config_window.progressbar_x_slider__passive_button_attr_name_2, - config_window.progressbar_x_slider__active_button_attr_name_2, - is_turned_on=True, - ), - active_button_attr_name="progressbar_x_slider__active_button_attr_name_2", - active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback( - e, - config_window.progressbar_x_slider__passive_button_attr_name_2, - config_window.progressbar_x_slider__active_button_attr_name_2, - is_turned_on=False, - ), - button_image_filename="headphones_icon_white.png" - ) - config_window.sb__progressbar_x_slider_2.grid(row=row) - row+=1 - - config_window.sb__entry_1 = createSettingBoxEntry( - parent_widget=setting_box_wrapper, - label_text="Entry", - desc_text="Please input a numerical value.", - entry_attr_name="entry_attr_name_1", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, - entry_bind__Any_KeyRelease=lambda value: entryFun(value, config_window.entry_attr_name_1), - entry_textvariable=IntVar(value=config_window.INPUT_MIC_PHRASE_TIMEOUT), - ) - config_window.sb__entry_1.grid(row=row, pady=0) - row+=1 \ No newline at end of file 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 a813d3f4..efa6ea9b 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 @@ -12,11 +12,7 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings): sbg = SettingBoxGenerator(config_window, settings) - createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu - createSettingBoxSwitch = sbg.createSettingBoxSwitch createSettingBoxCheckbox = sbg.createSettingBoxCheckbox - createSettingBoxSlider = sbg.createSettingBoxSlider - createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider createSettingBoxEntry = sbg.createSettingBoxEntry 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 a30c4b85..8e523568 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 @@ -13,9 +13,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings): sbg = SettingBoxGenerator(config_window, settings) createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu - createSettingBoxSwitch = sbg.createSettingBoxSwitch createSettingBoxCheckbox = sbg.createSettingBoxCheckbox - createSettingBoxSlider = sbg.createSettingBoxSlider createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider createSettingBoxEntry = sbg.createSettingBoxEntry 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 64ee5fb4..64f7dc9f 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 @@ -13,9 +13,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings): sbg = SettingBoxGenerator(config_window, settings) createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu - createSettingBoxSwitch = sbg.createSettingBoxSwitch createSettingBoxCheckbox = sbg.createSettingBoxCheckbox - createSettingBoxSlider = sbg.createSettingBoxSlider createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider createSettingBoxEntry = sbg.createSettingBoxEntry From fcb66fa0c8d38390c33ab735419d57a8eaede801 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:53:09 +0900 Subject: [PATCH 5/5] Setting box: add Advanced Settings tab (formerly Parameters). add items OSC IP Address and OSC Port. --- .../createSideMenuAndSettingsBoxContainers.py | 26 +++++----- .../setting_box_containers/__init__.py | 3 +- .../setting_box_advanced_settings/__init__.py | 1 + .../createSettingBox_AdvancedSettings.py | 48 +++++++++++++++++++ 4 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/__init__.py create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index fe965a39..dec611be 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -6,7 +6,7 @@ from .addConfigSideMenuItem import addConfigSideMenuItem from .createSettingBoxContainer import createSettingBoxContainer -from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others +from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others, createSettingBox_AdvancedSettings def createSideMenuAndSettingsBoxContainers(config_window, settings): @@ -81,18 +81,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings): ] }, }, - { - "side_menu_tab_attr_name": "side_menu_tab_parameters", - "label_attr_name": "label_parameters", - "selected_mark_attr_name": "selected_mark_foreground", - "text": "Parameters", - "setting_box_container_settings": { - "setting_box_container_attr_name": "setting_box_container_parameters", - "setting_boxes": [ - { "section_title": None, "setting_box": None }, - ] - }, - }, { "side_menu_tab_attr_name": "side_menu_tab_others", "label_attr_name": "label_others", @@ -104,6 +92,18 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings): { "section_title": None, "setting_box": createSettingBox_Others }, ] }, + }, + { + "side_menu_tab_attr_name": "side_menu_tab_advanced", + "label_attr_name": "label_advanced", + "selected_mark_attr_name": "selected_mark_advanced", + "text": "Advanced Settings", + "setting_box_container_settings": { + "setting_box_container_attr_name": "setting_box_container_advanced", + "setting_boxes": [ + { "section_title": None, "setting_box": createSettingBox_AdvancedSettings }, + ] + }, "activate_by_default": True, }, ] diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py index ba34d66c..9f316e34 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/__init__.py @@ -1,3 +1,4 @@ from .setting_box_appearance import createSettingBox_Appearance from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker -from .setting_box_others import createSettingBox_Others \ No newline at end of file +from .setting_box_others import createSettingBox_Others +from .setting_box_advanced_settings import createSettingBox_AdvancedSettings \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/__init__.py new file mode 100644 index 00000000..0ceb6231 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/__init__.py @@ -0,0 +1 @@ +from .createSettingBox_AdvancedSettings import createSettingBox_AdvancedSettings \ No newline at end of file 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 new file mode 100644 index 00000000..e82087a6 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py @@ -0,0 +1,48 @@ +from time import sleep + +from customtkinter import StringVar, IntVar + + +from ..SettingBoxGenerator import SettingBoxGenerator + +from config import config + +def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settings): + + + sbg = SettingBoxGenerator(config_window, settings) + + createSettingBoxEntry = sbg.createSettingBoxEntry + + + def entry_ip_address_callback(value): + config.OSC_IP_ADDRESS = str(value) + + def entry_port_callback(value): + config.OSC_PORT = int(value) + + row=0 + config_window.sb__ip_address = createSettingBoxEntry( + parent_widget=setting_box_wrapper, + label_text="OSC IP Address", + desc_text="(Default: 127.0.0.1)", + entry_attr_name="sb__entry_ip_address", + entry_width=settings.uism.SB__ENTRY_WIDTH_150, + entry_bind__Any_KeyRelease=lambda value: entry_ip_address_callback(value), + entry_textvariable=StringVar(value=config.OSC_IP_ADDRESS), + ) + config_window.sb__ip_address.grid(row=row) + row+=1 + + + config_window.sb__port = createSettingBoxEntry( + parent_widget=setting_box_wrapper, + label_text="OSC Port", + desc_text="(Default: 9000)", + entry_attr_name="sb__entry_port", + entry_width=settings.uism.SB__ENTRY_WIDTH_150, + entry_bind__Any_KeyRelease=lambda value: entry_port_callback(value), + entry_textvariable=IntVar(value=config.OSC_PORT), + ) + config_window.sb__port.grid(row=row) + row+=1 \ No newline at end of file