From 4c0f356ee195955ff08df31ac34c33b8e81dccd3 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:58:33 +0900 Subject: [PATCH] [Chore] remove the code that is no longer in use. and fixed some comments. --- view.py | 13 +++++-------- vrct_gui/_printToTextbox.py | 28 ++-------------------------- vrct_gui/vrct_gui.py | 5 ++--- 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/view.py b/view.py index d1b8d688..2015937c 100644 --- a/view.py +++ b/view.py @@ -350,6 +350,7 @@ class View(): self.view_variable.CALLBACK_SET_OSC_IP_ADDRESS = config_window_registers.get("callback_set_osc_ip_address", None) self.view_variable.CALLBACK_SET_OSC_PORT = config_window_registers.get("callback_set_osc_port", None) + # Insert sample conversation for testing. # self._insertSampleConversationToTextbox() @@ -446,16 +447,15 @@ class View(): - def printToTextbox_SentMessage(self, original_message, translated_message, actual_sent_message=None): - self._printToTextbox_Sent(original_message, translated_message, actual_sent_message) + def printToTextbox_SentMessage(self, original_message, translated_message): + self._printToTextbox_Sent(original_message, translated_message) @staticmethod - def _printToTextbox_Sent(original_message, translated_message, actual_sent_message=None): + def _printToTextbox_Sent(original_message, translated_message): vrct_gui.printToTextbox( target_type="SENT", original_message=original_message, translated_message=translated_message, - actual_sent_message=actual_sent_message, ) @@ -628,7 +628,7 @@ class View(): - # These conversation is generated by ChatGPT + # These conversations are generated by ChatGPT def _insertSampleConversationToTextbox(self): self.printToTextbox_enableTranscriptionSend() @@ -738,10 +738,7 @@ class View(): ] for data in conversation_data: if data.get("me", None) is not None: - # actual_sent_message = config.MESSAGE_FORMAT.replace("[message]", data.get("me", None)) - # actual_sent_message = actual_sent_message.replace("[translation]", data.get("me_t", None)) self.printToTextbox_SentMessage(data.get("me", None), data.get("me_t", None)) - # self.printToTextbox_SentMessage(data.get("me", None), data.get("me_t", None), actual_sent_message) if data.get("target", None) is not None: self.printToTextbox_ReceivedMessage(data.get("target", None), data.get("target_t", None)) diff --git a/vrct_gui/_printToTextbox.py b/vrct_gui/_printToTextbox.py index 8854071f..cb732f81 100644 --- a/vrct_gui/_printToTextbox.py +++ b/vrct_gui/_printToTextbox.py @@ -1,7 +1,7 @@ from datetime import datetime from customtkinter import CTkFont -def _printToTextbox(vrct_gui, settings, target_type, original_message=None, translated_message=None, actual_sent_message=None, tags=None, disable_print_to_textbox_all:bool=False): +def _printToTextbox(vrct_gui, settings, target_type, original_message=None, translated_message=None, tags=None, disable_print_to_textbox_all:bool=False): now_raw_data = datetime.now() # now = now_raw_data.strftime("%H:%M:%S") now_hm = now_raw_data.strftime("%H:%M") @@ -72,8 +72,6 @@ def _printToTextbox(vrct_gui, settings, target_type, original_message=None, tran target_textbox.insert("end", original_message, ("SENT_SUB_TEXT", "SENT_SECONDARY_TEXT_FONT", "JUSTIFY_RIGHT")) target_textbox.insert("end", "\n") target_textbox.insert("end", translated_message, ("SENT_TEXT", "SENT_MAIN_TEXT_FONT", "JUSTIFY_RIGHT")) - # _actual_sent_message = "" if actual_sent_message is None else actual_sent_message - # target_textbox.insert("end", _actual_sent_message, ("SENT_TEXT", "SENT_MAIN_TEXT_FONT", "JUSTIFY_RIGHT")) else: target_textbox.insert("end", original_message, ("SENT_TEXT", "SENT_MAIN_TEXT_FONT", "JUSTIFY_RIGHT")) @@ -95,26 +93,4 @@ def _printToTextbox(vrct_gui, settings, target_type, original_message=None, tran printEachTextbox(target_textbox) # To automatically print the same log to the textbox_all widget as well. - if disable_print_to_textbox_all is not True: printEachTextbox(vrct_gui.textbox_all) - - - - # target_textbox.tag_config("ERROR", foreground="#FF0000") - - # target_textbox.tag_config("SYSTEM", justify="center") - # target_textbox.tag_config("SYSTEM_TAG", foreground="#1BFF00") - - # target_textbox.tag_config("SENT", justify="left") - # target_textbox.tag_config("SENT_COLOR", foreground="#0378e2") - - # target_textbox.tag_config("RECEIVED", justify="left") - # target_textbox.tag_config("RECEIVED_COLOR", foreground="#ffa500") - - - # target_textbox.configure(state="normal") - # target_textbox.insert("end", f"[{tags}] ", ("START", "LABEL", tags, f"{tags}_COLOR")) - # target_textbox.insert("end", f"{now_hm} ", ("TIMESTAMP", tags)) - # target_textbox.insert("end", f"{original_message}\n", ("SECONDARY_TEXT_FONT", "MAIN_TEXT_COLOR", tags)) - # target_textbox.insert("end", f"{translated_message}\n", ("MAIN_TEXT_FONT", "MAIN_TEXT_COLOR", tags)) - # target_textbox.configure(state="disabled") - # target_textbox.see("end") \ No newline at end of file + if disable_print_to_textbox_all is not True: printEachTextbox(vrct_gui.textbox_all) \ No newline at end of file diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index ea23f65b..25c67b57 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -14,7 +14,7 @@ from .main_window import createMainWindowWidgets from .config_window import ConfigWindow from .ui_utils import _setDefaultActiveTab -from .main_window.widgets import createSidebar, createMinimizeSidebarButton +from .main_window.widgets import createMinimizeSidebarButton class VRCT_GUI(CTk): @@ -125,14 +125,13 @@ class VRCT_GUI(CTk): target_names=target_names, ) - def printToTextbox(self, target_type, original_message=None, translated_message=None, actual_sent_message=None): + def printToTextbox(self, target_type, original_message=None, translated_message=None): _printToTextbox( vrct_gui=self, settings=self.settings.main, target_type=target_type, original_message=original_message, translated_message=translated_message, - actual_sent_message=actual_sent_message, tags=target_type, )