[Update] Main Window: Message box. 送信したメッセージを、キーボード矢印キー上下で呼び出せるように。
This commit is contained in:
@@ -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={
|
||||
|
||||
Reference in New Issue
Block a user