From 41d8e9ca87ec8a8ee7eb7390cb1b2fc4b991cf14 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 15 Sep 2023 13:33:44 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor]=20view.py=E7=B3=BB=E3=81=AE=E9=96=A2?= =?UTF-8?q?=E6=95=B0=E5=90=8D=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 46 +++++++++++++++++++--------------------------- view.py | 16 ++++++++-------- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/main.py b/main.py index 81071fc4..a4f60f3f 100644 --- a/main.py +++ b/main.py @@ -248,18 +248,18 @@ def callbackCloseConfigWindow(): def callbackEnableConfigWindowCompactMode(): config.IS_CONFIG_WINDOW_COMPACT_MODE = True model.stopCheckMicEnergy() - view.replaceConfigWindowMicThresholdCheckButtonToPassive() + view.replaceMicThresholdCheckButton_Passive() model.stopCheckSpeakerEnergy() - view.replaceConfigWindowSpeakerThresholdCheckButtonToPassive() + view.replaceSpeakerThresholdCheckButton_Passive() view.reloadConfigWindowSettingBoxContainer() def callbackDisableConfigWindowCompactMode(): config.IS_CONFIG_WINDOW_COMPACT_MODE = False model.stopCheckMicEnergy() - view.replaceConfigWindowMicThresholdCheckButtonToPassive() + view.replaceMicThresholdCheckButton_Passive() model.stopCheckSpeakerEnergy() - view.replaceConfigWindowSpeakerThresholdCheckButtonToPassive() + view.replaceSpeakerThresholdCheckButton_Passive() view.reloadConfigWindowSettingBoxContainer() @@ -308,14 +308,14 @@ def callbackSetMicHost(value): view.updateList_MicDevice(model.getListInputDevice()) model.stopCheckMicEnergy() - view.replaceConfigWindowMicThresholdCheckButtonToPassive() + view.replaceMicThresholdCheckButton_Passive() def callbackSetMicDevice(value): print("callbackSetMicDevice", value) config.CHOICE_MIC_DEVICE = value model.stopCheckMicEnergy() - view.replaceConfigWindowMicThresholdCheckButtonToPassive() + view.replaceMicThresholdCheckButton_Passive() def callbackSetMicEnergyThreshold(value): print("callbackSetMicEnergyThreshold", value) @@ -344,19 +344,15 @@ def setProgressBarMicEnergy(energy): def callbackCheckMicThreshold(is_turned_on): print("callbackCheckMicThreshold", is_turned_on) if is_turned_on is True: - # view.setConfigWindowCompactModeSwitchStatusToDisabled() - - view.setConfigWindowThresholdCheckWidgetsStatusToDisabled() + view.setWidgetsStatus_ThresholdCheckButton_Disabled() model.startCheckMicEnergy(setProgressBarMicEnergy) - view.replaceConfigWindowMicThresholdCheckButtonToActive() - view.setConfigWindowThresholdCheckWidgetsStatusToNormal() + view.replaceMicThresholdCheckButton_Active() + view.setWidgetsStatus_ThresholdCheckButton_Normal() else: - view.setConfigWindowThresholdCheckWidgetsStatusToDisabled() + view.setWidgetsStatus_ThresholdCheckButton_Disabled() model.stopCheckMicEnergy() - view.replaceConfigWindowMicThresholdCheckButtonToPassive() - view.setConfigWindowThresholdCheckWidgetsStatusToNormal() - - # view.setConfigWindowCompactModeSwitchStatusToNormal() + view.replaceMicThresholdCheckButton_Passive() + view.setWidgetsStatus_ThresholdCheckButton_Normal() def callbackSetMicRecordTimeout(value): print("callbackSetMicRecordTimeout", value) @@ -407,7 +403,7 @@ def callbackSetSpeakerDevice(value): config.CHOICE_SPEAKER_DEVICE = value model.stopCheckSpeakerEnergy() - view.replaceConfigWindowSpeakerThresholdCheckButtonToPassive() + view.replaceSpeakerThresholdCheckButton_Passive() def callbackSetSpeakerEnergyThreshold(value): print("callbackSetSpeakerEnergyThreshold", value) @@ -436,20 +432,16 @@ def setProgressBarSpeakerEnergy(energy): def callbackCheckSpeakerThreshold(is_turned_on): print("callbackCheckSpeakerThreshold", is_turned_on) if is_turned_on is True: - # view.setConfigWindowCompactModeSwitchStatusToDisabled() - - view.setConfigWindowThresholdCheckWidgetsStatusToDisabled() + view.setWidgetsStatus_ThresholdCheckButton_Disabled() model.startCheckSpeakerEnergy(setProgressBarSpeakerEnergy) - view.replaceConfigWindowSpeakerThresholdCheckButtonToActive() - view.setConfigWindowThresholdCheckWidgetsStatusToNormal() + view.replaceSpeakerThresholdCheckButton_Active() + view.setWidgetsStatus_ThresholdCheckButton_Normal() else: - view.setConfigWindowThresholdCheckWidgetsStatusToDisabled() + view.setWidgetsStatus_ThresholdCheckButton_Disabled() model.stopCheckSpeakerEnergy() - view.replaceConfigWindowSpeakerThresholdCheckButtonToPassive() - view.setConfigWindowThresholdCheckWidgetsStatusToNormal() - - # view.setConfigWindowCompactModeSwitchStatusToNormal() + view.replaceSpeakerThresholdCheckButton_Passive() + view.setWidgetsStatus_ThresholdCheckButton_Normal() def callbackSetSpeakerRecordTimeout(value): print("callbackSetSpeakerRecordTimeout", value) diff --git a/view.py b/view.py index ea7d1e71..1bd1d44a 100644 --- a/view.py +++ b/view.py @@ -509,15 +509,15 @@ class View(): # Config Window @staticmethod - def setConfigWindowCompactModeSwitchStatusToDisabled(): + def setWidgetsStatus_ConfigWindowCompactModeSwitch_Disabled(): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="disabled") @staticmethod - def setConfigWindowCompactModeSwitchStatusToNormal(): + def setWidgetsStatus_ConfigWindowCompactModeSwitch_Normal(): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="normal") @staticmethod - def setConfigWindowThresholdCheckWidgetsStatusToDisabled(): + def setWidgetsStatus_ThresholdCheckButton_Disabled(): vrct_gui.changeConfigWindowWidgetsStatus( status="disabled", target_names=[ @@ -527,7 +527,7 @@ class View(): ) @staticmethod - def setConfigWindowThresholdCheckWidgetsStatusToNormal(): + def setWidgetsStatus_ThresholdCheckButton_Normal(): vrct_gui.changeConfigWindowWidgetsStatus( status="normal", target_names=[ @@ -537,24 +537,24 @@ class View(): ) @staticmethod - def replaceConfigWindowMicThresholdCheckButtonToActive(): + def replaceMicThresholdCheckButton_Active(): vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid() @staticmethod - def replaceConfigWindowMicThresholdCheckButtonToPassive(): + def replaceMicThresholdCheckButton_Passive(): vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid() @staticmethod - def replaceConfigWindowSpeakerThresholdCheckButtonToActive(): + def replaceSpeakerThresholdCheckButton_Active(): vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid() @staticmethod - def replaceConfigWindowSpeakerThresholdCheckButtonToPassive(): + def replaceSpeakerThresholdCheckButton_Passive(): vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid_remove() vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid()