[Update] Config Window: Mic/Speaker Dynamic Energy Thresholdのオンオフで、Mic/Speaker Energy ThresholdのWidgetを折りたたんだり開いたり。初期値に合わせた動作も含めて実装。

[bugfix] Speaker Dynamic Energy ThresholdにMicのctk variableを設定していたのを修正。
This commit is contained in:
Sakamoto Shiina
2023-10-12 11:50:39 +09:00
parent fd433754fc
commit 17b33d57df
5 changed files with 56 additions and 27 deletions

View File

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

View File

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

View File

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