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