From a7644fce234e57160ca7bfee6d371c969d90bc8d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 09:40:01 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[Update]=20Config=20Window:=20=E3=83=87?= =?UTF-8?q?=E3=83=90=E3=82=A4=E3=82=B9=E3=81=8C=E6=A4=9C=E5=87=BA=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AEdisabled=E8=A1=A8=E7=A4=BA=E4=B8=80=E9=83=A8=E5=AE=9F?= =?UTF-8?q?=E8=A3=85(Mic=20Host,=20Mic=20Device,=20Speaker=20Device?= =?UTF-8?q?=E3=81=AE=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=A1?= =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=AE=E3=81=BF)=20=E3=81=9D?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=9D=E3=81=AE=E9=96=A2=E6=95=B0=E3=81=AE?= =?UTF-8?q?=E6=B1=8E=E7=94=A8=E5=8C=96=E3=80=82=20[Chore]=20Appearance=20T?= =?UTF-8?q?heme=E3=82=92=E9=96=8B=E7=99=BA=E4=B8=AD=E3=81=A8=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=83=A9=E3=83=99=E3=83=AB=E7=B7=A8=E9=9B=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 2 +- locales/ja.yml | 2 +- view.py | 20 ++++++++++ vrct_gui/_changeConfigWindowWidgetsStatus.py | 26 +++++++++++++ vrct_gui/config_window/ConfigWindow.py | 2 + .../_SettingBoxGenerator.py | 38 +++++++++++++------ .../createSettingBox_Mic.py | 1 + .../createSettingBox_Speaker.py | 1 + .../createSidebarLanguagesSettings.py | 2 +- vrct_gui/ui_managers/ColorThemeManager.py | 2 + vrct_gui/ui_utils/ui_utils.py | 13 ++++++- 11 files changed, 94 insertions(+), 15 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index 9778a3ae..ae3896d6 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -40,7 +40,7 @@ config_window: label: Transparency desc: Change the main window's transparency. appearance_theme: - label: Theme + label: Theme [Under development] desc: Change the color theme. If you selected "System", it will adjust based on your Windows theme. ui_size: label: UI Size diff --git a/locales/ja.yml b/locales/ja.yml index 6fafbeae..1a773f01 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -41,7 +41,7 @@ config_window: label: 透明度 desc: メイン画面の透明度を変更できます。 appearance_theme: - label: 外観テーマ + label: 外観テーマ [開発中] desc: カラーテーマを変更できます。「System」を選択した場合、Windowsのテーマに基づいて自動的に「Dark」か「Light」テーマを判断し、適用します。 ui_size: label: UIのサイズ diff --git a/view.py b/view.py index 73fe3910..dec8bf38 100644 --- a/view.py +++ b/view.py @@ -447,6 +447,26 @@ class View(): self.enableConfigWindowCompactMode() vrct_gui.config_window.setting_box_compact_mode_switch_box.select() + + + if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice": + vrct_gui._changeConfigWindowWidgetsStatus( + status="disabled", + target_names=[ + "sb__optionmenu_mic_host", + "sb__optionmenu_mic_device", + ] + ) + + if config.CHOICE_SPEAKER_DEVICE == "NoDevice": + vrct_gui._changeConfigWindowWidgetsStatus( + status="disabled", + target_names=[ + "sb__optionmenu_speaker_device", + ] + ) + + # Insert sample conversation for testing. # self._insertSampleConversationToTextbox() diff --git a/vrct_gui/_changeConfigWindowWidgetsStatus.py b/vrct_gui/_changeConfigWindowWidgetsStatus.py index da2da440..0183c886 100644 --- a/vrct_gui/_changeConfigWindowWidgetsStatus.py +++ b/vrct_gui/_changeConfigWindowWidgetsStatus.py @@ -5,6 +5,16 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta target_names = ["mic_energy_threshold_check_button", "speaker_energy_threshold_check_button"] + def disableOptionmenuWidget(target_widget): + target_widget.label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) + if target_widget.desc_widget is not None: + target_widget.desc_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) + target_widget.optionmenu_label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) + target_widget.optionmenu_img_widget.configure(image=CTkImage(settings.image_file.ARROW_LEFT_DISABLED.rotate(90), size=settings.uism.SB__OPTIONMENU_IMG_SIZE)) + target_widget.optionmenu_box.unbindFunction() + target_widget.optionmenu_box.configure(cursor="") + + for target_name in target_names: match target_name: case "mic_energy_threshold_check_button": @@ -26,6 +36,22 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.children["!ctklabel"].configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR) + case "sb__optionmenu_mic_host": + if status == "disabled": + target_widget = config_window.sb__widgets["sb__optionmenu_mic_host"] + disableOptionmenuWidget(target_widget) + + case "sb__optionmenu_mic_device": + if status == "disabled": + target_widget = config_window.sb__widgets["sb__optionmenu_mic_device"] + disableOptionmenuWidget(target_widget) + + case "sb__optionmenu_speaker_device": + if status == "disabled": + target_widget = config_window.sb__widgets["sb__optionmenu_speaker_device"] + disableOptionmenuWidget(target_widget) + + case _: raise ValueError(f"No matching case for target_name: {target_name}") diff --git a/vrct_gui/config_window/ConfigWindow.py b/vrct_gui/config_window/ConfigWindow.py index 918b9250..463fb78a 100644 --- a/vrct_gui/config_window/ConfigWindow.py +++ b/vrct_gui/config_window/ConfigWindow.py @@ -26,6 +26,8 @@ class ConfigWindow(CTkToplevel): # When the configuration window's compact mode is turned on, it will call `grid_remove()` on each widget appended to this array. In the opposite case, `grid()` will be called. self.additional_widgets = [] + self.sb__widgets = {} + createConfigWindowTitle(config_window=self, settings=self.settings, view_variable=self._view_variable) createSettingBoxTopBar(config_window=self, settings=self.settings, view_variable=self._view_variable) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index 6b509aec..6a92002a 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -1,4 +1,5 @@ from functools import partial +from types import SimpleNamespace from typing import Union from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkRadioButton, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar @@ -17,7 +18,9 @@ class _SettingBoxGenerator(): self.dropdown_menu_window = vrct_gui.vrct_gui.dropdown_menu_window - def _createSettingBoxFrame(self, for_var_label_text, for_var_desc_text): + def _createSettingBoxFrame(self, sb__attr_name, for_var_label_text, for_var_desc_text): + self.config_window.sb__widgets[sb__attr_name] = SimpleNamespace() + setting_box_frame = CTkFrame(self.parent_widget, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) # "pady=(0,1)" is for bottom padding. It can be removed(override) when you do like "self.attr_name.grid(row=row, pady=0)" @@ -36,7 +39,7 @@ class _SettingBoxGenerator(): setting_box_frame_wrapper_fix_border2 = CTkFrame(setting_box_frame, corner_radius=0, width=0, height=0) setting_box_frame_wrapper_fix_border2.grid(row=0, column=1, sticky="ns") - self._setSettingBoxLabels(setting_box_frame_wrapper, for_var_label_text, for_var_desc_text) + self._setSettingBoxLabels(sb__attr_name, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text) setting_box_item_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.settings.ctm.SB__BG_COLOR) setting_box_item_frame.grid(row=0, column=2, padx=0, sticky="nsew") @@ -45,7 +48,7 @@ class _SettingBoxGenerator(): return (setting_box_frame, setting_box_item_frame) - def _setSettingBoxLabels(self, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text=None): + def _setSettingBoxLabels(self, sb__attr_name, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text=None): setting_box_labels_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) setting_box_labels_frame.grid(row=0, column=0, padx=0, pady=0, sticky="nsew") @@ -59,6 +62,8 @@ class _SettingBoxGenerator(): text_color=self.settings.ctm.LABELS_TEXT_COLOR ) setting_box_label.grid(row=0, column=0, padx=0, pady=0, sticky="ew") + self.config_window.sb__widgets[sb__attr_name].label_widget = setting_box_label + if for_var_desc_text is not None: setting_box_desc = CTkLabel( @@ -73,17 +78,22 @@ class _SettingBoxGenerator(): ) setting_box_desc.grid(row=1, column=0, padx=0, pady=(self.settings.uism.SB__DESC_TOP_PADY,0), sticky="ew") self.config_window.additional_widgets.append(setting_box_desc) + self.config_window.sb__widgets[sb__attr_name].desc_widget=setting_box_desc + else: + self.config_window.sb__widgets[sb__attr_name].desc_widget=None + + def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, dropdown_menu_width=None, variable=None, dropdown_menu_values=None): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(optionmenu_attr_name, for_var_label_text, for_var_desc_text) def adjustedCommand(value): variable.set(value) command(value) - option_menu_widget = createOptionMenuBox( + (option_menu_widget, optionmenu_label_widget, optionmenu_img_widget) = createOptionMenuBox( parent_widget=setting_box_item_frame, optionmenu_bg_color=self.settings.ctm.SB__OPTIONMENU_BG_COLOR, optionmenu_hovered_bg_color=self.settings.ctm.SB__OPTIONMENU_HOVERED_BG_COLOR, @@ -104,6 +114,12 @@ class _SettingBoxGenerator(): ), ) + + self.config_window.sb__widgets[optionmenu_attr_name].optionmenu_box = option_menu_widget + self.config_window.sb__widgets[optionmenu_attr_name].optionmenu_label_widget = optionmenu_label_widget + self.config_window.sb__widgets[optionmenu_attr_name].optionmenu_img_widget = optionmenu_img_widget + + option_menu_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e") setattr(self.config_window, optionmenu_attr_name, option_menu_widget) @@ -122,7 +138,7 @@ class _SettingBoxGenerator(): def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, is_checked, command): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text) switch_widget = CTkSwitch( setting_box_item_frame, @@ -151,7 +167,7 @@ class _SettingBoxGenerator(): def createSettingBoxCheckbox(self, for_var_label_text, for_var_desc_text, checkbox_attr_name, variable, command): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(checkbox_attr_name, for_var_label_text, for_var_desc_text) checkbox_widget = CTkCheckBox( setting_box_item_frame, @@ -185,7 +201,7 @@ class _SettingBoxGenerator(): def createSettingBoxSlider(self, for_var_label_text, for_var_desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(slider_attr_name, for_var_label_text, for_var_desc_text) # print(self.settings.uism.SB__SLIDER_WIDTH) # print(self.settings.uism.SB__SLIDER_HEIGHT) @@ -212,7 +228,7 @@ class _SettingBoxGenerator(): def createSettingBoxProgressbarXSlider( self, - for_var_label_text, for_var_desc_text, command, + for_var_label_text, for_var_desc_text, command, progressbar_x_slider_attr_name, entry_attr_name, entry_bind__FocusOut, slider_attr_name, slider_range, progressbar_attr_name, @@ -227,7 +243,7 @@ class _SettingBoxGenerator(): ): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name, for_var_label_text, for_var_desc_text) ENTRY_WIDTH = self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH BAR_WIDTH = self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_WIDTH @@ -320,7 +336,7 @@ class _SettingBoxGenerator(): def createSettingBoxEntry(self, for_var_label_text, for_var_desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable, entry_bind__FocusOut=None): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(entry_attr_name, for_var_label_text, for_var_desc_text) def adjusted_command__for_entry_bind__Any_KeyRelease(e): entry_bind__Any_KeyRelease(e.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 026c6539..6672cee7 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 @@ -70,6 +70,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_label_text=view_variable.VAR_LABEL_MIC_ENERGY_THRESHOLD, for_var_desc_text=view_variable.VAR_DESC_MIC_ENERGY_THRESHOLD, command=slider_input_mic_energy_threshold_callback, + progressbar_x_slider_attr_name="sb__mic_energy_threshold", entry_attr_name="sb__progressbar_x_slider__entry_mic_energy_threshold", entry_variable=view_variable.VAR_MIC_ENERGY_THRESHOLD__ENTRY, 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 1e97eaee..01805127 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 @@ -53,6 +53,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ for_var_label_text=view_variable.VAR_LABEL_SPEAKER_ENERGY_THRESHOLD, for_var_desc_text=view_variable.VAR_DESC_SPEAKER_ENERGY_THRESHOLD, command=slider_input_speaker_energy_threshold_callback, + progressbar_x_slider_attr_name="sb__speaker_energy_threshold", entry_variable=view_variable.VAR_SPEAKER_ENERGY_THRESHOLD__ENTRY, entry_attr_name="sb__progressbar_x_slider__entry_speaker_energy_threshold", diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py index 132cd86b..0363934e 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py @@ -80,7 +80,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable): sls__box_optionmenu_wrapper.grid(row=1, column=0, sticky="ew") sls__box_optionmenu_wrapper.grid_columnconfigure(0, weight=1) - sls__selected_language_box = createOptionMenuBox( + (sls__selected_language_box, optionmenu_label_widget, optionmenu_img_widget) = createOptionMenuBox( parent_widget=sls__box_optionmenu_wrapper, optionmenu_bg_color=settings.ctm.SLS__OPTIONMENU_BG_COLOR, optionmenu_hovered_bg_color=settings.ctm.SLS__OPTIONMENU_HOVERED_BG_COLOR, diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index e297b6a7..541da271 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -220,6 +220,8 @@ class ColorThemeManager(): self.config_window.LABELS_TEXT_COLOR = self.config_window.BASIC_TEXT_COLOR self.config_window.LABELS_DESC_TEXT_COLOR = self.DARK_500_COLOR + self.config_window.LABELS_TEXT_DISABLED_COLOR = self.DARK_600_COLOR + # Top bar self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index 5dff06b9..ea957867 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -78,6 +78,11 @@ def bindButtonFunctionAndColor(target_widgets, enter_color, leave_color, clicked bindButtonPressColor(target_widgets, clicked_color, enter_color) bindButtonReleaseFunction(target_widgets, buttonReleasedFunction) +def unbindEnterLEaveButtonPressButtonReleaseFunction(target_widgets): + for target_widget in target_widgets: + for event_name in ["", "", "", ""]: + target_widget.unbind(event_name) + def unbindEventFromActiveTabWidget(active_tab_widget): for event_name in ["", "", "", ""]: active_tab_widget.unbind(event_name) @@ -192,7 +197,13 @@ def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_b bindButtonReleaseFunction([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget], optionmenu_clicked_command) - return option_menu_box + def unbindEventFromWidgets(): + unbindEnterLEaveButtonPressButtonReleaseFunction([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget]) + + option_menu_box.unbindFunction = unbindEventFromWidgets + + + return (option_menu_box, optionmenu_label_widget, optionmenu_img_widget) def applyUiScalingAndFixTheBugScrollBar(scrollbar_widget, padx, width): From fd433754fce6bcdd85d9290cad23349659225d50 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 10:19:03 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[Update]=20Config=20Window:=20=E3=83=87?= =?UTF-8?q?=E3=83=90=E3=82=A4=E3=82=B9=E3=81=8C=E3=81=AA=E3=81=8B=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E5=A0=B4=E5=90=88=E3=80=81=E3=82=AA=E3=83=97=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=AB?= =?UTF-8?q?=E3=81=AFNo=20Mic=20Device=20Detected=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/view.py b/view.py index dec8bf38..b2c4896e 100644 --- a/view.py +++ b/view.py @@ -449,6 +449,12 @@ class View(): + if config.CHOICE_MIC_HOST == "NoHost": + self.view_variable.VAR_MIC_HOST.set("No Mic Host Detected") + + if config.CHOICE_MIC_DEVICE == "NoDevice": + self.view_variable.VAR_MIC_DEVICE.set("No Mic Device Detected") + if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice": vrct_gui._changeConfigWindowWidgetsStatus( status="disabled", @@ -458,6 +464,9 @@ class View(): ] ) + if config.CHOICE_SPEAKER_DEVICE == "NoDevice": + self.view_variable.VAR_SPEAKER_DEVICE.set("No Speaker Device Detected") + if config.CHOICE_SPEAKER_DEVICE == "NoDevice": vrct_gui._changeConfigWindowWidgetsStatus( status="disabled", From 17b33d57df974139fb9ebf3daea91bac96e15ca4 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:50:39 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[Update]=20Config=20Window:=20Mic/Speaker?= =?UTF-8?q?=20Dynamic=20Energy=20Threshold=E3=81=AE=E3=82=AA=E3=83=B3?= =?UTF-8?q?=E3=82=AA=E3=83=95=E3=81=A7=E3=80=81Mic/Speaker=20Energy=20Thre?= =?UTF-8?q?shold=E3=81=AEWidget=E3=82=92=E6=8A=98=E3=82=8A=E3=81=9F?= =?UTF-8?q?=E3=81=9F=E3=82=93=E3=81=A0=E3=82=8A=E9=96=8B=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=82=8A=E3=80=82=E5=88=9D=E6=9C=9F=E5=80=A4=E3=81=AB=E5=90=88?= =?UTF-8?q?=E3=82=8F=E3=81=9B=E3=81=9F=E5=8B=95=E4=BD=9C=E3=82=82=E5=90=AB?= =?UTF-8?q?=E3=82=81=E3=81=A6=E5=AE=9F=E8=A3=85=E3=80=82=20[bugfix]=20Spea?= =?UTF-8?q?ker=20Dynamic=20Energy=20Threshold=E3=81=ABMic=E3=81=AEctk=20va?= =?UTF-8?q?riable=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 9 +++++++ view.py | 25 +++++++++++++++++++ .../_SettingBoxGenerator.py | 5 ++-- .../createSettingBox_Mic.py | 22 ++++++++-------- .../createSettingBox_Speaker.py | 22 ++++++++-------- 5 files changed, 56 insertions(+), 27 deletions(-) diff --git a/controller.py b/controller.py index ecbe1376..d0384d8d 100644 --- a/controller.py +++ b/controller.py @@ -410,6 +410,10 @@ def callbackSetMicEnergyThreshold(value): def callbackSetMicDynamicEnergyThreshold(value): print("callbackSetMicDynamicEnergyThreshold", value) config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = value + if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True: + view.closeMicEnergyThresholdWidget() + else: + view.openMicEnergyThresholdWidget() def setProgressBarMicEnergy(energy): view.updateSetProgressBar_MicEnergy(energy) @@ -503,6 +507,11 @@ def callbackSetSpeakerEnergyThreshold(value): def callbackSetSpeakerDynamicEnergyThreshold(value): print("callbackSetSpeakerDynamicEnergyThreshold", value) config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value + if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True: + view.closeSpeakerEnergyThresholdWidget() + else: + view.openSpeakerEnergyThresholdWidget() + def setProgressBarSpeakerEnergy(energy): view.updateSetProgressBar_SpeakerEnergy(energy) diff --git a/view.py b/view.py index b2c4896e..22f775ff 100644 --- a/view.py +++ b/view.py @@ -476,6 +476,13 @@ class View(): ) + if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True: + self.closeMicEnergyThresholdWidget() + + if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True: + self.closeSpeakerEnergyThresholdWidget() + + # Insert sample conversation for testing. # self._insertSampleConversationToTextbox() @@ -692,6 +699,24 @@ class View(): def setWidgetsStatus_ConfigWindowCompactModeSwitch_Normal(): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="normal") + @staticmethod + def openMicEnergyThresholdWidget(): + vrct_gui.config_window.sb__mic_dynamic_energy_threshold.grid(pady=0) + vrct_gui.config_window.sb__mic_energy_threshold.grid() + @staticmethod + def closeMicEnergyThresholdWidget(): + vrct_gui.config_window.sb__mic_dynamic_energy_threshold.grid(pady=(0,1)) + vrct_gui.config_window.sb__mic_energy_threshold.grid_remove() + + @staticmethod + def openSpeakerEnergyThresholdWidget(): + vrct_gui.config_window.sb__speaker_dynamic_energy_threshold.grid(pady=0) + vrct_gui.config_window.sb__speaker_energy_threshold.grid() + @staticmethod + def closeSpeakerEnergyThresholdWidget(): + vrct_gui.config_window.sb__speaker_dynamic_energy_threshold.grid(pady=(0,1)) + vrct_gui.config_window.sb__speaker_energy_threshold.grid_remove() + @staticmethod def setWidgetsStatus_ThresholdCheckButton_Disabled(): vrct_gui._changeConfigWindowWidgetsStatus( diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index 6a92002a..a8fcf87d 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -137,7 +137,7 @@ class _SettingBoxGenerator(): - def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, is_checked, command): + def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, variable, command): (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text) switch_widget = CTkSwitch( @@ -151,6 +151,7 @@ class _SettingBoxGenerator(): switch_width=self.settings.uism.SB__SWITCH_BOX_WIDTH, onvalue=True, offvalue=False, + variable=variable, command=command, fg_color=self.settings.ctm.SB__SWITCH_BOX_BG_COLOR, # bg_color="red", @@ -158,8 +159,6 @@ class _SettingBoxGenerator(): ) setattr(self.config_window, switch_attr_name, switch_widget) - switch_widget.select() if is_checked else switch_widget.deselect() - switch_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e") return setting_box_frame 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 6672cee7..d4a071b2 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 @@ -5,7 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_variable): sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu - createSettingBoxCheckbox = sbg.createSettingBoxCheckbox + createSettingBoxSwitch = sbg.createSettingBoxSwitch createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider createSettingBoxEntry = sbg.createSettingBoxEntry @@ -65,6 +65,15 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari config_window.sb__mic_device.grid(row=row) row+=1 + config_window.sb__mic_dynamic_energy_threshold = createSettingBoxSwitch( + for_var_label_text=view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD, + for_var_desc_text=view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD, + switch_attr_name="sb__checkbox_mic_dynamic_energy_threshold", + command=lambda: checkbox_input_mic_dynamic_energy_threshold_callback(config_window.sb__checkbox_mic_dynamic_energy_threshold), + variable=view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD + ) + config_window.sb__mic_dynamic_energy_threshold.grid(row=row, pady=0) + row+=1 config_window.sb__mic_energy_threshold = createSettingBoxProgressbarXSlider( for_var_label_text=view_variable.VAR_LABEL_MIC_ENERGY_THRESHOLD, @@ -92,17 +101,6 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari config_window.sb__mic_energy_threshold.grid(row=row) row+=1 - # Mic Dynamic Energy Thresholdも上に引っ付ける予定 - config_window.sb__mic_dynamic_energy_threshold = createSettingBoxCheckbox( - for_var_label_text=view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD, - for_var_desc_text=view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD, - checkbox_attr_name="sb__checkbox_mic_dynamic_energy_threshold", - command=lambda: checkbox_input_mic_dynamic_energy_threshold_callback(config_window.sb__checkbox_mic_dynamic_energy_threshold), - variable=view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD - ) - config_window.sb__mic_dynamic_energy_threshold.grid(row=row) - row+=1 - # 以下3つも一つの項目にまとめるかもしれない config_window.sb__mic_record_timeout = 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 01805127..e557461e 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 @@ -5,7 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_variable): sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu - createSettingBoxCheckbox = sbg.createSettingBoxCheckbox + createSettingBoxSwitch = sbg.createSettingBoxSwitch createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider createSettingBoxEntry = sbg.createSettingBoxEntry @@ -48,6 +48,15 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ config_window.sb__speaker_device.grid(row=row) row+=1 + config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxSwitch( + for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, + for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, + switch_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), + variable=view_variable.VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, + ) + config_window.sb__speaker_dynamic_energy_threshold.grid(row=row, pady=0) + row+=1 config_window.sb__speaker_energy_threshold = createSettingBoxProgressbarXSlider( for_var_label_text=view_variable.VAR_LABEL_SPEAKER_ENERGY_THRESHOLD, @@ -75,17 +84,6 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ config_window.sb__speaker_energy_threshold.grid(row=row) row+=1 - # Speaker Dynamic Energy Thresholdも上に引っ付ける予定 - config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxCheckbox( - for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, - for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DYNAMIC_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), - variable=view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD, - ) - config_window.sb__speaker_dynamic_energy_threshold.grid(row=row) - row+=1 - # 以下3つも一つの項目にまとめるかもしれない config_window.sb__speaker_record_timeout = createSettingBoxEntry( From 46e406bfc4247444ba004d607a2c92a7e0d32f13 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:22:35 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[Update]=20Config=20Window:=20=E3=82=B9?= =?UTF-8?q?=E3=83=AC=E3=83=83=E3=82=B7=E3=83=A7=E3=83=AB=E3=83=89=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E5=91=A8=E3=82=8A=E3=81=AE=E6=96=87?= =?UTF-8?q?=E8=A8=80=E5=A4=89=E6=9B=B4=EF=BC=88=E9=96=93=E3=81=AB=E5=90=88?= =?UTF-8?q?=E3=82=8F=E3=81=9B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 20 ++++++++++---------- locales/ja.yml | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index ae3896d6..b5f5a01c 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -56,12 +56,12 @@ config_window: label: Mic Host/Driver mic_device: label: Mic Device - mic_energy_threshold: - label: Mic Energy Threshold - desc: Slider to modify the threshold for activating voice input. Press the microphone button to initiate input and speak, allowing you to adjust it while monitoring the actual volume. mic_dynamic_energy_threshold: - label: Mic Dynamic Energy Threshold - desc: When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold. + label: Mic Energy Threshold (Auto) + desc: Automatically determine mic input sensitivity. + mic_energy_threshold: + label: Mic Energy Threshold (Manual) + desc: Slider to modify the threshold for activating voice input. Press the microphone button to initiate input and speak, allowing you to adjust it while monitoring the actual volume. mic_record_timeout: label: Mic Record Timeout mic_phrase_timeout: @@ -75,12 +75,12 @@ config_window: speaker_device: label: Speaker Device - speaker_energy_threshold: - label: Speaker Energy Threshold - desc: Slider to modify the threshold for activating voice input. Press the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. speaker_dynamic_energy_threshold: - label: Speaker Dynamic Energy Threshold - desc: When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold. + label: Speaker Energy Threshold (Auto) + desc: Automatically determine speaker input sensitivity. + speaker_energy_threshold: + label: Speaker Energy Threshold (Manual) + desc: Slider to modify the threshold for activating voice input. Press the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. speaker_record_timeout: label: Speaker Record Timeout speaker_phrase_timeout: diff --git a/locales/ja.yml b/locales/ja.yml index 1a773f01..ec547ebf 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -58,12 +58,12 @@ config_window: label: マイク(ホスト/ドライバー) mic_device: label: マイク (デバイス) - mic_energy_threshold: - label: 音声取得のしきい値 - desc: スライダーを調整してしきい値を決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。 mic_dynamic_energy_threshold: - label: 音声取得のしきい値の自動調整 - desc: 有効にすると、設定されたしきい値に応じて、ある程度自動的に調節されます。 + label: マイク入力感度の調整(自動) + desc: マイクの入力感度が自動的に調節されます。 + mic_energy_threshold: + label: マイク入力感度の調整(手動) + desc: スライダーを調整してしきい値を決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。 mic_record_timeout: label: マイク音声の区切りの無音時間 mic_phrase_timeout: @@ -77,12 +77,12 @@ config_window: speaker_device: label: スピーカー(デバイス) - speaker_energy_threshold: - label: 音声取得のしきい値 - desc: スライダーを調整してしきい値を決められます。スピーカーのアイコンを押すと、設定されたデバイスから音を聞き取り、音量を確認しながら調節できます。 speaker_dynamic_energy_threshold: - label: 音声取得のしきい値の自動調整 - desc: 有効にすると、設定されたしきい値に応じて、ある程度自動的に調節されます。 + label: スピーカー入力感度の調整(自動) + desc: スピーカーの入力感度が自動的に調節されます。 + speaker_energy_threshold: + label: スピーカー入力感度の調整(手動) + desc: スライダーを調整してしきい値を決められます。スピーカーのアイコンを押すと、設定されたデバイスから音を聞き取り、音量を確認しながら調節できます。 speaker_record_timeout: label: スピーカー音声の区切りの無音時間 speaker_phrase_timeout: From 01ade68d4e57a4ab807cda1b4112f89dde7f8b38 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:41:14 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[Update]=20Config=20Window:=20=E3=82=B9?= =?UTF-8?q?=E3=83=AC=E3=83=83=E3=82=B7=E3=83=A7=E3=83=AB=E3=83=89=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AE?= =?UTF-8?q?Disabled=E5=87=A6=E7=90=86=E8=BF=BD=E5=8A=A0=E3=82=84=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=80=82Disabled=E3=81=AA=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=81=9D=E3=81=AE=E3=82=82=E3=81=AE=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 21 ++++++++++++++++-- .../_SettingBoxGenerator.py | 21 ++++++++++++++++++ .../createSettingBox_Mic.py | 4 +++- .../createSettingBox_Speaker.py | 4 +++- vrct_gui/ui_utils/ui_utils.py | 22 ++++++++++--------- 5 files changed, 58 insertions(+), 14 deletions(-) diff --git a/view.py b/view.py index 22f775ff..7e904143 100644 --- a/view.py +++ b/view.py @@ -463,17 +463,18 @@ class View(): "sb__optionmenu_mic_device", ] ) + self.replaceMicThresholdCheckButton_Disabled() if config.CHOICE_SPEAKER_DEVICE == "NoDevice": self.view_variable.VAR_SPEAKER_DEVICE.set("No Speaker Device Detected") - - if config.CHOICE_SPEAKER_DEVICE == "NoDevice": vrct_gui._changeConfigWindowWidgetsStatus( status="disabled", target_names=[ "sb__optionmenu_speaker_device", ] ) + self.replaceSpeakerThresholdCheckButton_Disabled() + if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True: @@ -740,11 +741,19 @@ class View(): @staticmethod def replaceMicThresholdCheckButton_Active(): vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_mic_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid() + @staticmethod + def replaceMicThresholdCheckButton_Disabled(): + vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_mic_energy_threshold.grid() + @staticmethod def replaceMicThresholdCheckButton_Passive(): vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_mic_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid() @@ -752,11 +761,19 @@ class View(): @staticmethod def replaceSpeakerThresholdCheckButton_Active(): vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_speaker_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid() + @staticmethod + def replaceSpeakerThresholdCheckButton_Disabled(): + vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_speaker_energy_threshold.grid() + @staticmethod def replaceSpeakerThresholdCheckButton_Passive(): vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid_remove() + vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_speaker_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid() diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index a8fcf87d..29fbba04 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -233,6 +233,7 @@ class _SettingBoxGenerator(): progressbar_attr_name, passive_button_attr_name, passive_button_command, active_button_attr_name, active_button_command, + disabled_button_attr_name, disabled_button_image_file, button_image_file, entry_variable, @@ -316,16 +317,23 @@ class _SettingBoxGenerator(): passive_button_wrapper = self._createPassiveButtonForProgressbarXSlider(setting_box_item_frame, passive_button_command, button_image_file) setattr(self.config_window, passive_button_attr_name, passive_button_wrapper) + disabled_button_wrapper = self._createDisabledButtonForProgressbarXSlider(setting_box_item_frame, disabled_button_image_file) + setattr(self.config_window, disabled_button_attr_name, disabled_button_wrapper) + active_button_wrapper = self._createActiveButtonForProgressbarXSlider(setting_box_item_frame, active_button_command, button_image_file) setattr(self.config_window, active_button_attr_name, active_button_wrapper) passive_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e") passive_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2)) + disabled_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e") + disabled_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2)) + active_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e") active_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2)) passive_button_wrapper.grid_remove() + disabled_button_wrapper.grid_remove() active_button_wrapper.grid_remove() passive_button_wrapper.grid() @@ -484,4 +492,17 @@ class _SettingBoxGenerator(): button_ipadxy=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY, button_command=button_command, ) + return button_wrapper + + + + def _createDisabledButtonForProgressbarXSlider(self, setting_box_progressbar_x_slider_frame, button_image_file): + button_wrapper = createButtonWithImage( + parent_widget=setting_box_progressbar_x_slider_frame, + button_fg_color=self.settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR, + button_image_file=button_image_file, + button_image_size=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_ICON_SIZE, + button_ipadxy=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY, + no_bind=True, + ) return button_wrapper \ 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 d4a071b2..9ad30f57 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 @@ -96,7 +96,9 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari passive_button_command=lambda _e: checkbox_input_mic_threshold_check_callback(True), active_button_attr_name="sb__progressbar_x_slider__active_button_mic_energy_threshold", active_button_command=lambda _e: checkbox_input_mic_threshold_check_callback(False), - button_image_file=settings.image_file.MIC_ICON + button_image_file=settings.image_file.MIC_ICON, + disabled_button_attr_name="sb__progressbar_x_slider__disabled_button_mic_energy_threshold", + disabled_button_image_file=settings.image_file.MIC_ICON_DISABLED, ) config_window.sb__mic_energy_threshold.grid(row=row) row+=1 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 e557461e..9886ac57 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 @@ -79,7 +79,9 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ passive_button_command=lambda _e: checkbox_input_speaker_threshold_check_callback(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(False), - button_image_file=settings.image_file.HEADPHONES_ICON + button_image_file=settings.image_file.HEADPHONES_ICON, + disabled_button_attr_name="sb__progressbar_x_slider__disabled_button_speaker_energy_threshold", + disabled_button_image_file=settings.image_file.HEADPHONES_ICON_DISABLED, ) config_window.sb__speaker_energy_threshold.grid(row=row) row+=1 diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index ea957867..8f562d32 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -126,17 +126,19 @@ def switchTabsColor(target_widget, tab_buttons, active_bg_color, active_text_col -def createButtonWithImage(parent_widget, button_fg_color, button_enter_color, button_clicked_color, button_image_file, button_image_size, button_ipadxy, button_command, corner_radius: int = 0): - button_wrapper = CTkFrame(parent_widget, corner_radius=corner_radius, fg_color=button_fg_color, height=0, width=0, cursor="hand2") +def createButtonWithImage(parent_widget, button_image_size, button_ipadxy, button_fg_color, button_enter_color=None, button_clicked_color=None, button_image_file=None, button_command=None, corner_radius:int=0, no_bind:bool=False): + button_wrapper = CTkFrame(parent_widget, corner_radius=corner_radius, fg_color=button_fg_color, height=0, width=0) - button_widget = CTkLabel( - button_wrapper, - text=None, - height=0, - image=CTkImage((button_image_file),size=(button_image_size,button_image_size)), - ) - button_widget.grid(row=0, column=0, padx=button_ipadxy, pady=button_ipadxy) + button_widget = CTkLabel( + button_wrapper, + text=None, + height=0, + image=CTkImage((button_image_file),size=(button_image_size,button_image_size)), + ) + button_widget.grid(row=0, column=0, padx=button_ipadxy, pady=button_ipadxy) + if no_bind is False: + button_wrapper.configure(cursor="hand2") bindButtonFunctionAndColor( target_widgets=[button_wrapper, button_widget], enter_color=button_enter_color, @@ -145,7 +147,7 @@ def createButtonWithImage(parent_widget, button_fg_color, button_enter_color, bu buttonReleasedFunction=button_command, ) - return button_wrapper + return button_wrapper def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_bg_color, optionmenu_clicked_bg_color, optionmenu_ipadx, optionmenu_ipady, variable, font_family, font_size, text_color, image_file, image_size, optionmenu_clicked_command, optionmenu_position=None, optionmenu_padx_between_img=0, optionmenu_min_height=None, optionmenu_min_width=None, setattr_widget=None, image_widget_attr_name=None): From 2d43061f8ea3ca8db88cf611c99fffd87e784df4 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:27:12 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[bugfix]=20Config=20Window:=20=E3=82=B9?= =?UTF-8?q?=E3=83=AC=E3=83=83=E3=82=B7=E3=83=A7=E3=83=AB=E3=83=89=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=83=9C=E3=82=BF=E3=83=B3Disabled?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=81=8C=E3=80=81=E3=82=B3=E3=83=B3=E3=83=91?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=83=A2=E3=83=BC=E3=83=89=E3=82=84=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E7=94=BB=E9=9D=A2=E9=96=89=E3=81=98=E3=82=8B=E9=9A=9B?= =?UTF-8?q?=E3=81=AB=E8=A7=A3=E9=99=A4=E3=81=95=E3=82=8C=E3=81=A6=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=86=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 20 ++++++++++---------- view.py | 13 +++++++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/controller.py b/controller.py index d0384d8d..b17eaa84 100644 --- a/controller.py +++ b/controller.py @@ -300,9 +300,9 @@ def callbackOpenConfigWindow(): def callbackCloseConfigWindow(): model.stopCheckMicEnergy() model.stopCheckSpeakerEnergy() - view.replaceMicThresholdCheckButton_Passive() + view.initMicThresholdCheckButton() # view.initProgressBar_MicEnergy() # ProgressBarに0をセットしたい - view.replaceSpeakerThresholdCheckButton_Passive() + view.initSpeakerThresholdCheckButton() # view.initProgressBar_SpeakerEnergy() # ProgressBarに0をセットしたい if config.ENABLE_TRANSCRIPTION_SEND is True: @@ -319,18 +319,18 @@ def callbackCloseConfigWindow(): def callbackEnableConfigWindowCompactMode(): config.IS_CONFIG_WINDOW_COMPACT_MODE = True model.stopCheckMicEnergy() - view.replaceMicThresholdCheckButton_Passive() + view.initMicThresholdCheckButton() model.stopCheckSpeakerEnergy() - view.replaceSpeakerThresholdCheckButton_Passive() + view.initSpeakerThresholdCheckButton() view.enableConfigWindowCompactMode() def callbackDisableConfigWindowCompactMode(): config.IS_CONFIG_WINDOW_COMPACT_MODE = False model.stopCheckMicEnergy() - view.replaceMicThresholdCheckButton_Passive() + view.initMicThresholdCheckButton() model.stopCheckSpeakerEnergy() - view.replaceSpeakerThresholdCheckButton_Passive() + view.initSpeakerThresholdCheckButton() view.disableConfigWindowCompactMode() @@ -421,12 +421,12 @@ def setProgressBarMicEnergy(energy): def callbackCheckMicThreshold(is_turned_on): print("callbackCheckMicThreshold", is_turned_on) if is_turned_on is True: - view.setWidgetsStatus_ThresholdCheckButton_Disabled() + view.replaceMicThresholdCheckButton_Disabled() model.startCheckMicEnergy(setProgressBarMicEnergy) view.replaceMicThresholdCheckButton_Active() view.setWidgetsStatus_ThresholdCheckButton_Normal() else: - view.setWidgetsStatus_ThresholdCheckButton_Disabled() + view.replaceMicThresholdCheckButton_Disabled() model.stopCheckMicEnergy() view.replaceMicThresholdCheckButton_Passive() view.setWidgetsStatus_ThresholdCheckButton_Normal() @@ -519,12 +519,12 @@ def setProgressBarSpeakerEnergy(energy): def callbackCheckSpeakerThreshold(is_turned_on): print("callbackCheckSpeakerThreshold", is_turned_on) if is_turned_on is True: - view.setWidgetsStatus_ThresholdCheckButton_Disabled() + view.replaceSpeakerThresholdCheckButton_Disabled() model.startCheckSpeakerEnergy(setProgressBarSpeakerEnergy) view.replaceSpeakerThresholdCheckButton_Active() view.setWidgetsStatus_ThresholdCheckButton_Normal() else: - view.setWidgetsStatus_ThresholdCheckButton_Disabled() + view.replaceSpeakerThresholdCheckButton_Disabled() model.stopCheckSpeakerEnergy() view.replaceSpeakerThresholdCheckButton_Passive() view.setWidgetsStatus_ThresholdCheckButton_Normal() diff --git a/view.py b/view.py index 7e904143..a83b6d66 100644 --- a/view.py +++ b/view.py @@ -738,6 +738,13 @@ class View(): ] ) + + def initMicThresholdCheckButton(self): + if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice": + self.replaceMicThresholdCheckButton_Disabled() + else: + self.replaceMicThresholdCheckButton_Passive() + @staticmethod def replaceMicThresholdCheckButton_Active(): vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid_remove() @@ -758,6 +765,12 @@ class View(): + def initSpeakerThresholdCheckButton(self): + if config.CHOICE_SPEAKER_DEVICE == "NoDevice": + self.replaceSpeakerThresholdCheckButton_Disabled() + else: + self.replaceSpeakerThresholdCheckButton_Passive() + @staticmethod def replaceSpeakerThresholdCheckButton_Active(): vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid_remove() From 0bad71deccb8750ba2396a7fab24ebbd56105d66 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 12 Oct 2023 16:08:51 +0900 Subject: [PATCH 7/7] [Update] Config Window: combine Mic/Speaker Dynamic Energy Threshold and Mic/Speaker Energy Threshold. change the label and description for it. --- locales/en.yml | 14 ++----- locales/ja.yml | 10 +---- view.py | 24 ++++++------ .../_SettingBoxGenerator.py | 39 +++++++++---------- .../createSettingBox_Mic.py | 2 - .../createSettingBox_Speaker.py | 2 - vrct_gui/ui_managers/UiScalingManager.py | 6 +-- 7 files changed, 39 insertions(+), 58 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index b5f5a01c..1ee08a3c 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -57,11 +57,8 @@ config_window: mic_device: label: Mic Device mic_dynamic_energy_threshold: - label: Mic Energy Threshold (Auto) - desc: Automatically determine mic input sensitivity. - mic_energy_threshold: - label: Mic Energy Threshold (Manual) - desc: Slider to modify the threshold for activating voice input. Press the microphone button to initiate input and speak, allowing you to adjust it while monitoring the actual volume. + label: Mic Energy Threshold (Automatic) + desc: Enabling this option will automatically adjust the microphone's input sensitivity. If you disable it, you can manually set the input sensitivity using the slider. Press the microphone icon to input your voice and adjust the sensitivity while monitoring the actual volume. mic_record_timeout: label: Mic Record Timeout mic_phrase_timeout: @@ -76,11 +73,8 @@ config_window: speaker_device: label: Speaker Device speaker_dynamic_energy_threshold: - label: Speaker Energy Threshold (Auto) - desc: Automatically determine speaker input sensitivity. - speaker_energy_threshold: - label: Speaker Energy Threshold (Manual) - desc: Slider to modify the threshold for activating voice input. Press the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. + label: Speaker Energy Threshold (Automatic) + desc: Enabling this option will automatically adjust the speaker's input sensitivity. If you disable it, you can manually set the input sensitivity using the slider. Press the headphones icon to listen to the audio and adjust the sensitivity while monitoring the volume. speaker_record_timeout: label: Speaker Record Timeout speaker_phrase_timeout: diff --git a/locales/ja.yml b/locales/ja.yml index ec547ebf..4fe7887b 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -60,10 +60,7 @@ config_window: label: マイク (デバイス) mic_dynamic_energy_threshold: label: マイク入力感度の調整(自動) - desc: マイクの入力感度が自動的に調節されます。 - mic_energy_threshold: - label: マイク入力感度の調整(手動) - desc: スライダーを調整してしきい値を決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。 + desc: 有効にするとマイクの入力感度が自動的に調節されます。無効の場合は、スライダーを調整して入力感度を手動で決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。 mic_record_timeout: label: マイク音声の区切りの無音時間 mic_phrase_timeout: @@ -79,10 +76,7 @@ config_window: label: スピーカー(デバイス) speaker_dynamic_energy_threshold: label: スピーカー入力感度の調整(自動) - desc: スピーカーの入力感度が自動的に調節されます。 - speaker_energy_threshold: - label: スピーカー入力感度の調整(手動) - desc: スライダーを調整してしきい値を決められます。スピーカーのアイコンを押すと、設定されたデバイスから音を聞き取り、音量を確認しながら調節できます。 + desc: 有効にするとスピーカーの入力感度が自動的に調節されます。無効の場合は、スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。 speaker_record_timeout: label: スピーカー音声の区切りの無音時間 speaker_phrase_timeout: diff --git a/view.py b/view.py index a83b6d66..bc8974a1 100644 --- a/view.py +++ b/view.py @@ -203,18 +203,18 @@ class View(): CALLBACK_SET_MIC_DEVICE=None, VAR_MIC_DEVICE=StringVar(value=config.CHOICE_MIC_DEVICE), - VAR_LABEL_MIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_energy_threshold.label")), - VAR_DESC_MIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_energy_threshold.desc")), + + VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.label")), + VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.desc")), + CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None, + VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD), + SLIDER_RANGE_MIC_ENERGY_THRESHOLD=(0, config.MAX_MIC_ENERGY_THRESHOLD), CALLBACK_CHECK_MIC_THRESHOLD=None, VAR_MIC_ENERGY_THRESHOLD__SLIDER=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD), VAR_MIC_ENERGY_THRESHOLD__ENTRY=StringVar(value=config.INPUT_MIC_ENERGY_THRESHOLD), CALLBACK_FOCUS_OUT_MIC_ENERGY_THRESHOLD=self.setLatestConfigVariable_MicEnergyThreshold, - VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.label")), - VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.desc")), - CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None, - VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD), VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.label")), VAR_DESC_MIC_RECORD_TIMEOUT=None, @@ -247,18 +247,18 @@ class View(): CALLBACK_SET_SPEAKER_DEVICE=None, VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE), - VAR_LABEL_SPEAKER_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_energy_threshold.label")), - VAR_DESC_SPEAKER_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_energy_threshold.desc")), + + VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.label")), + VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.desc")), + CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None, + VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD), + SLIDER_RANGE_SPEAKER_ENERGY_THRESHOLD=(0, config.MAX_SPEAKER_ENERGY_THRESHOLD), CALLBACK_CHECK_SPEAKER_THRESHOLD=None, VAR_SPEAKER_ENERGY_THRESHOLD__SLIDER=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD), VAR_SPEAKER_ENERGY_THRESHOLD__ENTRY=StringVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD), CALLBACK_FOCUS_OUT_SPEAKER_ENERGY_THRESHOLD=self.setLatestConfigVariable_SpeakerEnergyThreshold, - VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.label")), - VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.desc")), - CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None, - VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD), VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.label")), VAR_DESC_SPEAKER_RECORD_TIMEOUT=None, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index 29fbba04..8a5ad552 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -18,7 +18,7 @@ class _SettingBoxGenerator(): self.dropdown_menu_window = vrct_gui.vrct_gui.dropdown_menu_window - def _createSettingBoxFrame(self, sb__attr_name, for_var_label_text, for_var_desc_text): + def _createSettingBoxFrame(self, sb__attr_name, for_var_label_text=None, for_var_desc_text=None): self.config_window.sb__widgets[sb__attr_name] = SimpleNamespace() setting_box_frame = CTkFrame(self.parent_widget, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) @@ -39,10 +39,15 @@ class _SettingBoxGenerator(): setting_box_frame_wrapper_fix_border2 = CTkFrame(setting_box_frame, corner_radius=0, width=0, height=0) setting_box_frame_wrapper_fix_border2.grid(row=0, column=1, sticky="ns") - self._setSettingBoxLabels(sb__attr_name, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text) + if for_var_label_text is not None: + self._setSettingBoxLabels(sb__attr_name, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text) + # setting_box_item_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color="red") setting_box_item_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.settings.ctm.SB__BG_COLOR) - setting_box_item_frame.grid(row=0, column=2, padx=0, sticky="nsew") + if for_var_label_text is not None: + setting_box_item_frame.grid(row=0, column=2, padx=0, sticky="nsew") + else: + setting_box_item_frame.grid(row=0, columnspan=3, padx=0, sticky="nsew") setting_box_item_frame.grid_rowconfigure((0,2), weight=1) setting_box_item_frame.grid_columnconfigure(0, weight=1) @@ -227,7 +232,7 @@ class _SettingBoxGenerator(): def createSettingBoxProgressbarXSlider( self, - for_var_label_text, for_var_desc_text, command, progressbar_x_slider_attr_name, + command, progressbar_x_slider_attr_name, entry_attr_name, entry_bind__FocusOut, slider_attr_name, slider_range, progressbar_attr_name, @@ -243,22 +248,18 @@ class _SettingBoxGenerator(): ): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name, for_var_label_text, for_var_desc_text) - - ENTRY_WIDTH = self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH - BAR_WIDTH = self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_WIDTH - - BAR_PADDING = int(ENTRY_WIDTH + self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_RIGHT_PADX) - BUTTON_PADDING = int(BAR_WIDTH + BAR_PADDING + self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_RIGHT_PADX) + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name) def adjusted_command__for_entry_bind__Any_KeyRelease(e): command(e.widget.get()) def adjusted_command__for_slider(value): command(value) + setting_box_item_frame.grid_columnconfigure((0,2), weight=0) + setting_box_item_frame.grid_columnconfigure(1, weight=1) entry_widget = CTkEntry( setting_box_item_frame, - width=ENTRY_WIDTH, + width=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH, height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT, textvariable=entry_variable, font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__ENTRY_FONT_SIZE, weight="normal"), @@ -268,7 +269,7 @@ class _SettingBoxGenerator(): if entry_bind__FocusOut is not None: entry_widget.bind("", entry_bind__FocusOut, "+") - entry_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=0, pady=0, sticky="e") + entry_widget.grid(row=1, column=2, padx=0, pady=0, sticky="e") setattr(self.config_window, entry_attr_name, entry_widget) @@ -284,7 +285,6 @@ class _SettingBoxGenerator(): command=adjusted_command__for_slider, variable=slider_variable, height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__SLIDER_HEIGHT, - width=BAR_WIDTH, border_width=0, button_length=SLIDER_BORDER_WIDTH, button_corner_radius=SLIDER_BUTTON_LENGTH, @@ -295,7 +295,7 @@ class _SettingBoxGenerator(): progress_color=self.settings.ctm.SB__BG_COLOR, border_color=self.settings.ctm.SB__BG_COLOR, ) - slider_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0, BAR_PADDING), sticky="e") + slider_widget.grid(row=1, column=1, padx=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_PADX, sticky="ew") setattr(self.config_window, slider_attr_name, slider_widget) @@ -303,12 +303,11 @@ class _SettingBoxGenerator(): progressbar_widget = CTkProgressBar( setting_box_item_frame, - width=BAR_WIDTH, height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_HEIGHT, corner_radius=0, ) setattr(self.config_window, progressbar_attr_name, progressbar_widget) - progressbar_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0, BAR_PADDING), sticky="e") + progressbar_widget.grid(row=1, column=1, padx=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_PADX, sticky="ew") progressbar_widget.set(0) @@ -323,13 +322,13 @@ class _SettingBoxGenerator(): active_button_wrapper = self._createActiveButtonForProgressbarXSlider(setting_box_item_frame, active_button_command, button_image_file) setattr(self.config_window, active_button_attr_name, active_button_wrapper) - passive_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e") + passive_button_wrapper.grid(row=1, column=0, padx=0, sticky="w") passive_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2)) - disabled_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e") + disabled_button_wrapper.grid(row=1, column=0, padx=0, sticky="w") disabled_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2)) - active_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e") + active_button_wrapper.grid(row=1, column=0, padx=0, sticky="w") active_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2)) passive_button_wrapper.grid_remove() 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 9ad30f57..8b192421 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 @@ -76,8 +76,6 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari row+=1 config_window.sb__mic_energy_threshold = createSettingBoxProgressbarXSlider( - for_var_label_text=view_variable.VAR_LABEL_MIC_ENERGY_THRESHOLD, - for_var_desc_text=view_variable.VAR_DESC_MIC_ENERGY_THRESHOLD, command=slider_input_mic_energy_threshold_callback, progressbar_x_slider_attr_name="sb__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 9886ac57..62e8dd12 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 @@ -59,8 +59,6 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ row+=1 config_window.sb__speaker_energy_threshold = createSettingBoxProgressbarXSlider( - for_var_label_text=view_variable.VAR_LABEL_SPEAKER_ENERGY_THRESHOLD, - for_var_desc_text=view_variable.VAR_DESC_SPEAKER_ENERGY_THRESHOLD, command=slider_input_speaker_energy_threshold_callback, progressbar_x_slider_attr_name="sb__speaker_energy_threshold", diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index c669cf69..e5c7a41c 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -240,12 +240,10 @@ class UiScalingManager(): self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH = self.config_window.RESPONSIVE_UI_SIZE_INT_50 self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT = self.config_window.SB__ENTRY_HEIGHT self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_HEIGHT = self._calculateUiSize(40) - self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_LENGTH = self._calculateUiSize(2) - self.config_window.SB__PROGRESSBAR_X_SLIDER__BAR_WIDTH = self._calculateUiSize(200) self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_HEIGHT = self._calculateUiSize(8) - self.config_window.SB__PROGRESSBAR_X_SLIDER__BAR_RIGHT_PADX = self._calculateUiSize(20) + self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_LENGTH = self._calculateUiSize(2) + self.config_window.SB__PROGRESSBAR_X_SLIDER__BAR_PADX = (self._calculateUiSize(30), self._calculateUiSize(30)) - self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_RIGHT_PADX = self._calculateUiSize(20) self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY = self._calculateUiSize(10) self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_ICON_SIZE = self._calculateUiSize(20)