[Update] Main Window: Message box. 送信したメッセージを、キーボード矢印キー上下で呼び出せるように。

This commit is contained in:
Sakamoto Shiina
2024-02-01 15:54:22 +09:00
parent 4ae35e51a9
commit 6fbc2ede3a
4 changed files with 64 additions and 0 deletions

View File

@@ -200,6 +200,8 @@ def stopThreadingTranscriptionReceiveMessageOnOpenConfigWindow():
# func message box
def sendChatMessage(message):
if len(message) > 0:
config.SENT_MESSAGES_LOG.append(view.getTextFromMessageBox())
config.CURRENT_SENT_MESSAGES_LOG_INDEX = len(config.SENT_MESSAGES_LOG)
translation = ""
if config.ENABLE_TRANSLATION is False:
pass
@@ -249,6 +251,25 @@ def messageBoxFocusOut(e):
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
model.oscStopSendTyping()
def updateMessageBox(index_offset):
if len(config.SENT_MESSAGES_LOG) == 0:
return
try:
new_index = config.CURRENT_SENT_MESSAGES_LOG_INDEX + index_offset
target_message_text = config.SENT_MESSAGES_LOG[new_index]
view.replaceMessageBox(target_message_text)
config.CURRENT_SENT_MESSAGES_LOG_INDEX = new_index
except IndexError:
pass
def messageBoxUpKeyPress():
if config.CURRENT_SENT_MESSAGES_LOG_INDEX > 0:
updateMessageBox(-1)
def messageBoxDownKeyPress():
if config.CURRENT_SENT_MESSAGES_LOG_INDEX < len(config.SENT_MESSAGES_LOG) - 1:
updateMessageBox(1)
def updateTranslationEngineAndEngineList():
engine = config.CHOICE_INPUT_TRANSLATOR
engines = model.findTranslationEngines(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
@@ -949,6 +970,8 @@ def createMainWindow(splash):
"message_box_bind_Any_KeyPress": messageBoxPressKeyAny,
"message_box_bind_FocusIn": messageBoxFocusIn,
"message_box_bind_FocusOut": messageBoxFocusOut,
"message_box_bind_Up_KeyPress": messageBoxUpKeyPress,
"message_box_bind_Down_KeyPress": messageBoxDownKeyPress,
},
config_window_registers={