[Update] Config Window: combine Mic/Speaker Dynamic Energy Threshold and Mic/Speaker Energy Threshold. change the label and description for it.

This commit is contained in:
Sakamoto Shiina
2023-10-12 16:08:51 +09:00
parent 2d43061f8e
commit 0bad71decc
7 changed files with 39 additions and 58 deletions

View File

@@ -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:

View File

@@ -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:

24
view.py
View File

@@ -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,

View File

@@ -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")
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)
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("<FocusOut>", 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()

View File

@@ -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",

View File

@@ -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",

View File

@@ -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)