[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:
@@ -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)
|
||||
|
||||
25
view.py
25
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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user