From 9583203a350b4991365c22ac1a0e2abd54e112cc Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 6 Sep 2023 04:56:11 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor]=20view.py=E4=BB=A5=E4=B8=8B=E3=81=A7?= =?UTF-8?q?self=E4=BD=BF=E3=81=A3=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E9=96=A2=E6=95=B0=E3=81=AB@staticmethod?= =?UTF-8?q?=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC=E3=82=BF=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 57 ++++++++++++++++-------- vrct_gui/ui_managers/UiScalingManager.py | 3 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/view.py b/view.py index 49cbacf7..50bd8f8f 100644 --- a/view.py +++ b/view.py @@ -304,10 +304,12 @@ class View(): - def setMainWindowAllWidgetsStatusToNormal(self): + @staticmethod + def setMainWindowAllWidgetsStatusToNormal(): vrct_gui.changeMainWindowWidgetsStatus("normal", "All") - def setMainWindowAllWidgetsStatusToDisabled(self): + @staticmethod + def setMainWindowAllWidgetsStatusToDisabled(): vrct_gui.changeMainWindowWidgetsStatus("disabled", "All") @@ -321,10 +323,12 @@ class View(): self.foregroundOff() - def foregroundOn(self): + @staticmethod + def foregroundOn(): vrct_gui.attributes("-topmost", True) - def foregroundOff(self): + @staticmethod + def foregroundOff(): vrct_gui.attributes("-topmost", False) @@ -377,7 +381,8 @@ class View(): self._printToTextbox_Info(f"Detect WordFilter :{detected_message}") - def _printToTextbox_Info(self, info_message): + @staticmethod + def _printToTextbox_Info(info_message): vrct_gui.printToTextbox(vrct_gui.textbox_all, info_message, "", "INFO") vrct_gui.printToTextbox(vrct_gui.textbox_system, info_message, "", "INFO") @@ -386,7 +391,8 @@ class View(): def printToTextbox_SentMessage(self, original_message, translated_message): self._printToTextbox_Sent(original_message, translated_message) - def _printToTextbox_Sent(self, original_message, translated_message): + @staticmethod + def _printToTextbox_Sent(original_message, translated_message): vrct_gui.printToTextbox(vrct_gui.textbox_all, original_message, translated_message, "SEND") vrct_gui.printToTextbox(vrct_gui.textbox_sent, original_message, translated_message, "SEND") @@ -394,15 +400,18 @@ class View(): def printToTextbox_ReceivedMessage(self, original_message, translated_message): self._printToTextbox_Received(original_message, translated_message) - def _printToTextbox_Received(self, original_message, translated_message): + @staticmethod + def _printToTextbox_Received(original_message, translated_message): vrct_gui.printToTextbox(vrct_gui.textbox_all, original_message, translated_message, "RECEIVE") vrct_gui.printToTextbox(vrct_gui.textbox_received, original_message, translated_message, "RECEIVE") - def getTextFromMessageBox(self): + @staticmethod + def getTextFromMessageBox(): return vrct_gui.entry_message_box.get() - def clearMessageBox(self): + @staticmethod + def clearMessageBox(): vrct_gui.entry_message_box.delete(0, CTK_END) @staticmethod @@ -414,18 +423,22 @@ class View(): def createGUI(self): vrct_gui.createGUI(settings=self.settings, view_variable=self.view_variable) - def startMainLoop(self): + @staticmethod + def startMainLoop(): vrct_gui.startMainLoop() # Config Window - def setConfigWindowCompactModeSwitchStatusToDisabled(self): + @staticmethod + def setConfigWindowCompactModeSwitchStatusToDisabled(): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="disabled") - def setConfigWindowCompactModeSwitchStatusToNormal(self): + @staticmethod + def setConfigWindowCompactModeSwitchStatusToNormal(): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="normal") - def setConfigWindowThresholdCheckWidgetsStatusToDisabled(self): + @staticmethod + def setConfigWindowThresholdCheckWidgetsStatusToDisabled(): vrct_gui.changeConfigWindowWidgetsStatus( status="disabled", target_names=[ @@ -434,7 +447,8 @@ class View(): ] ) - def setConfigWindowThresholdCheckWidgetsStatusToNormal(self): + @staticmethod + def setConfigWindowThresholdCheckWidgetsStatusToNormal(): vrct_gui.changeConfigWindowWidgetsStatus( status="normal", target_names=[ @@ -443,27 +457,32 @@ class View(): ] ) - def replaceConfigWindowMicThresholdCheckButtonToActive(self): + @staticmethod + def replaceConfigWindowMicThresholdCheckButtonToActive(): 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() - def replaceConfigWindowMicThresholdCheckButtonToPassive(self): + @staticmethod + def replaceConfigWindowMicThresholdCheckButtonToPassive(): 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() - def replaceConfigWindowSpeakerThresholdCheckButtonToActive(self): + @staticmethod + def replaceConfigWindowSpeakerThresholdCheckButtonToActive(): 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() - def replaceConfigWindowSpeakerThresholdCheckButtonToPassive(self): + @staticmethod + def replaceConfigWindowSpeakerThresholdCheckButtonToPassive(): 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() - def reloadConfigWindowSettingBoxContainer(self): + @staticmethod + def reloadConfigWindowSettingBoxContainer(): vrct_gui.config_window.settings.IS_CONFIG_WINDOW_COMPACT_MODE = config.IS_CONFIG_WINDOW_COMPACT_MODE vrct_gui.config_window.reloadConfigWindowSettingBoxContainer() diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index cb8cec2a..06f5284f 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -180,5 +180,6 @@ class UiScalingManager(): size += 1 if not is_allowed_odd and size % 2 != 0 else 0 return size - def dupTuple(self, value): + @staticmethod + def dupTuple(value): return (value, value) \ No newline at end of file