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()