From 83fab83f5bdfa9cbae4a919cf208d1f919059a6b Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 6 Sep 2023 04:18:14 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Chore]=20=E9=96=A2=E6=95=B0=E5=90=8D?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=20updateConfigWindowTransparency=20->=20setM?= =?UTF-8?q?ainWindowTransparency=20=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=8B=E3=82=89CALLBACK=E3=81=A7=E5=91=BC=E3=81=B0=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E6=89=B1=E3=81=86=E9=96=A2=E6=95=B0=E3=81=A7=E3=81=AF?= =?UTF-8?q?=E3=81=82=E3=82=8B=E3=82=82=E3=81=AE=E3=81=AE=E3=80=81=E5=AE=9F?= =?UTF-8?q?=E9=9A=9B=E3=81=AB=E5=BD=B1=E9=9F=BF=E3=81=99=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=81=AF=E4=BB=8A=E3=81=AE=E3=81=A8=E3=81=93=E3=82=8D=E3=83=A1?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E7=94=BB=E9=9D=A2=E3=81=A0=E3=81=91=E3=81=AA?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E3=81=9D=E3=81=86=E3=81=84=E3=81=86=E6=84=8F?= =?UTF-8?q?=E5=91=B3=E3=81=A7=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=A8=E3=80=81?= =?UTF-8?q?=20view.py=E3=81=A7config=E3=81=8B=E3=82=89=E5=80=A4=E3=82=92?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=82=93=E3=81=A7=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=82=92=E3=80=81=E5=BC=95=E6=95=B0=E3=81=A7=E6=B8=A1?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=9D=E3=82=8C=E3=82=92=E3=81=9F=E3=81=A0?= =?UTF-8?q?=E3=82=BB=E3=83=83=E3=83=88=E3=81=99=E3=82=8B=E9=96=A2=E6=95=B0?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=E3=80=82=E3=81=9D=E3=81=AE=E3=81=9F?= =?UTF-8?q?=E3=82=81=E5=90=8D=E5=89=8D=E3=81=AFupdate=E3=81=A7=E3=81=AF?= =?UTF-8?q?=E3=81=AA=E3=81=8Fset=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- view.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 1f834b47..ea563ec2 100644 --- a/main.py +++ b/main.py @@ -222,7 +222,7 @@ def callbackDisableConfigWindowCompactMode(): def callbackSetTransparency(value): print("callbackSetTransparency", int(value)) config.TRANSPARENCY = int(value) - view.updateConfigWindowTransparency() + view.setMainWindowTransparency(config.TRANSPARENCY/100) def callbackSetAppearance(value): print("callbackSetAppearance", value) diff --git a/view.py b/view.py index 26cc8c35..49cbacf7 100644 --- a/view.py +++ b/view.py @@ -405,6 +405,9 @@ class View(): def clearMessageBox(self): vrct_gui.entry_message_box.delete(0, CTK_END) + @staticmethod + def setMainWindowTransparency(transparency:float): + vrct_gui.wm_attributes("-alpha", transparency) @@ -416,10 +419,6 @@ class View(): # Config Window - @staticmethod - def updateConfigWindowTransparency(): - vrct_gui.wm_attributes("-alpha", config.TRANSPARENCY/100) - def setConfigWindowCompactModeSwitchStatusToDisabled(self): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="disabled") 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 2/2] =?UTF-8?q?[Refactor]=20view.py=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E3=81=A7self=E4=BD=BF=E3=81=A3=E3=81=A6=E3=81=84=E3=81=AA?= =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=9F=E9=96=A2=E6=95=B0=E3=81=AB@staticme?= =?UTF-8?q?thod=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC=E3=82=BF=E8=BF=BD?= =?UTF-8?q?=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