From b4479e570ad75d1aa2c091962561181206bcaaba Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:26:41 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20Config=20Window:=20Mic/Speaker=20Ene?= =?UTF-8?q?rgy=20Threshold=20Check.=20=E3=81=97=E3=81=8D=E3=81=84=E5=80=A4?= =?UTF-8?q?=E3=82=92=E8=B6=85=E3=81=88=E3=82=8B=E3=81=A8=E8=89=B2=E3=81=8C?= =?UTF-8?q?=E5=A4=89=E3=82=8F=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=82?= =?UTF-8?q?=20ProgressBar=20Widget=E3=82=92=E5=A4=89=E5=8C=96=E3=81=95?= =?UTF-8?q?=E3=81=9B=E3=82=8B=E3=81=AE=E3=81=AF=E5=95=8F=E9=A1=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=8C=E3=80=81entry=20widget=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=80=81=E4=BB=96=E3=81=AEwidget=E3=81=A0=E3=81=A8=E3=82=B9?= =?UTF-8?q?=E3=82=BF=E3=83=83=E3=82=AF=E3=81=97=E3=81=A6=EF=BC=9F=E9=81=85?= =?UTF-8?q?=E5=BB=B6=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E3=80=81=E3=81=A7=E3=81=8D=E3=82=8B=E3=81=AE=E3=81=AF?= =?UTF-8?q?=E4=BB=8A=E3=81=AE=E3=81=A8=E3=81=93=E3=82=8D=E3=81=93=E3=81=93?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 33 ++++++++++++++++++----- vrct_gui/ui_managers/ColorThemeManager.py | 3 ++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/view.py b/view.py index 2a309a06..1bebcfd4 100644 --- a/view.py +++ b/view.py @@ -743,24 +743,45 @@ class View(): self.view_variable.VAR_MIC_DEVICE.set(default_selected_mic_device_name) - @staticmethod - def updateSetProgressBar_MicEnergy(new_mic_energy): - vrct_gui.config_window.sb__progressbar_x_slider__progressbar_mic_energy_threshold.set(new_mic_energy/config.MAX_MIC_ENERGY_THRESHOLD) + def updateSetProgressBar_MicEnergy(self, new_mic_energy): + self.updateProgressBar( + target_progressbar_widget=vrct_gui.config_window.sb__progressbar_x_slider__progressbar_mic_energy_threshold, + new_energy=new_mic_energy, + max_energy=config.MAX_MIC_ENERGY_THRESHOLD, + energy_threshold=config.INPUT_MIC_ENERGY_THRESHOLD, + ) + @staticmethod def initProgressBar_MicEnergy(): vrct_gui.config_window.sb__progressbar_x_slider__progressbar_mic_energy_threshold.set(0) - @staticmethod - def updateSetProgressBar_SpeakerEnergy(new_speaker_energy): - vrct_gui.config_window.sb__progressbar_x_slider__progressbar_speaker_energy_threshold.set(new_speaker_energy/config.MAX_SPEAKER_ENERGY_THRESHOLD) + def updateSetProgressBar_SpeakerEnergy(self, new_speaker_energy): + self.updateProgressBar( + target_progressbar_widget=vrct_gui.config_window.sb__progressbar_x_slider__progressbar_speaker_energy_threshold, + new_energy=new_speaker_energy, + max_energy=config.MAX_SPEAKER_ENERGY_THRESHOLD, + energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD, + ) @staticmethod def initProgressBar_SpeakerEnergy(): vrct_gui.config_window.sb__progressbar_x_slider__progressbar_speaker_energy_threshold.set(0) + def updateProgressBar( + self, + target_progressbar_widget, + new_energy, + max_energy, + energy_threshold, + ): + target_progressbar_widget.set(new_energy/max_energy) + if new_energy >= energy_threshold: + target_progressbar_widget.configure(progress_color=self.settings.config_window.ctm.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_EXCEED_THRESHOLD_BG_COLOR) + else: + target_progressbar_widget.configure(progress_color=self.settings.config_window.ctm.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_BG_COLOR) diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index 19f9f884..30507698 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -301,7 +301,8 @@ class ColorThemeManager(): self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_BG_COLOR = self.DARK_800_COLOR - self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_BG_COLOR = self.PRIMARY_400_COLOR + self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_BG_COLOR = self.PRIMARY_750_COLOR + self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_EXCEED_THRESHOLD_BG_COLOR = self.PRIMARY_400_COLOR self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_COLOR = self.PRIMARY_600_COLOR self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_HOVERED_COLOR = self.PRIMARY_400_COLOR