Merge branch 'add_rollback_sent_message_feature' into develop
This commit is contained in:
20
config.py
20
config.py
@@ -197,6 +197,24 @@ class Config:
|
|||||||
if value in list(translation_lang.keys()):
|
if value in list(translation_lang.keys()):
|
||||||
self._CHOICE_OUTPUT_TRANSLATOR = value
|
self._CHOICE_OUTPUT_TRANSLATOR = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def SENT_MESSAGES_LOG(self):
|
||||||
|
return self._SENT_MESSAGES_LOG
|
||||||
|
|
||||||
|
@SENT_MESSAGES_LOG.setter
|
||||||
|
def SENT_MESSAGES_LOG(self, value):
|
||||||
|
if isinstance(value, list):
|
||||||
|
self._SENT_MESSAGES_LOG = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def CURRENT_SENT_MESSAGES_LOG_INDEX(self):
|
||||||
|
return self._CURRENT_SENT_MESSAGES_LOG_INDEX
|
||||||
|
|
||||||
|
@CURRENT_SENT_MESSAGES_LOG_INDEX.setter
|
||||||
|
def CURRENT_SENT_MESSAGES_LOG_INDEX(self, value):
|
||||||
|
if isinstance(value, int):
|
||||||
|
self._CURRENT_SENT_MESSAGES_LOG_INDEX = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION(self):
|
def IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION(self):
|
||||||
return self._IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION
|
return self._IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION
|
||||||
@@ -770,6 +788,8 @@ class Config:
|
|||||||
self._SOURCE_COUNTRY = "Japan"
|
self._SOURCE_COUNTRY = "Japan"
|
||||||
self._TARGET_LANGUAGE = "English"
|
self._TARGET_LANGUAGE = "English"
|
||||||
self._TARGET_COUNTRY = "United States"
|
self._TARGET_COUNTRY = "United States"
|
||||||
|
self._SENT_MESSAGES_LOG = []
|
||||||
|
self._CURRENT_SENT_MESSAGES_LOG_INDEX = 0
|
||||||
self._IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
|
self._IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
|
||||||
|
|
||||||
# Save Json Data
|
# Save Json Data
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ def changeToCTranslate2Process():
|
|||||||
# func transcription send message
|
# func transcription send message
|
||||||
def sendMicMessage(message):
|
def sendMicMessage(message):
|
||||||
if len(message) > 0:
|
if len(message) > 0:
|
||||||
|
addSentMessageLog(message)
|
||||||
translation = ""
|
translation = ""
|
||||||
if model.checkKeywords(message):
|
if model.checkKeywords(message):
|
||||||
view.printToTextbox_DetectedByWordFilter(detected_message=message)
|
view.printToTextbox_DetectedByWordFilter(detected_message=message)
|
||||||
@@ -200,6 +201,7 @@ def stopThreadingTranscriptionReceiveMessageOnOpenConfigWindow():
|
|||||||
# func message box
|
# func message box
|
||||||
def sendChatMessage(message):
|
def sendChatMessage(message):
|
||||||
if len(message) > 0:
|
if len(message) > 0:
|
||||||
|
addSentMessageLog(message)
|
||||||
translation = ""
|
translation = ""
|
||||||
if config.ENABLE_TRANSLATION is False:
|
if config.ENABLE_TRANSLATION is False:
|
||||||
pass
|
pass
|
||||||
@@ -249,6 +251,29 @@ def messageBoxFocusOut(e):
|
|||||||
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
||||||
model.oscStopSendTyping()
|
model.oscStopSendTyping()
|
||||||
|
|
||||||
|
def addSentMessageLog(sent_message):
|
||||||
|
config.SENT_MESSAGES_LOG.append(sent_message)
|
||||||
|
config.CURRENT_SENT_MESSAGES_LOG_INDEX = len(config.SENT_MESSAGES_LOG)
|
||||||
|
|
||||||
|
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():
|
def updateTranslationEngineAndEngineList():
|
||||||
engine = config.CHOICE_INPUT_TRANSLATOR
|
engine = config.CHOICE_INPUT_TRANSLATOR
|
||||||
engines = model.findTranslationEngines(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
|
engines = model.findTranslationEngines(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
|
||||||
@@ -949,6 +974,8 @@ def createMainWindow(splash):
|
|||||||
"message_box_bind_Any_KeyPress": messageBoxPressKeyAny,
|
"message_box_bind_Any_KeyPress": messageBoxPressKeyAny,
|
||||||
"message_box_bind_FocusIn": messageBoxFocusIn,
|
"message_box_bind_FocusIn": messageBoxFocusIn,
|
||||||
"message_box_bind_FocusOut": messageBoxFocusOut,
|
"message_box_bind_FocusOut": messageBoxFocusOut,
|
||||||
|
"message_box_bind_Up_KeyPress": messageBoxUpKeyPress,
|
||||||
|
"message_box_bind_Down_KeyPress": messageBoxDownKeyPress,
|
||||||
},
|
},
|
||||||
|
|
||||||
config_window_registers={
|
config_window_registers={
|
||||||
|
|||||||
13
view.py
13
view.py
@@ -184,6 +184,8 @@ class View():
|
|||||||
VAR_UPDATE_AVAILABLE=StringVar(value=i18n.t("main_window.update_available")),
|
VAR_UPDATE_AVAILABLE=StringVar(value=i18n.t("main_window.update_available")),
|
||||||
|
|
||||||
|
|
||||||
|
CALLBACK_MESSAGE_BOX_BIND_KEYSYM__UP=None,
|
||||||
|
CALLBACK_MESSAGE_BOX_BIND_KEYSYM__DOWN=None,
|
||||||
# Main Window Cover
|
# Main Window Cover
|
||||||
VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE=StringVar(value=""),
|
VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE=StringVar(value=""),
|
||||||
|
|
||||||
@@ -562,6 +564,10 @@ class View():
|
|||||||
self.view_variable.CALLBACK_CLICKED_SEND_MESSAGE_BUTTON = pressedSendMessageButtonFunction
|
self.view_variable.CALLBACK_CLICKED_SEND_MESSAGE_BUTTON = pressedSendMessageButtonFunction
|
||||||
|
|
||||||
|
|
||||||
|
self.view_variable.CALLBACK_MESSAGE_BOX_BIND_KEYSYM__UP=main_window_registers.get("message_box_bind_Up_KeyPress")
|
||||||
|
self.view_variable.CALLBACK_MESSAGE_BOX_BIND_KEYSYM__DOWN=main_window_registers.get("message_box_bind_Down_KeyPress")
|
||||||
|
|
||||||
|
|
||||||
entry_message_box.bind("<FocusIn>", main_window_registers.get("message_box_bind_FocusIn"))
|
entry_message_box.bind("<FocusIn>", main_window_registers.get("message_box_bind_FocusIn"))
|
||||||
entry_message_box.bind("<FocusOut>", main_window_registers.get("message_box_bind_FocusOut"))
|
entry_message_box.bind("<FocusOut>", main_window_registers.get("message_box_bind_FocusOut"))
|
||||||
|
|
||||||
@@ -1637,6 +1643,13 @@ class View():
|
|||||||
def clearMessageBox(self):
|
def clearMessageBox(self):
|
||||||
self._clearTextBox(vrct_gui.entry_message_box)
|
self._clearTextBox(vrct_gui.entry_message_box)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def insertMessageBox(text):
|
||||||
|
vrct_gui.entry_message_box.insert("end", text)
|
||||||
|
|
||||||
|
def replaceMessageBox(self, text):
|
||||||
|
self.clearMessageBox()
|
||||||
|
self.insertMessageBox(text)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def createEntryMessageBox(settings, main_window, view_variable):
|
|||||||
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.TEXTBOX_ENTRY_FONT_SIZE, weight="normal"),
|
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.TEXTBOX_ENTRY_FONT_SIZE, weight="normal"),
|
||||||
undo=True,
|
undo=True,
|
||||||
autoseparators=True,
|
autoseparators=True,
|
||||||
maxundo=0,
|
maxundo=64,
|
||||||
)
|
)
|
||||||
main_window.entry_message_box.grid(row=0, column=0, padx=settings.uism.TEXTBOX_ENTRY_PADX, pady=settings.uism.TEXTBOX_ENTRY_PADY, sticky="nsew")
|
main_window.entry_message_box.grid(row=0, column=0, padx=settings.uism.TEXTBOX_ENTRY_PADX, pady=settings.uism.TEXTBOX_ENTRY_PADY, sticky="nsew")
|
||||||
|
|
||||||
@@ -31,6 +31,14 @@ def createEntryMessageBox(settings, main_window, view_variable):
|
|||||||
"Delete", "Select", "Up", "Down", "Next", "End", "Print",
|
"Delete", "Select", "Up", "Down", "Next", "End", "Print",
|
||||||
"Prior","Insert","Home", "Left", "Clear", "Right", "Linefeed"
|
"Prior","Insert","Home", "Left", "Clear", "Right", "Linefeed"
|
||||||
]
|
]
|
||||||
|
if e.keysym == "Up":
|
||||||
|
callFunctionIfCallable(view_variable.CALLBACK_MESSAGE_BOX_BIND_KEYSYM__UP)
|
||||||
|
return "break"
|
||||||
|
|
||||||
|
if e.keysym == "Down":
|
||||||
|
callFunctionIfCallable(view_variable.CALLBACK_MESSAGE_BOX_BIND_KEYSYM__DOWN)
|
||||||
|
return "break"
|
||||||
|
|
||||||
if e.keysym != "??":
|
if e.keysym != "??":
|
||||||
if len(e.char) != 0 and e.keysym in BREAK_KEYSYM_LIST:
|
if len(e.char) != 0 and e.keysym in BREAK_KEYSYM_LIST:
|
||||||
main_window.entry_message_box.insert("end", e.char)
|
main_window.entry_message_box.insert("end", e.char)
|
||||||
|
|||||||
Reference in New Issue
Block a user