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(