From bd71a96ccb1a660b9c6b76f7fbfda72c10194adf Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 16 Oct 2023 12:34:41 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20Main=20Window:=20=E3=83=A1=E3=83=83?= =?UTF-8?q?=E3=82=BB=E3=83=BC=E3=82=B8=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9?= =?UTF-8?q?=E3=81=8B=E3=82=89=E3=83=95=E3=82=A9=E3=83=BC=E3=82=AB=E3=82=B9?= =?UTF-8?q?=E3=81=8C=E5=A4=96=E3=82=8C=E3=82=8B=E3=81=A8=E3=80=81VRChat?= =?UTF-8?q?=E4=B8=8A=E3=81=A7=E3=81=A7=E3=82=8B=E3=83=81=E3=83=A3=E3=83=83?= =?UTF-8?q?=E3=83=88=E5=85=A5=E5=8A=9B=E4=B8=AD=E3=82=92stop=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=82=20=E3=81=9D?= =?UTF-8?q?=E3=82=8C=E3=81=AB=E4=BC=B4=E3=81=A3=E3=81=A6focus=20in/out?= =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=82=92controller.py?= =?UTF-8?q?=E3=81=A7=E7=AE=A1=E7=90=86=E3=80=82=20[Refactor]=20=E9=96=A2?= =?UTF-8?q?=E6=95=B0=E5=90=8D=E3=82=92=E9=81=A9=E5=88=87=E3=81=AA=E5=90=8D?= =?UTF-8?q?=E5=89=8D=E3=81=B8=E5=A4=89=E6=9B=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 14 ++++++++++++-- view.py | 12 ++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/controller.py b/controller.py index e013a425..a53bdc0f 100644 --- a/controller.py +++ b/controller.py @@ -186,6 +186,14 @@ def messageBoxPressKeyAny(e): else: model.oscStopSendTyping() +def messageBoxFocusIn(e): + view.foregroundOffIfForegroundEnabled() + +def messageBoxFocusOut(e): + view.foregroundOnIfForegroundEnabled() + if config.ENABLE_SEND_MESSAGE_TO_VRC is True: + model.oscStopSendTyping() + # func select languages def initSetLanguageAndCountry(): select = config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO] @@ -642,8 +650,10 @@ def createMainWindow(): "values": model.getListLanguageAndCountry(), "callback_selected_language_preset_tab": callbackSelectedLanguagePresetTab, - "bind_Return": messageBoxPressKeyEnter, - "bind_Any_KeyPress": messageBoxPressKeyAny, + "message_box_bind_Return": messageBoxPressKeyEnter, + "message_box_bind_Any_KeyPress": messageBoxPressKeyAny, + "message_box_bind_FocusIn": messageBoxFocusIn, + "message_box_bind_FocusOut": messageBoxFocusOut, }, config_window_registers={ diff --git a/view.py b/view.py index a46018b0..27b38138 100644 --- a/view.py +++ b/view.py @@ -372,12 +372,12 @@ class View(): entry_message_box = getattr(vrct_gui, "entry_message_box") - entry_message_box.bind("", main_window_registers.get("bind_Return")) - entry_message_box.bind("", main_window_registers.get("bind_Any_KeyPress")) + entry_message_box.bind("", main_window_registers.get("message_box_bind_Return")) + entry_message_box.bind("", main_window_registers.get("message_box_bind_Any_KeyPress")) - entry_message_box.bind("", self._foregroundOffForcefully) - entry_message_box.bind("", self._foregroundOnForcefully) + entry_message_box.bind("", main_window_registers.get("message_box_bind_FocusIn")) + entry_message_box.bind("", main_window_registers.get("message_box_bind_FocusOut")) self.updateGuiVariableByPresetTabNo(config.SELECTED_TAB_NO) @@ -523,11 +523,11 @@ class View(): - def _foregroundOnForcefully(self, _e): + def foregroundOnIfForegroundEnabled(self): if config.ENABLE_FOREGROUND: self.foregroundOn() - def _foregroundOffForcefully(self, _e): + def foregroundOffIfForegroundEnabled(self): if config.ENABLE_FOREGROUND: self.foregroundOff()