From 76e86c64ab9e97ee3802ff682a7d0bf7337a517a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:25:49 +0900 Subject: [PATCH 01/43] =?UTF-8?q?[Chore/fix]=20Config=20Window:=20Appearan?= =?UTF-8?q?ce=20theme=20=E6=96=87=E8=A8=80=E4=BF=AE=E6=AD=A3(en)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.yml b/locales/en.yml index 802d61f5..b3613612 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -91,7 +91,7 @@ config_window: appearance_theme: label: Theme - desc: Change the color theme. Currently. + desc: Change the color theme. ui_size: label: UI Size From 74e28ca10125a6a85c906d2131cac5cd6c0ae6ed Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:33:31 +0900 Subject: [PATCH 02/43] [Refactor] Remove the code that is no longer in use. --- vrct_gui/_CreateConfirmationModal.py | 1 - .../createSideMenuAndSettingsBoxContainers.py | 1 - .../_SettingBoxGenerator.py | 104 ------------------ .../main_window/createMainWindowWidgets.py | 2 - vrct_gui/splash_window/SplashWindow.py | 1 - 5 files changed, 109 deletions(-) diff --git a/vrct_gui/_CreateConfirmationModal.py b/vrct_gui/_CreateConfirmationModal.py index 935f0447..09f55d64 100644 --- a/vrct_gui/_CreateConfirmationModal.py +++ b/vrct_gui/_CreateConfirmationModal.py @@ -70,7 +70,6 @@ class _CreateConfirmationModal(CTkToplevel): if modal_type == "information": - # self.modal_buttons_wrapper.grid_columnconfigure(1, weight=1, minsize=self.settings.uism.BUTTONS_BETWEEN_PADDING) self.modal_buttons_wrapper.grid_columnconfigure((0,2), weight=1) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index f9694a1a..da6f12ee 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -131,7 +131,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl config_window=config_window, settings=settings, view_variable=view_variable, - # view_variable=view_variable, side_menu_settings=sm_and_sbc_setting, side_menu_row=side_menu_row, all_side_menu_tab_attr_name=all_side_menu_tab_attr_name, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index d8b31a39..2786da6a 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -203,7 +203,6 @@ class _SettingBoxGenerator(): variable=variable, command=command, fg_color=self.settings.ctm.SB__SWITCH_BOX_BG_COLOR, - # bg_color="red", progress_color=self.settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR, button_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_COLOR, button_hover_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_HOVERED_COLOR, @@ -241,9 +240,6 @@ class _SettingBoxGenerator(): hover_color=self.settings.ctm.SB__CHECKBOX_HOVER_COLOR, checkmark_color=self.settings.ctm.SB__CHECKBOX_CHECKMARK_COLOR, fg_color=self.settings.ctm.SB__CHECKBOX_CHECKED_COLOR, - # fg_color=self.settings.ctm.SB__SWITCH_BOX_BG_COLOR, - # bg_color="red", - # progress_color=self.settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR, ) setattr(self.config_window, checkbox_attr_name, checkbox_widget) @@ -1077,106 +1073,6 @@ class _SettingBoxGenerator(): - - - # if setting_box_type == "dropdown_menu_x_dropdown_menu": - # self.setting_box_dropdown_menu_x_dropdown_menu = CTkFrame(self.setting_box, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) - # self.setting_box_dropdown_menu_x_dropdown_menu.grid(row=0, column=1, padx=(0, self.settings.uism.SB__RIGHT_PADX), rowspan=2, sticky="e") - - - - # # Labels - # self.optionmenu_label_left = CTkLabel( - # self.setting_box_dropdown_menu_x_dropdown_menu, - # text=kwargs["left_dropdown_menu_label"], - # font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"), - # ) - # self.optionmenu_label_left.grid(row=0, column=0) - - # self.the_space_between_optionmenu = CTkLabel( - # self.setting_box_dropdown_menu_x_dropdown_menu, - # text=None, - # ) - # self.the_space_between_optionmenu.grid(row=0, column=1) - - - # self.optionmenu_label_right = CTkLabel( - # self.setting_box_dropdown_menu_x_dropdown_menu, - # text=kwargs["right_dropdown_menu_label"], - # font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"), - # ) - # self.optionmenu_label_right.grid(row=0, column=2) - - - - # # Option menus - # self.createOption_DropdownMenu( - # setattr_obj, - # self.setting_box_dropdown_menu_x_dropdown_menu, - # kwargs["left_optionmenu_attr_name"], - # kwargs["left_dropdown_menu_attr_name"], - # dropdown_menu_values=kwargs["left_dropdown_menu_values"], - # width=150, - # command=kwargs["left_dropdown_menu_command"], - # variable=kwargs["left_dropdown_menu_variable"], - # ) - # getattr(setattr_obj, kwargs["left_optionmenu_attr_name"]).grid(row=1, column=0) - - - - # self.the_label_between_optionmenu = CTkLabel( - # self.setting_box_dropdown_menu_x_dropdown_menu, - # text="-->", - # # anchor="w", - # font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"), - # text_color=self.settings.ctm.LABELS_TEXT_COLOR - # ) - # self.the_label_between_optionmenu.grid(row=1, column=1, padx=self.settings.uism.SB__RIGHT_PADX/2) - - - # self.createOption_DropdownMenu( - # setattr_obj, - # self.setting_box_dropdown_menu_x_dropdown_menu, - # kwargs["right_optionmenu_attr_name"], - # kwargs["right_dropdown_menu_attr_name"], - # dropdown_menu_values=kwargs["right_dropdown_menu_values"], - # width=150, - # command=kwargs["right_dropdown_menu_command"], - # variable=kwargs["right_dropdown_menu_variable"], - # ) - # getattr(setattr_obj, kwargs["right_optionmenu_attr_name"]).grid(row=1, column=2) - - - - - # if setting_box_type == "radio_buttons": - # self.setting_box_radio_buttons_frame = CTkFrame(self.setting_box, corner_radius=0, width=0, height=0) - # self.setting_box_radio_buttons_frame.grid(row=0, column=1, padx=(0, self.settings.uism.SB__RIGHT_PADX), rowspan=2, sticky="e") - - # RADIO_BUTTON_RIGHT_PAD = 14 - # self.setting_box_radio_button_1 = CTkRadioButton( - # self.setting_box_radio_buttons_frame, - # text="lorem ipsum", - # font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__RADIO_BUTTON_FONT_SIZE, weight="normal") - # ) - # self.setting_box_radio_button_1.grid(row=0, column=0, padx=(0,RADIO_BUTTON_RIGHT_PAD), sticky="e") - - # self.setting_box_radio_button_2 = CTkRadioButton( - # self.setting_box_radio_buttons_frame, - # text="lorem ipsum", - # font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__RADIO_BUTTON_FONT_SIZE, weight="normal") - # ) - # self.setting_box_radio_button_2.grid(row=0, column=1, padx=(0,RADIO_BUTTON_RIGHT_PAD), sticky="e") - - # self.setting_box_radio_button_3 = CTkRadioButton( - # self.setting_box_radio_buttons_frame, - # text="lorem ipsum", - # font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__RADIO_BUTTON_FONT_SIZE, weight="normal") - # ) - # self.setting_box_radio_button_3.grid(row=0, column=2, padx=(0,RADIO_BUTTON_RIGHT_PAD), sticky="e") - - - def _createPassiveButtonForProgressbarXSlider(self, setting_box_progressbar_x_slider_frame, button_command, button_image_file): button_wrapper = createButtonWithImage( parent_widget=setting_box_progressbar_x_slider_frame, diff --git a/vrct_gui/main_window/createMainWindowWidgets.py b/vrct_gui/main_window/createMainWindowWidgets.py index 54ce6a6a..8e8c96b6 100644 --- a/vrct_gui/main_window/createMainWindowWidgets.py +++ b/vrct_gui/main_window/createMainWindowWidgets.py @@ -11,13 +11,11 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable): vrct_gui.iconbitmap(getImagePath("vrct_logo_mark_black.ico")) vrct_gui.title("VRCT") - # vrct_gui.minsize(200, 200) # Main Container vrct_gui.grid_columnconfigure(0, weight=1) vrct_gui.grid_rowconfigure(0, weight=1) - # vrct_gui.grid_columnconfigure(0, weight=1, minsize=settings.uism.MAIN_AREA_MIN_WIDTH) vrct_gui.configure(fg_color=settings.ctm.MAIN_BG_COLOR) diff --git a/vrct_gui/splash_window/SplashWindow.py b/vrct_gui/splash_window/SplashWindow.py index 96537c5e..2a2db684 100644 --- a/vrct_gui/splash_window/SplashWindow.py +++ b/vrct_gui/splash_window/SplashWindow.py @@ -12,7 +12,6 @@ class SplashWindow(CTkToplevel): sw=self.winfo_screenwidth() - # sh=self.winfo_screenheight() pw=int(sw/4) From 80940fccb2efe8ace80242f8a3c560d20db935b2 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 10 Nov 2023 17:52:25 +0900 Subject: [PATCH 03/43] =?UTF-8?q?[Update]=20cmd=E3=81=8B=E3=82=89=E3=81=AE?= =?UTF-8?q?exe=E8=B5=B7=E5=8B=95=E6=99=82=E3=81=AA=E3=81=A9=E3=81=AB?= =?UTF-8?q?=E3=80=81=E5=BC=95=E6=95=B0=E3=81=A8=E3=81=97=E3=81=A6osc=20por?= =?UTF-8?q?t=E3=81=A8ip=20address=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=8C?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 14 ++++++++++++++ view.py | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/controller.py b/controller.py index d7bdc414..2e254997 100644 --- a/controller.py +++ b/controller.py @@ -6,6 +6,7 @@ from model import model from view import view from utils import get_key_by_value, isUniqueStrings from languages import selectable_languages +import argparse # Common def callbackUpdateSoftware(): @@ -684,11 +685,24 @@ def callbackSetOscPort(value): print("callbackSetOscPort", int(value)) config.OSC_PORT = int(value) +def initSetConfigByExeArguments(): + parser = argparse.ArgumentParser() + parser.add_argument("--ip") + parser.add_argument("--port") + args = parser.parse_args() + if args.ip is not None: + config.OSC_IP_ADDRESS = str(args.ip) + view.setGuiVariable_OscIpAddress(config.OSC_IP_ADDRESS) + if args.port is not None: + config.OSC_PORT = int(args.port) + view.setGuiVariable_OscPort(config.OSC_PORT) + def createMainWindow(): # create GUI view.createGUI() # init config + initSetConfigByExeArguments() initSetLanguageAndCountry() if model.authenticationTranslator(config.CHOICE_TRANSLATOR, config.AUTH_KEYS[config.CHOICE_TRANSLATOR]) is False: diff --git a/view.py b/view.py index de8b66f1..9b673a03 100644 --- a/view.py +++ b/view.py @@ -1096,7 +1096,11 @@ class View(): self.view_variable.VAR_SPEAKER_MAX_PHRASES.set(str(value)) + def setGuiVariable_OscIpAddress(self, value): + self.view_variable.VAR_OSC_IP_ADDRESS.set(str(value)) + def setGuiVariable_OscPort(self, value): + self.view_variable.VAR_OSC_PORT.set(int(value)) From ad7080438f282d899370f75e34d499a848fe9cd3 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 14 Nov 2023 12:04:46 +0900 Subject: [PATCH 04/43] =?UTF-8?q?=E2=9E=95[Add]=20=E4=BB=AE=E6=83=B3?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E3=81=AEvenv=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- venv.bat | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 venv.bat diff --git a/.gitignore b/.gitignore index 678a4536..0d95c681 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ config.json memo.txt VRCT.spec *.pyc -logs/ \ No newline at end of file +logs/ +.venv/ \ No newline at end of file diff --git a/venv.bat b/venv.bat new file mode 100644 index 00000000..0a00ad7a --- /dev/null +++ b/venv.bat @@ -0,0 +1,2 @@ +python -m venv .venv +.venv\Scripts\activate.bat \ No newline at end of file From 60d4e2ad52292b2aab84dfe4ad36c809909bd52d Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 18 Nov 2023 16:00:38 +0900 Subject: [PATCH 05/43] =?UTF-8?q?=F0=9F=91=8D[Update]=20Readme=20:=20?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=AF=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.jp.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.jp.md b/README.jp.md index 586912c5..51328196 100644 --- a/README.jp.md +++ b/README.jp.md @@ -58,7 +58,7 @@ VRCTはあなたの会話を以下でサポートをします。 - [みしゃ(misyaguzi)](https://github.com/misyaguziya) (メイン開発) - [しいな(Shiina_12siy)](https://twitter.com/Shiina_12siy) (UI/UX, UI多言語対応) - [レラ](https://github.com/soumt-r) (翻訳:韓国語) -- [どね]() (ロゴデザイン) +- [どね](https://twitter.com/done_vrc) (ロゴデザイン) --- diff --git a/README.md b/README.md index 39faab7f..5892ce75 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Initial setup, basic functions, and other features are also described. - [みしゃ(misyaguzi)](https://github.com/misyaguziya) (Main Development) - [しいな(Shiina_12siy)](https://twitter.com/Shiina_12siy) (UI/UX, UI multilingual support) - [レラ](https://github.com/soumt-r) (Translation:Korean) -- [どね]() (Logo Design) +- [どね](https://twitter.com/done_vrc) (Logo Design) --- From 89b8a47a76feecf539bd76b1cd829c896db8a4cc Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 23 Nov 2023 00:15:57 +0900 Subject: [PATCH 06/43] =?UTF-8?q?[Update]=20Speaker2Chatbox=20UI=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 31 ++++++ controller.py | 22 +++++ locales/en.yml | 11 +++ view.py | 98 +++++++++++++++++++ .../createSideMenuAndSettingsBoxContainers.py | 3 +- .../_SettingBoxGenerator.py | 16 +-- .../setting_box_others/__init__.py | 3 +- .../createSettingBox_Others.py | 5 + .../createSettingBox_Others_Additional.py | 56 +++++++++++ 9 files changed, 235 insertions(+), 10 deletions(-) create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py diff --git a/config.py b/config.py index b594a1b0..83de5f21 100644 --- a/config.py +++ b/config.py @@ -505,6 +505,35 @@ class Config: # self._STARTUP_OSC_ENABLED_CHECK = value # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + # Speaker2Chatbox------------------ + @property + @json_serializable('RECEIVED_MESSAGE_FORMAT') + def RECEIVED_MESSAGE_FORMAT(self): + return self._RECEIVED_MESSAGE_FORMAT + + @RECEIVED_MESSAGE_FORMAT.setter + def RECEIVED_MESSAGE_FORMAT(self, value): + if isinstance(value, str): + if isUniqueStrings(["[message]", "[translation]"], value) is False: + value = "[message]([translation])" + self._RECEIVED_MESSAGE_FORMAT = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + + @property + @json_serializable('ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC') + def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self): + return self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC + + @ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC.setter + def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self, value): + if isinstance(value, bool): + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + + # Speaker2Chatbox------------------ + + + @property @json_serializable('ENABLE_LOGGER') def ENABLE_LOGGER(self): @@ -595,9 +624,11 @@ class Config: "Google": None, } self._MESSAGE_FORMAT = "[message]([translation])" + self._RECEIVED_MESSAGE_FORMAT = "[message]([translation])" # speaker2Chatbox self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_SEND_MESSAGE_TO_VRC = True + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # speaker2Chatbox # self._STARTUP_OSC_ENABLED_CHECK = True # [deprecated] self._ENABLE_LOGGER = False self._IS_CONFIG_WINDOW_COMPACT_MODE = False diff --git a/controller.py b/controller.py index d7bdc414..127fa8b3 100644 --- a/controller.py +++ b/controller.py @@ -671,6 +671,24 @@ def callbackSetEnableSendMessageToVrc(value): # print("callbackSetStartupOscEnabledCheck", value) # config.STARTUP_OSC_ENABLED_CHECK = value +# ---------------------Speaker2Chatbox--------------------- +def callbackSetReceivedMessageFormat(value): + print("callbackSetReceivedMessageFormat", value) + if len(value) > 0: + if isUniqueStrings(["[message]", "[translation]"], value) is True: + config.RECEIVED_MESSAGE_FORMAT = value + view.clearErrorMessage() + view.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + else: + view.showErrorMessage_ReceivedMessageFormat() + view.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + +def callbackSetEnableSendReceivedMessageToVrc(value): + print("callbackSetEnableSendReceivedMessageToVrc", value) + config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value +# ---------------------Speaker2Chatbox--------------------- + + # Advanced Settings Tab def callbackSetOscIpAddress(value): if value == "": @@ -794,6 +812,10 @@ def createMainWindow(): "callback_set_message_format": callbackSetMessageFormat, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, # "callback_set_startup_osc_enabled_check": callbackSetStartupOscEnabledCheck, # [deprecated] + # Speaker2Chatbox---------------- + "callback_set_received_message_format": callbackSetReceivedMessageFormat, + "callback_set_enable_send_received_message_to_vrc": callbackSetEnableSendReceivedMessageToVrc, + # Speaker2Chatbox---------------- # Advanced Settings Tab "callback_set_osc_ip_address": callbackSetOscIpAddress, diff --git a/locales/en.yml b/locales/en.yml index 802d61f5..f8d4107e 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -82,6 +82,7 @@ config_window: transcription_mic: Mic transcription_speaker: Speaker others: Others + others_speaker2chatbox: Speaker2Chatbox advanced_settings: Advanced Settings @@ -189,6 +190,16 @@ config_window: label: Send Message To VRChat desc: There is a way to use it without sending messages to VRChat, but it is not supported. Enable this feature when you intend to send a message to VRChat. + # Speaker2Chatbox + received_message_format: + label: Message Format (Speaker2Chatbox) + example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. + error_message: "The characters '[message]' and '[translation]' cannot be used." + + send_received_message_to_vrc: + label: Send Received Message To VRChat + # Speaker2Chatbox + osc_ip_address: label: OSC IP Address diff --git a/view.py b/view.py index de8b66f1..83160f38 100644 --- a/view.py +++ b/view.py @@ -373,6 +373,32 @@ class View(): + # -------------------Speaker2Chatbox----------- + VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX=StringVar(value=i18n.t("config_window.side_menu_labels.others_speaker2chatbox")), + + + VAR_LABEL_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.label")), + VAR_DESC_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.desc")), + CALLBACK_SET_RECEIVED_MESSAGE_FORMAT=None, + CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_REQUIRED_TEXT=self._swapReceivedMessageFormatRequiredText, + VAR_RECEIVED_MESSAGE_FORMAT=StringVar(value=config.RECEIVED_MESSAGE_FORMAT), + VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), + VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), + VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), + VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), + VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT=StringVar(value="[message]"), + VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT=StringVar(value="[translation]"), + CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT=self.callbackBindFocusOut_ReceivedMessageFormat, + + + VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.label")), + VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.desc")), + CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=None, + VAR_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=BooleanVar(value=config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC), + # -------------------Speaker2Chatbox----------- + + + # Advanced Settings Tab VAR_LABEL_OSC_IP_ADDRESS=StringVar(value=i18n.t("config_window.osc_ip_address.label")), VAR_DESC_OSC_IP_ADDRESS=None, @@ -501,6 +527,13 @@ class View(): self.view_variable.CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_message_to_vrc", None) # self.view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK = config_window_registers.get("callback_set_startup_osc_enabled_check", None) #[deprecated] + + self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT = config_window_registers.get("callback_set_received_message_format", None) + + self.view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_received_message_to_vrc", None) + + + # Advanced Settings Tab 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) @@ -540,6 +573,7 @@ class View(): self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) + self.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) # Insert sample conversation for testing. # self._insertSampleConversationToTextbox() @@ -590,6 +624,57 @@ class View(): self.view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT.set(example_message) + +# Speaker2Chatbox---------------------------- + def setReceivedMessageFormatEntryWidgets(self, message_format:str): + result = self.extractMessageFormat(message_format) + + if result.is_message_first is True: + self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set("[message]") + self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set("[translation]") + else: + self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set("[translation]") + self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set("[message]") + + self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.set(result.before) + self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.set(result.between) + self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT.set(result.after) + self.updateReceivedMessageFormat_ExampleTextWidget() + + def _swapReceivedMessageFormatRequiredText(self): + text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.get() + text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.get() + self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set(text_1) + self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set(text_0) + self.updateReceivedMessageFormat_ExampleTextWidget() + + new_message_format = self.getLatestReceivedMessageFormatFromWidget() + callFunctionIfCallable(self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, new_message_format) + + + def getLatestReceivedMessageFormatFromWidget(self): + text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.get() + text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.get() + entry_0 = self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.get() + entry_1 = self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.get() + entry_2 = self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT.get() + return entry_0+text_0+entry_1+text_1+entry_2 + + def updateReceivedMessageFormat_ExampleTextWidget(self): + message = i18n.t("config_window.message_format.example_text", locale=config.UI_LANGUAGE) + translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en" + translation = i18n.t("config_window.message_format.example_text", locale=translation_locale) + + example_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) + example_message = example_message.replace("[translation]", translation) + + self.view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT.set(example_message) +# Speaker2Chatbox---------------------------- + + + + + # GUI process def createGUI(self): vrct_gui._createGUI(settings=self.settings, view_variable=self.view_variable) @@ -1124,6 +1209,8 @@ class View(): case "MessageFormat": self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) + case "ReceivedMessageFormat": + self.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) case _: raise ValueError(f"No matching case for target_name: {target_name}") @@ -1278,6 +1365,10 @@ class View(): self.setLatestConfigVariable("MessageFormat") self.clearErrorMessage() + def callbackBindFocusOut_ReceivedMessageFormat(self, _e=None): + self.setLatestConfigVariable("ReceivedMessageFormat") + self.clearErrorMessage() + @@ -1365,6 +1456,13 @@ class View(): self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message")) ) + def showErrorMessage_ReceivedMessageFormat(self): + self._showErrorMessage( + vrct_gui.config_window.sb__entry_received_message_format_2, + self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message")) + ) + + @staticmethod def _makeInvalidValueErrorMessage(error_message): return i18n.t("config_window.common_error_message.invalid_value") + "\n" + error_message diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index f9694a1a..3ceb6689 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -8,7 +8,7 @@ from ._createSettingBoxContainer import _createSettingBoxContainer from .setting_box_containers.setting_box_appearance import createSettingBox_Appearance from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker -from .setting_box_containers.setting_box_others import createSettingBox_Others +from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_Additional from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings from .setting_box_containers.setting_box_translation import createSettingBox_Translation @@ -106,6 +106,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl "setting_box_container_attr_name": "setting_box_container_others", "setting_boxes": [ { "var_section_title": None, "setting_box": createSettingBox_Others }, + { "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX, "setting_box": createSettingBox_Others_Additional }, ] }, }, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index d8b31a39..31395f53 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -109,8 +109,9 @@ class _SettingBoxGenerator(): def createSettingBox_Labels( self, - for_var_label_text, for_var_desc_text, + for_var_label_text, labels_attr_name, + for_var_desc_text=None, ): setting_box_frame= self._createSettingBoxFrame(labels_attr_name, for_var_label_text, for_var_desc_text, expand_label_frame=True) @@ -217,10 +218,11 @@ class _SettingBoxGenerator(): def createSettingBoxCheckbox(self, - for_var_label_text, for_var_desc_text, + for_var_label_text, checkbox_attr_name, command, variable, + for_var_desc_text=None, ): (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(checkbox_attr_name, for_var_label_text, for_var_desc_text) @@ -547,6 +549,8 @@ class _SettingBoxGenerator(): entry_textvariable_2, textvariable_0, textvariable_1, + example_label_textvariable, + swap_button_command, entry_bind__Any_KeyRelease, entry_bind__FocusOut=None, ): @@ -581,7 +585,7 @@ class _SettingBoxGenerator(): example_frame_widget.grid_columnconfigure((0,2), weight=1) example_label_widget = CTkLabel( example_frame_widget, - textvariable=self.view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT, + textvariable=example_label_textvariable, anchor="center", justify="center", wraplength=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_WRAP_LENGTH, @@ -717,10 +721,6 @@ class _SettingBoxGenerator(): ) swap_button_label_1.grid(row=1, column=3) - - def adjustedCommand(): - callFunctionIfCallable(self.view_variable.CALLBACK_SWAP_MESSAGE_FORMAT_REQUIRED_TEXT) - bindButtonFunctionAndColor( target_widgets=[ swap_button, @@ -732,7 +732,7 @@ class _SettingBoxGenerator(): enter_color=self.settings.ctm.SB__MESSAGE_FORMAT__SWAP_BUTTON_HOVERED_COLOR, leave_color=self.settings.ctm.SB__MESSAGE_FORMAT__SWAP_BUTTON_COLOR, clicked_color=self.settings.ctm.SB__MESSAGE_FORMAT__SWAP_BUTTON_CLICKED_COLOR, - buttonReleasedFunction=lambda _e: adjustedCommand(), + buttonReleasedFunction=swap_button_command, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py index c115d627..98b0af6d 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py @@ -1 +1,2 @@ -from .createSettingBox_Others import createSettingBox_Others \ No newline at end of file +from .createSettingBox_Others import createSettingBox_Others +from .createSettingBox_Others_Additional import createSettingBox_Others_Additional \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index 161e4bfc..1ef60c05 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -33,6 +33,9 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v def entry_message_format_callback(value): callFunctionIfCallable(view_variable.CALLBACK_SET_MESSAGE_FORMAT, value) + def entry_swap_message_format_callback(_e): + callFunctionIfCallable(view_variable.CALLBACK_SWAP_MESSAGE_FORMAT_REQUIRED_TEXT) + row=0 config_window.sb__auto_clear_message_box = createSettingBoxCheckbox( @@ -85,7 +88,9 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v entry_textvariable_2=view_variable.VAR_ENTRY_2_MESSAGE_FORMAT, textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT, textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT, + example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT, entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value), + swap_button_command=entry_swap_message_format_callback, # entry_textvariable=view_variable.VAR_MESSAGE_FORMAT, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_MESSAGE_FORMAT, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py new file mode 100644 index 00000000..c7ba864d --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py @@ -0,0 +1,56 @@ +from utils import callFunctionIfCallable + +from .._SettingBoxGenerator import _SettingBoxGenerator + +def createSettingBox_Others_Additional(setting_box_wrapper, config_window, settings, view_variable): + sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) + createSettingBoxCheckbox = sbg.createSettingBoxCheckbox + createSettingBox_Labels = sbg.createSettingBox_Labels + createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries + + + def checkbox_enable_send_received_message_to_vrc_callback(checkbox_box_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, checkbox_box_widget.get()) + + def entry_received_message_format_callback(value): + callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, value) + + def entry_swap_received_message_format_callback(_e): + callFunctionIfCallable(view_variable.CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_REQUIRED_TEXT) + + row=0 + config_window.sb__received_message_format_labels = createSettingBox_Labels( + for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT, + # for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT, + labels_attr_name="sb__labels_message_format", + ) + config_window.sb__received_message_format_labels.grid(row=row, pady=0) + row+=1 + + config_window.sb__received_message_format = createSettingBoxMessageFormatEntries( + base_entry_attr_name="sb__entry_received_message_format", + # entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150, + entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT, + entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT, + entry_textvariable_2=view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT, + textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT, + textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT, + example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT, + entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_callback(value), + swap_button_command=entry_swap_received_message_format_callback, + # entry_textvariable=view_variable.VAR_RECEIVED_MESSAGE_FORMAT, + entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT, + ) + config_window.sb__received_message_format.grid(row=row) + row+=1 + + + config_window.sb__enable_send_received_message_to_vrc = createSettingBoxCheckbox( + for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, + # for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, + checkbox_attr_name="sb__checkbox_enable_send_received_message_to_vrc", + command=lambda: checkbox_enable_send_received_message_to_vrc_callback(config_window.sb__checkbox_enable_send_received_message_to_vrc), + variable=view_variable.VAR_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, + ) + config_window.sb__enable_send_received_message_to_vrc.grid(row=row, pady=0) + row+=1 \ No newline at end of file From 5d0db4a8fa9d3947e735556a14679741d92c19b1 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 23 Nov 2023 00:41:05 +0900 Subject: [PATCH 07/43] =?UTF-8?q?[Update]=20=E6=A9=9F=E8=83=BD=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/controller.py b/controller.py index 127fa8b3..e436e2ef 100644 --- a/controller.py +++ b/controller.py @@ -111,6 +111,17 @@ def receiveSpeakerMessage(message): xsoverlay_message = message model.notificationXSOverlay(xsoverlay_message) + # ------------Speaker2Chatbox------------ + # send OSC message + if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: + if len(translation) > 0: + osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) + osc_message = osc_message.replace("[translation]", translation) + else: + osc_message = message + model.oscSendMessage(osc_message) + # ------------Speaker2Chatbox------------ + # update textbox message log (Received) view.printToTextbox_ReceivedMessage(message, translation) if config.ENABLE_LOGGER is True: From 1b6074c60bf6daab459ca7599fbd8052e9c963f6 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Thu, 23 Nov 2023 16:13:20 +0900 Subject: [PATCH 08/43] =?UTF-8?q?=F0=9F=91=8D[Update]=20venv=20:=20?= =?UTF-8?q?=E8=B5=B7=E5=8B=95=E3=83=91=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- venv.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/venv.bat b/venv.bat index 0a00ad7a..21f16485 100644 --- a/venv.bat +++ b/venv.bat @@ -1,2 +1,2 @@ python -m venv .venv -.venv\Scripts\activate.bat \ No newline at end of file +.venv/Scripts/Activate.ps1 \ No newline at end of file From 0d7642f7272077fe1005a2b0f58718453a0d2d39 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 25 Nov 2023 22:40:37 +0900 Subject: [PATCH 09/43] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Controller=20:=20R?= =?UTF-8?q?eceive=E3=82=92OSC=E3=81=A7=E9=80=81=E4=BF=A1=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E4=BB=A5=E5=A4=96=E3=81=A7Receive=E3=81=8Clo?= =?UTF-8?q?g=E3=81=AB=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/controller.py b/controller.py index e436e2ef..60345db8 100644 --- a/controller.py +++ b/controller.py @@ -111,16 +111,16 @@ def receiveSpeakerMessage(message): xsoverlay_message = message model.notificationXSOverlay(xsoverlay_message) - # ------------Speaker2Chatbox------------ - # send OSC message - if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: - if len(translation) > 0: - osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) - osc_message = osc_message.replace("[translation]", translation) - else: - osc_message = message - model.oscSendMessage(osc_message) - # ------------Speaker2Chatbox------------ + # ------------Speaker2Chatbox------------ + # send OSC message + if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: + if len(translation) > 0: + osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) + osc_message = osc_message.replace("[translation]", translation) + else: + osc_message = message + model.oscSendMessage(osc_message) + # ------------Speaker2Chatbox------------ # update textbox message log (Received) view.printToTextbox_ReceivedMessage(message, translation) From f34abbe184f1914574dd87842ba66b4cab570e62 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:31:34 +0900 Subject: [PATCH 10/43] =?UTF-8?q?[Update/Refactor]=20Add=20Message=20Forma?= =?UTF-8?q?ts=20Features=20more.=20UI=E3=81=A8=E3=81=97=E3=81=A6=E3=81=AE?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E8=BF=BD=E5=8A=A0=E3=81=A8?= =?UTF-8?q?=E3=80=81config.json=E3=81=B8=E3=81=AE=E6=9B=B8=E3=81=8D?= =?UTF-8?q?=E8=BE=BC=E3=81=BF=E3=81=BE=E3=81=A7=E3=80=82=20=E9=80=81?= =?UTF-8?q?=E4=BF=A1=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=A8?= =?UTF-8?q?=E3=80=81=E5=8F=97=E4=BF=A1=E3=81=97=E3=81=9F=E3=83=A1=E3=83=83?= =?UTF-8?q?=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E9=80=81=E4=BF=A1=E3=81=99?= =?UTF-8?q?=E3=82=8B=E9=9A=9B=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83=E3=83=88?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E8=BF=BD=E5=8A=A0=E3=80=82?= =?UTF-8?q?=E3=81=BE=E3=81=9F=E3=80=81=E7=BF=BB=E8=A8=B3=E4=BB=98=E3=81=8D?= =?UTF-8?q?=E3=81=A8=E3=81=9D=E3=81=86=E3=81=98=E3=82=83=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83=E3=83=88?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=80=82=20=E3=81=9D=E3=82=8C=E3=81=AB=E4=BC=B4=E3=81=84?= =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E3=81=AA=E3=81=A9=E3=80=82=20=E2=80=BBconfig.json?= =?UTF-8?q?=E3=81=AEMESSAGE=5FFORMAT=E9=A0=85=E7=9B=AE=E3=81=AF=E6=B6=88?= =?UTF-8?q?=E3=81=88=E3=81=BE=E3=81=99=E3=80=82=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=81=8C=E5=85=83=E3=80=85=E8=A8=AD=E5=AE=9A=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=9F=E3=83=87=E3=83=BC=E3=82=BF=E3=81=AF?= =?UTF-8?q?=E4=BB=8A=E3=81=AE=E3=81=A8=E3=81=93=E3=82=8D=E5=BC=95=E3=81=8D?= =?UTF-8?q?=E7=B6=99=E3=81=92=E3=81=AA=E3=81=84=E7=8A=B6=E6=85=8B=E3=81=A7?= =?UTF-8?q?=E3=81=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 67 ++-- controller.py | 56 +++- locales/en.yml | 37 ++- locales/ja.yml | 32 +- locales/ko.yml | 2 +- view.py | 290 ++++++++++++------ .../createSideMenuAndSettingsBoxContainers.py | 4 +- .../_SettingBoxGenerator.py | 115 ++++++- .../setting_box_others/__init__.py | 2 + .../createSettingBox_Others.py | 35 +-- .../createSettingBox_Others_Additional.py | 34 -- ...ettingBox_Others_ReceivedMessageFormats.py | 65 ++++ ...ateSettingBox_Others_SendMessageFormats.py | 66 ++++ 13 files changed, 584 insertions(+), 221 deletions(-) create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_ReceivedMessageFormats.py create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_SendMessageFormats.py diff --git a/config.py b/config.py index 83de5f21..4477be25 100644 --- a/config.py +++ b/config.py @@ -447,19 +447,6 @@ class Config: self._AUTH_KEYS[key] = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.AUTH_KEYS) - @property - @json_serializable('MESSAGE_FORMAT') - def MESSAGE_FORMAT(self): - return self._MESSAGE_FORMAT - - @MESSAGE_FORMAT.setter - def MESSAGE_FORMAT(self, value): - if isinstance(value, str): - if isUniqueStrings(["[message]", "[translation]"], value) is False: - value = "[message]([translation])" - self._MESSAGE_FORMAT = value - saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) - @property @json_serializable('ENABLE_AUTO_CLEAR_MESSAGE_BOX') def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self): @@ -505,7 +492,32 @@ class Config: # self._STARTUP_OSC_ENABLED_CHECK = value # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) - # Speaker2Chatbox------------------ + @property + @json_serializable('SEND_MESSAGE_FORMAT') + def SEND_MESSAGE_FORMAT(self): + return self._SEND_MESSAGE_FORMAT + + @SEND_MESSAGE_FORMAT.setter + def SEND_MESSAGE_FORMAT(self, value): + if isinstance(value, str): + if isUniqueStrings(["[message]"], value) is False: + value = "[message]" + self._SEND_MESSAGE_FORMAT = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + + @property + @json_serializable('SEND_MESSAGE_FORMAT_WITH_T') + def SEND_MESSAGE_FORMAT_WITH_T(self): + return self._SEND_MESSAGE_FORMAT_WITH_T + + @SEND_MESSAGE_FORMAT_WITH_T.setter + def SEND_MESSAGE_FORMAT_WITH_T(self, value): + if isinstance(value, str): + if isUniqueStrings(["[message]", "[translation]"], value) is False: + value = "[message]([translation])" + self._SEND_MESSAGE_FORMAT_WITH_T = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property @json_serializable('RECEIVED_MESSAGE_FORMAT') def RECEIVED_MESSAGE_FORMAT(self): @@ -514,11 +526,27 @@ class Config: @RECEIVED_MESSAGE_FORMAT.setter def RECEIVED_MESSAGE_FORMAT(self, value): if isinstance(value, str): - if isUniqueStrings(["[message]", "[translation]"], value) is False: - value = "[message]([translation])" + if isUniqueStrings(["[message]"], value) is False: + value = "[message]" self._RECEIVED_MESSAGE_FORMAT = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property + @json_serializable('RECEIVED_MESSAGE_FORMAT_WITH_T') + def RECEIVED_MESSAGE_FORMAT_WITH_T(self): + return self._RECEIVED_MESSAGE_FORMAT_WITH_T + + @RECEIVED_MESSAGE_FORMAT_WITH_T.setter + def RECEIVED_MESSAGE_FORMAT_WITH_T(self, value): + if isinstance(value, str): + if isUniqueStrings(["[message]", "[translation]"], value) is False: + value = "[message]([translation])" + self._RECEIVED_MESSAGE_FORMAT_WITH_T = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + + + + # Speaker2Chatbox------------------ @property @json_serializable('ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC') def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self): @@ -529,7 +557,6 @@ class Config: if isinstance(value, bool): self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) - # Speaker2Chatbox------------------ @@ -623,8 +650,10 @@ class Config: "Bing": None, "Google": None, } - self._MESSAGE_FORMAT = "[message]([translation])" - self._RECEIVED_MESSAGE_FORMAT = "[message]([translation])" # speaker2Chatbox + self._SEND_MESSAGE_FORMAT = "[message]" + self._SEND_MESSAGE_FORMAT_WITH_T = "[message]([translation])" + self._RECEIVED_MESSAGE_FORMAT = "[message]" + self._RECEIVED_MESSAGE_FORMAT_WITH_T = "[message]([translation])" self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_SEND_MESSAGE_TO_VRC = True diff --git a/controller.py b/controller.py index 448442bd..ef61dccb 100644 --- a/controller.py +++ b/controller.py @@ -42,7 +42,7 @@ def sendMicMessage(message): if config.ENABLE_TRANSCRIPTION_SEND is True: if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if len(translation) > 0: - osc_message = config.MESSAGE_FORMAT.replace("[message]", message) + osc_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: osc_message = message @@ -116,7 +116,7 @@ def receiveSpeakerMessage(message): # send OSC message if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: if len(translation) > 0: - osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) + osc_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: osc_message = message @@ -662,16 +662,26 @@ def callbackSetEnableAutoExportMessageLogs(value): else: model.stopLogger() -def callbackSetMessageFormat(value): - print("callbackSetMessageFormat", value) +def callbackSetSendMessageFormat(value): + print("callbackSetSendMessageFormat", value) + if isUniqueStrings(["[message]"], value) is True: + config.SEND_MESSAGE_FORMAT = value + view.clearErrorMessage() + view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) + else: + view.showErrorMessage_SendMessageFormat() + view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) + +def callbackSetSendMessageFormatWithT(value): + print("callbackSetSendMessageFormatWithT", value) if len(value) > 0: if isUniqueStrings(["[message]", "[translation]"], value) is True: - config.MESSAGE_FORMAT = value + config.SEND_MESSAGE_FORMAT_WITH_T = value view.clearErrorMessage() - view.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) + view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) else: - view.showErrorMessage_MessageFormat() - view.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) + view.showErrorMessage_SendMessageFormatWithT() + view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) def callbackSetEnableSendMessageToVrc(value): @@ -683,18 +693,31 @@ def callbackSetEnableSendMessageToVrc(value): # print("callbackSetStartupOscEnabledCheck", value) # config.STARTUP_OSC_ENABLED_CHECK = value -# ---------------------Speaker2Chatbox--------------------- + def callbackSetReceivedMessageFormat(value): print("callbackSetReceivedMessageFormat", value) + if isUniqueStrings(["[message]"], value) is True: + config.RECEIVED_MESSAGE_FORMAT = value + view.clearErrorMessage() + view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + else: + view.showErrorMessage_ReceivedMessageFormat() + view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + + +def callbackSetReceivedMessageFormatWithT(value): + print("callbackSetReceivedMessageFormatWithT", value) if len(value) > 0: if isUniqueStrings(["[message]", "[translation]"], value) is True: - config.RECEIVED_MESSAGE_FORMAT = value + config.RECEIVED_MESSAGE_FORMAT_WITH_T = value view.clearErrorMessage() - view.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) else: - view.showErrorMessage_ReceivedMessageFormat() - view.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + view.showErrorMessage_ReceivedMessageFormatWithT() + view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) + +# ---------------------Speaker2Chatbox--------------------- def callbackSetEnableSendReceivedMessageToVrc(value): print("callbackSetEnableSendReceivedMessageToVrc", value) config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value @@ -834,11 +857,14 @@ def createMainWindow(): "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, - "callback_set_message_format": callbackSetMessageFormat, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, # "callback_set_startup_osc_enabled_check": callbackSetStartupOscEnabledCheck, # [deprecated] - # Speaker2Chatbox---------------- + "callback_set_send_message_format": callbackSetSendMessageFormat, + "callback_set_send_message_format_with_t": callbackSetSendMessageFormatWithT, "callback_set_received_message_format": callbackSetReceivedMessageFormat, + "callback_set_received_message_format_with_t": callbackSetReceivedMessageFormatWithT, + + # Speaker2Chatbox---------------- "callback_set_enable_send_received_message_to_vrc": callbackSetEnableSendReceivedMessageToVrc, # Speaker2Chatbox---------------- diff --git a/locales/en.yml b/locales/en.yml index 275c7510..a4b79641 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -82,6 +82,8 @@ config_window: transcription_mic: Mic transcription_speaker: Speaker others: Others + others_send_message_formats: Message Formats(Send) + others_received_message_formats: Message Formats(Received) others_speaker2chatbox: Speaker2Chatbox advanced_settings: Advanced Settings @@ -180,25 +182,40 @@ config_window: label: Auto Export Message Logs desc: Automatically export the conversation messages as a text file. - message_format: - label: Message Format - desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message.\nIt will be used in Notification XSOverlay too." - example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. - error_message: "The characters '[message]' and '[translation]' cannot be used." - send_message_to_vrc: label: Send Message To VRChat desc: There is a way to use it without sending messages to VRChat, but it is not supported. Enable this feature when you intend to send a message to VRChat. - # Speaker2Chatbox - received_message_format: - label: Message Format (Speaker2Chatbox) + + send_message_format: + label: Message Format + desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message." + example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. + error_message: "The characters '[message]' cannot be used." + + send_message_format_with_t: + label: Message Format(With translation) + desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message." example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. error_message: "The characters '[message]' and '[translation]' cannot be used." + received_message_format: + label: Message Format + desc: "You can change the decoration of the received message you want to send.\n[message] will be replaced with the message.\nIt will be used in Notification XSOverlay too." + example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. + error_message: "The characters '[message]' cannot be used." + + received_message_format_with_t: + label: Message Format(With translation) + desc: It will be used in Notification XSOverlay too. + example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. + error_message: "The characters '[message]' and '[translation]' cannot be used." + + # Speaker2Chatbox send_received_message_to_vrc: label: Send Received Message To VRChat - # Speaker2Chatbox + # Speaker2Chatbox + osc_ip_address: label: OSC IP Address diff --git a/locales/ja.yml b/locales/ja.yml index 516f46d5..3b56cbcf 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -178,16 +178,36 @@ config_window: label: 会話ログを自動的に保存する desc: テキストファイルとしてログがlogsフォルダ内に保存されます。 - message_format: - label: 送信するメッセージのフォーマット - desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、[translation]が翻訳されたメッセージに置換されます。\n※XSOverlayでの通知受け取り機能でも使われます。" - example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。 - error_message: "[message]と[translation]という文字は使えません。" - send_message_to_vrc: label: VRChatにメッセージを送信する desc: "サポート対象外ですが、VRChatにメッセージを送信せずに使う方法があります。送信したい場合、この機能を有効にする事を忘れないでください。" + + send_message_format: + label: 送信するメッセージのフォーマット + desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換されます。" + example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。 + error_message: "[message]という文字は使えません。" + + send_message_format_with_t: + label: 送信するメッセージのフォーマット(翻訳付き) + desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、[translation]が翻訳されたメッセージに置換されます。" + example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。 + error_message: "[message]と[translation]という文字は使えません。" + + received_message_format: + label: 送信するメッセージのフォーマット + desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換されます。\n※XSOverlayでの通知受け取り機能にも使われます。" + example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。 + error_message: "[message]という文字は使えません。" + + received_message_format_with_t: + label: 送信するメッセージのフォーマット(翻訳付き) + desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、[translation]が翻訳されたメッセージに置換されます。\n※XSOverlayでの通知受け取り機能にも使われます。" + example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。 + error_message: "[message]と[translation]という文字は使えません。" + + osc_ip_address: label: OSC IP Address diff --git a/locales/ko.yml b/locales/ko.yml index 9f6566ee..4beda7f2 100644 --- a/locales/ko.yml +++ b/locales/ko.yml @@ -172,7 +172,7 @@ config_window: # label: Auto Export Message Logs # desc: Automatically export the conversation messages as a text file. - message_format: + send_message_format_with_t: label: 전송 형식 # desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message.\nIt will be used in Notification XSOverlay too." example_text: 예문입니다. 글꼴, 줄 바꿈 등이 실제 표시와 다를 수 있습니다. diff --git a/view.py b/view.py index 315ee6c8..7b95a2f5 100644 --- a/view.py +++ b/view.py @@ -345,20 +345,6 @@ class View(): VAR_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=BooleanVar(value=config.ENABLE_LOGGER), - VAR_LABEL_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.message_format.label")), - VAR_DESC_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.message_format.desc")), - CALLBACK_SET_MESSAGE_FORMAT=None, - CALLBACK_SWAP_MESSAGE_FORMAT_REQUIRED_TEXT=self._swapMessageFormatRequiredText, - VAR_MESSAGE_FORMAT=StringVar(value=config.MESSAGE_FORMAT), - VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT=StringVar(value=""), - VAR_ENTRY_0_MESSAGE_FORMAT=StringVar(value=""), - VAR_ENTRY_1_MESSAGE_FORMAT=StringVar(value=""), - VAR_ENTRY_2_MESSAGE_FORMAT=StringVar(value=""), - VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT=StringVar(value="[message]"), - VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT=StringVar(value="[translation]"), - CALLBACK_FOCUS_OUT_MESSAGE_FORMAT=self.callbackBindFocusOut_MessageFormat, - - VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.label")), VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.desc")), CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC=None, @@ -372,25 +358,65 @@ class View(): + VAR_SECOND_TITLE_OTHERS_SEND_MESSAGE_FORMATS=StringVar(value=i18n.t("config_window.side_menu_labels.others_send_message_formats")), + + + VAR_LABEL_SEND_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.send_message_format.label")), + VAR_DESC_SEND_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.send_message_format.desc")), + CALLBACK_SET_SEND_MESSAGE_FORMAT=None, + VAR_SEND_MESSAGE_FORMAT=StringVar(value=config.SEND_MESSAGE_FORMAT), + VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT=StringVar(value=""), + VAR_ENTRY_0_SEND_MESSAGE_FORMAT=StringVar(value=""), + VAR_ENTRY_1_SEND_MESSAGE_FORMAT=StringVar(value=""), + VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT=StringVar(value="[message]"), + CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT=self.callbackBindFocusOut_SendMessageFormat, + + + VAR_LABEL_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.send_message_format_with_t.label")), + VAR_DESC_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.send_message_format_with_t.desc")), + CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T=None, + CALLBACK_SWAP_SEND_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT=self._swapSendMessageFormatWithT_RequiredText, + VAR_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=config.SEND_MESSAGE_FORMAT_WITH_T), + VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value="[message]"), + VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value="[translation]"), + CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT_WITH_T=self.callbackBindFocusOut_SendMessageFormatWithT, - # -------------------Speaker2Chatbox----------- - VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX=StringVar(value=i18n.t("config_window.side_menu_labels.others_speaker2chatbox")), VAR_LABEL_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.label")), VAR_DESC_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.desc")), CALLBACK_SET_RECEIVED_MESSAGE_FORMAT=None, - CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_REQUIRED_TEXT=self._swapReceivedMessageFormatRequiredText, VAR_RECEIVED_MESSAGE_FORMAT=StringVar(value=config.RECEIVED_MESSAGE_FORMAT), VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), - VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT=StringVar(value="[message]"), - VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT=StringVar(value="[translation]"), CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT=self.callbackBindFocusOut_ReceivedMessageFormat, + VAR_SECOND_TITLE_OTHERS_RECEIVED_MESSAGE_FORMATS=StringVar(value=i18n.t("config_window.side_menu_labels.others_received_message_formats")), + + VAR_LABEL_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.received_message_format_with_t.label")), + VAR_DESC_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.received_message_format_with_t.desc")), + CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T=None, + CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT=self._swapReceivedMessageFormatWithT_RequiredText, + VAR_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=config.RECEIVED_MESSAGE_FORMAT_WITH_T), + VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""), + VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value="[message]"), + VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value="[translation]"), + CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT_WITH_T=self.callbackBindFocusOut_ReceivedMessageFormatWithT, + + + # -------------------Speaker2Chatbox----------- + VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX=StringVar(value=i18n.t("config_window.side_menu_labels.others_speaker2chatbox")), + VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.label")), VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.desc")), CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=None, @@ -522,15 +548,18 @@ class View(): self.view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = config_window_registers.get("callback_set_enable_auto_clear_chatbox", None) self.view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = config_window_registers.get("callback_set_enable_notice_xsoverlay", None) self.view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS = config_window_registers.get("callback_set_enable_auto_export_message_logs", None) - self.view_variable.CALLBACK_SET_MESSAGE_FORMAT = config_window_registers.get("callback_set_message_format", None) self.view_variable.CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_message_to_vrc", None) # self.view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK = config_window_registers.get("callback_set_startup_osc_enabled_check", None) #[deprecated] - + self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT = config_window_registers.get("callback_set_send_message_format", None) + self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T = config_window_registers.get("callback_set_send_message_format_with_t", None) self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT = config_window_registers.get("callback_set_received_message_format", None) + self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T = config_window_registers.get("callback_set_received_message_format_with_t", None) + # Speaker2Chatbox---------------- self.view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_received_message_to_vrc", None) + # Speaker2Chatbox---------------- @@ -572,104 +601,134 @@ class View(): self.openSpeakerEnergyThresholdWidget() - self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) - self.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + self.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) + self.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) + self.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + self.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) # Insert sample conversation for testing. # self._insertSampleConversationToTextbox() - - def setMessageFormatEntryWidgets(self, message_format:str): +# Send Message Format + def setSendMessageFormat_EntryWidgets(self, message_format:str): result = self.extractMessageFormat(message_format) + self.view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT.set(result.before) + self.view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT.set(result.after) + self.updateSendMessageFormat_ExampleTextWidget() + + def updateSendMessageFormat_ExampleTextWidget(self): + message = i18n.t("config_window.send_message_format.example_text") + example_message = config.SEND_MESSAGE_FORMAT.replace("[message]", message) + + self.view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT.set(example_message) + + +# Send Message Format With Translation + def setSendMessageFormatWithT_EntryWidgets(self, message_format:str): + result = self.extractMessageFormatWithT(message_format) + if result.is_message_first is True: - self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.set("[message]") - self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.set("[translation]") + self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.set("[message]") + self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.set("[translation]") else: - self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.set("[translation]") - self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.set("[message]") + self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.set("[translation]") + self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.set("[message]") - self.view_variable.VAR_ENTRY_0_MESSAGE_FORMAT.set(result.before) - self.view_variable.VAR_ENTRY_1_MESSAGE_FORMAT.set(result.between) - self.view_variable.VAR_ENTRY_2_MESSAGE_FORMAT.set(result.after) - self.updateMessageFormat_ExampleTextWidget() + self.view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T.set(result.before) + self.view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T.set(result.between) + self.view_variable.VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T.set(result.after) + self.updateSendMessageFormatWithT_ExampleTextWidget() - def _swapMessageFormatRequiredText(self): - text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.get() - text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.get() - self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.set(text_1) - self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.set(text_0) - self.updateMessageFormat_ExampleTextWidget() + def _swapSendMessageFormatWithT_RequiredText(self): + text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.get() + text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.get() + self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.set(text_1) + self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.set(text_0) + self.updateSendMessageFormatWithT_ExampleTextWidget() - new_message_format = self.getLatestMessageFormatFromWidget() - callFunctionIfCallable(self.view_variable.CALLBACK_SET_MESSAGE_FORMAT, new_message_format) + new_message_format = self.getLatestMessageFormatWithT_FromWidget() + callFunctionIfCallable(self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T, new_message_format) - def getLatestMessageFormatFromWidget(self): - text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.get() - text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.get() - entry_0 = self.view_variable.VAR_ENTRY_0_MESSAGE_FORMAT.get() - entry_1 = self.view_variable.VAR_ENTRY_1_MESSAGE_FORMAT.get() - entry_2 = self.view_variable.VAR_ENTRY_2_MESSAGE_FORMAT.get() + def getLatestMessageFormatWithT_FromWidget(self): + text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.get() + text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.get() + entry_0 = self.view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T.get() + entry_1 = self.view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T.get() + entry_2 = self.view_variable.VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T.get() return entry_0+text_0+entry_1+text_1+entry_2 - def updateMessageFormat_ExampleTextWidget(self): - message = i18n.t("config_window.message_format.example_text", locale=config.UI_LANGUAGE) + def updateSendMessageFormatWithT_ExampleTextWidget(self): + message = i18n.t("config_window.send_message_format_with_t.example_text", locale=config.UI_LANGUAGE) translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en" - translation = i18n.t("config_window.message_format.example_text", locale=translation_locale) + translation = i18n.t("config_window.send_message_format_with_t.example_text", locale=translation_locale) - example_message = config.MESSAGE_FORMAT.replace("[message]", message) + example_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message) example_message = example_message.replace("[translation]", translation) - self.view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT.set(example_message) + self.view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT_WITH_T.set(example_message) - -# Speaker2Chatbox---------------------------- - def setReceivedMessageFormatEntryWidgets(self, message_format:str): +# Received Message Format + def setReceivedMessageFormat_EntryWidgets(self, message_format:str): result = self.extractMessageFormat(message_format) - if result.is_message_first is True: - self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set("[message]") - self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set("[translation]") - else: - self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set("[translation]") - self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set("[message]") - self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.set(result.before) - self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.set(result.between) - self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT.set(result.after) + self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.set(result.after) self.updateReceivedMessageFormat_ExampleTextWidget() - def _swapReceivedMessageFormatRequiredText(self): - text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.get() - text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.get() - self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set(text_1) - self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set(text_0) - self.updateReceivedMessageFormat_ExampleTextWidget() - - new_message_format = self.getLatestReceivedMessageFormatFromWidget() - callFunctionIfCallable(self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, new_message_format) - - - def getLatestReceivedMessageFormatFromWidget(self): - text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.get() - text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.get() - entry_0 = self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.get() - entry_1 = self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.get() - entry_2 = self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT.get() - return entry_0+text_0+entry_1+text_1+entry_2 - def updateReceivedMessageFormat_ExampleTextWidget(self): - message = i18n.t("config_window.message_format.example_text", locale=config.UI_LANGUAGE) - translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en" - translation = i18n.t("config_window.message_format.example_text", locale=translation_locale) - + message = i18n.t("config_window.received_message_format.example_text") example_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) - example_message = example_message.replace("[translation]", translation) self.view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT.set(example_message) -# Speaker2Chatbox---------------------------- + + +# Received Message Format With Translation + def setReceivedMessageFormatWithT_EntryWidgets(self, message_format:str): + result = self.extractMessageFormatWithT(message_format) + + if result.is_message_first is True: + self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[message]") + self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[translation]") + else: + self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[translation]") + self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[message]") + + self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set(result.before) + self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set(result.between) + self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T.set(result.after) + self.updateReceivedMessageFormatWithT_ExampleTextWidget() + + def _swapReceivedMessageFormatWithT_RequiredText(self): + text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set(text_1) + self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set(text_0) + self.updateReceivedMessageFormatWithT_ExampleTextWidget() + + new_message_format = self.getLatestReceivedMessageFormatWithT_FromWidget() + callFunctionIfCallable(self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T, new_message_format) + + + def getLatestReceivedMessageFormatWithT_FromWidget(self): + text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + entry_0 = self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + entry_1 = self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + entry_2 = self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T.get() + return entry_0+text_0+entry_1+text_1+entry_2 + + def updateReceivedMessageFormatWithT_ExampleTextWidget(self): + message = i18n.t("config_window.received_message_format_with_t.example_text", locale=config.UI_LANGUAGE) + translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en" + translation = i18n.t("config_window.received_message_format_with_t.example_text", locale=translation_locale) + + example_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message) + example_message = example_message.replace("[translation]", translation) + + self.view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT_WITH_T.set(example_message) @@ -1211,10 +1270,14 @@ class View(): case "SpeakerMaxPhrases": self.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES) - case "MessageFormat": - self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) + case "SendMessageFormat": + self.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) + case "SendMessageFormatWithT": + self.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) case "ReceivedMessageFormat": - self.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + self.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) + case "ReceivedMessageFormatWithT": + self.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) case _: raise ValueError(f"No matching case for target_name: {target_name}") @@ -1365,14 +1428,21 @@ class View(): self.clearErrorMessage() - def callbackBindFocusOut_MessageFormat(self, _e=None): - self.setLatestConfigVariable("MessageFormat") + def callbackBindFocusOut_SendMessageFormat(self, _e=None): + self.setLatestConfigVariable("SendMessageFormat") + self.clearErrorMessage() + + def callbackBindFocusOut_SendMessageFormatWithT(self, _e=None): + self.setLatestConfigVariable("SendMessageFormatWithT") self.clearErrorMessage() def callbackBindFocusOut_ReceivedMessageFormat(self, _e=None): self.setLatestConfigVariable("ReceivedMessageFormat") self.clearErrorMessage() + def callbackBindFocusOut_ReceivedMessageFormatWithT(self, _e=None): + self.setLatestConfigVariable("ReceivedMessageFormatWithT") + self.clearErrorMessage() @@ -1454,16 +1524,28 @@ class View(): ) - def showErrorMessage_MessageFormat(self): + def showErrorMessage_SendMessageFormat(self): self._showErrorMessage( - vrct_gui.config_window.sb__entry_message_format_2, - self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message")) + vrct_gui.config_window.sb__entry_send_message_format_1, + self._makeInvalidValueErrorMessage(i18n.t("config_window.send_message_format.error_message")) + ) + + def showErrorMessage_SendMessageFormatWithT(self): + self._showErrorMessage( + vrct_gui.config_window.sb__entry_send_message_format_with_t_2, + self._makeInvalidValueErrorMessage(i18n.t("config_window.send_message_format_with_t.error_message")) ) def showErrorMessage_ReceivedMessageFormat(self): self._showErrorMessage( - vrct_gui.config_window.sb__entry_received_message_format_2, - self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message")) + vrct_gui.config_window.sb__entry_received_message_format_1, + self._makeInvalidValueErrorMessage(i18n.t("config_window.received_message_format.error_message")) + ) + + def showErrorMessage_ReceivedMessageFormatWithT(self): + self._showErrorMessage( + vrct_gui.config_window.sb__entry_received_message_format_with_t_2, + self._makeInvalidValueErrorMessage(i18n.t("config_window.received_message_format_with_t.error_message")) ) @@ -1475,9 +1557,17 @@ class View(): self.view_variable.VAR_ERROR_MESSAGE.set(message) vrct_gui._showErrorMessage(target_widget=target_widget) - @staticmethod def extractMessageFormat(text): + split_result = text.split("[message]") + result_data = SimpleNamespace( + before = split_result[0], + after = split_result[1], + ) + return result_data + + @staticmethod + def extractMessageFormatWithT(text): import re message_index = text.find("[message]") translation_index = text.find("[translation]") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index 2e9bec44..232d98ca 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -8,7 +8,7 @@ from ._createSettingBoxContainer import _createSettingBoxContainer from .setting_box_containers.setting_box_appearance import createSettingBox_Appearance from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker -from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_Additional +from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_SendMessageFormats, createSettingBox_Others_ReceivedMessageFormats, createSettingBox_Others_Additional from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings from .setting_box_containers.setting_box_translation import createSettingBox_Translation @@ -106,6 +106,8 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl "setting_box_container_attr_name": "setting_box_container_others", "setting_boxes": [ { "var_section_title": None, "setting_box": createSettingBox_Others }, + { "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_SEND_MESSAGE_FORMATS, "setting_box": createSettingBox_Others_SendMessageFormats }, + { "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_RECEIVED_MESSAGE_FORMATS, "setting_box": createSettingBox_Others_ReceivedMessageFormats }, { "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX, "setting_box": createSettingBox_Others_Additional }, ] }, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index b20feb45..f73cb253 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -538,7 +538,7 @@ class _SettingBoxGenerator(): - def createSettingBoxMessageFormatEntries(self, + def createSettingBoxMessageFormatEntries_WithTranslation(self, base_entry_attr_name, entry_textvariable_0, entry_textvariable_1, @@ -736,6 +736,119 @@ class _SettingBoxGenerator(): + + def createSettingBoxMessageFormatEntries(self, + base_entry_attr_name, + entry_textvariable_0, + entry_textvariable_1, + textvariable_0, + example_label_textvariable, + entry_bind__Any_KeyRelease, + entry_bind__FocusOut=None, + ): + + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(base_entry_attr_name) + + + all_wrapper = CTkFrame(setting_box_item_frame, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) + all_wrapper.grid(row=1, column=0, sticky="ew") + + all_wrapper.grid_columnconfigure(0, weight=1) + + + example_box_wrapper = CTkFrame(all_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) + example_box_wrapper.grid(row=0, column=0, pady=self.settings.uism.SB__MESSAGE_FORMAT__ENTRIES_BOTTOM_PADY, sticky="ew") + + entries_wrapper = CTkFrame(all_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) + entries_wrapper.grid(row=1, column=0, pady=self.settings.uism.SB__MESSAGE_FORMAT__ENTRIES_BOTTOM_PADY, sticky="ew") + + + + + example_box_wrapper.grid_columnconfigure((0,2), weight=1) + example_frame_widget = CTkFrame(example_box_wrapper, corner_radius=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_CORNER_RADIUS, fg_color=self.settings.ctm.SB__MESSAGE_FORMAT__EXAMPLE_BG_COLOR, width=0, height=0) + example_frame_widget.grid(row=0, column=1) + + example_frame_widget.grid_rowconfigure((0,2), weight=1) + example_frame_widget.grid_columnconfigure((0,2), weight=1) + example_label_widget = CTkLabel( + example_frame_widget, + textvariable=example_label_textvariable, + anchor="center", + justify="center", + wraplength=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_WRAP_LENGTH, + height=0, + font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__MESSAGE_FORMAT__REQUIRED_TEXT_FONT_SIZE, weight="normal"), + text_color=self.settings.ctm.SB__MESSAGE_FORMAT__EXAMPLE_TEXT_COLOR, + ) + example_label_widget.grid(row=1, column=1, padx=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_IPADXY, pady=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_IPADXY, sticky="ew") + + self.config_window.additional_widgets.append(example_box_wrapper) + + + + + entry_textvariables = [entry_textvariable_0, entry_textvariable_1] + for i in range(2): + entry_widget = CTkEntry( + entries_wrapper, + text_color=self.settings.ctm.SB__ENTRY_TEXT_COLOR, + fg_color=self.settings.ctm.SB__ENTRY_BG_COLOR, + border_color=self.settings.ctm.SB__ENTRY_BORDER_COLOR, + height=self.settings.uism.SB__MESSAGE_FORMAT__ENTRY_HEIGHT, + textvariable=entry_textvariables[i], + justify="center", + font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__ENTRY_FONT_SIZE, weight="normal"), + ) + setattr(self.config_window, base_entry_attr_name + "_" + str(i), entry_widget) + + + + if entry_bind__FocusOut is not None: + entry_widget.bind("", entry_bind__FocusOut, "+") + + + label_frame_widget_0 = CTkFrame(entries_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) + + label_frame_widget_0.grid_rowconfigure((0,2), weight=1) + label_frame_widget_0.grid_columnconfigure(0, weight=1) + label_widget_0 = CTkLabel( + label_frame_widget_0, + textvariable=textvariable_0, + anchor="center", + height=0, + font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__MESSAGE_FORMAT__REQUIRED_TEXT_FONT_SIZE, weight="normal"), + text_color=self.settings.ctm.LABELS_TEXT_COLOR + ) + label_widget_0.grid(row=1, column=0, padx=0, pady=0, sticky="ew") + + + + + + entries_wrapper.grid_columnconfigure((0,2), weight=1) + entries_wrapper.grid_columnconfigure(1, weight=0) + + entry_widget_0 = getattr(self.config_window, base_entry_attr_name+"_0") + entry_widget_1 = getattr(self.config_window, base_entry_attr_name+"_1") + entry_widget_0.grid(row=0, column=0, sticky="ew") + entry_widget_1.grid(row=0, column=2, sticky="ew") + label_frame_widget_0.grid(row=0, column=1, padx=self.settings.uism.SB__MESSAGE_FORMAT__REQUIRED_TEXT_PADX, sticky="ew") + + def adjusted_command__for_entry_bind__Any_KeyRelease(_e): + message_format = entry_widget_0.get() + textvariable_0.get() + entry_widget_1.get() + entry_bind__Any_KeyRelease(message_format) + + + entry_widget_0.bind("", adjusted_command__for_entry_bind__Any_KeyRelease) + entry_widget_1.bind("", adjusted_command__for_entry_bind__Any_KeyRelease) + + + + return setting_box_frame + + + def createSettingBoxButtonWithImage( self, for_var_label_text, for_var_desc_text, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py index 98b0af6d..9b7e583c 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/__init__.py @@ -1,2 +1,4 @@ from .createSettingBox_Others import createSettingBox_Others +from .createSettingBox_Others_SendMessageFormats import createSettingBox_Others_SendMessageFormats +from .createSettingBox_Others_ReceivedMessageFormats import createSettingBox_Others_ReceivedMessageFormats from .createSettingBox_Others_Additional import createSettingBox_Others_Additional \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index 1ef60c05..d129a05d 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -7,7 +7,7 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v createSettingBoxCheckbox = sbg.createSettingBoxCheckbox createSettingBoxAutoExportMessageLogs = sbg.createSettingBoxAutoExportMessageLogs createSettingBox_Labels = sbg.createSettingBox_Labels - createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries + createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation # 元 checkbox_auto_clear_chatbox_callback @@ -30,13 +30,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v # def checkbox_startup_osc_enabled_check_callback(checkbox_box_widget): # callFunctionIfCallable(view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK, checkbox_box_widget.get()) - def entry_message_format_callback(value): - callFunctionIfCallable(view_variable.CALLBACK_SET_MESSAGE_FORMAT, value) - - def entry_swap_message_format_callback(_e): - callFunctionIfCallable(view_variable.CALLBACK_SWAP_MESSAGE_FORMAT_REQUIRED_TEXT) - - row=0 config_window.sb__auto_clear_message_box = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX, @@ -72,32 +65,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v row+=1 - config_window.sb__message_format_labels = createSettingBox_Labels( - for_var_label_text=view_variable.VAR_LABEL_MESSAGE_FORMAT, - for_var_desc_text=view_variable.VAR_DESC_MESSAGE_FORMAT, - labels_attr_name="sb__labels_message_format", - ) - config_window.sb__message_format_labels.grid(row=row, pady=0) - row+=1 - - config_window.sb__message_format = createSettingBoxMessageFormatEntries( - base_entry_attr_name="sb__entry_message_format", - # entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150, - entry_textvariable_0=view_variable.VAR_ENTRY_0_MESSAGE_FORMAT, - entry_textvariable_1=view_variable.VAR_ENTRY_1_MESSAGE_FORMAT, - entry_textvariable_2=view_variable.VAR_ENTRY_2_MESSAGE_FORMAT, - textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT, - textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT, - example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT, - entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value), - swap_button_command=entry_swap_message_format_callback, - # entry_textvariable=view_variable.VAR_MESSAGE_FORMAT, - entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_MESSAGE_FORMAT, - ) - config_window.sb__message_format.grid(row=row) - row+=1 - - config_window.sb__enable_send_message_to_vrc = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC, for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py index c7ba864d..53551128 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py @@ -5,46 +5,12 @@ from .._SettingBoxGenerator import _SettingBoxGenerator def createSettingBox_Others_Additional(setting_box_wrapper, config_window, settings, view_variable): sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) createSettingBoxCheckbox = sbg.createSettingBoxCheckbox - createSettingBox_Labels = sbg.createSettingBox_Labels - createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries - def checkbox_enable_send_received_message_to_vrc_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, checkbox_box_widget.get()) - def entry_received_message_format_callback(value): - callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, value) - - def entry_swap_received_message_format_callback(_e): - callFunctionIfCallable(view_variable.CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_REQUIRED_TEXT) row=0 - config_window.sb__received_message_format_labels = createSettingBox_Labels( - for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT, - # for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT, - labels_attr_name="sb__labels_message_format", - ) - config_window.sb__received_message_format_labels.grid(row=row, pady=0) - row+=1 - - config_window.sb__received_message_format = createSettingBoxMessageFormatEntries( - base_entry_attr_name="sb__entry_received_message_format", - # entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150, - entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT, - entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT, - entry_textvariable_2=view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT, - textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT, - textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT, - example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT, - entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_callback(value), - swap_button_command=entry_swap_received_message_format_callback, - # entry_textvariable=view_variable.VAR_RECEIVED_MESSAGE_FORMAT, - entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT, - ) - config_window.sb__received_message_format.grid(row=row) - row+=1 - - config_window.sb__enable_send_received_message_to_vrc = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, # for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_ReceivedMessageFormats.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_ReceivedMessageFormats.py new file mode 100644 index 00000000..0d0bbca7 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_ReceivedMessageFormats.py @@ -0,0 +1,65 @@ +from utils import callFunctionIfCallable + +from .._SettingBoxGenerator import _SettingBoxGenerator + +def createSettingBox_Others_ReceivedMessageFormats(setting_box_wrapper, config_window, settings, view_variable): + sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) + createSettingBox_Labels = sbg.createSettingBox_Labels + createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries + createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation + + def entry_received_message_format_callback(value): + callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, value) + + + def entry_received_message_format_with_t_callback(value): + callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T, value) + + def entry_swap_received_message_format_with_t_callback(_e): + callFunctionIfCallable(view_variable.CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT) + + row=0 + config_window.sb__received_message_format_labels = createSettingBox_Labels( + for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT, + for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT, + labels_attr_name="sb__labels_received_message_format", + ) + config_window.sb__received_message_format_labels.grid(row=row, pady=0) + row+=1 + + config_window.sb__received_message_format = createSettingBoxMessageFormatEntries( + base_entry_attr_name="sb__entry_received_message_format", + entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT, + entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT, + textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT, + example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT, + entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_callback(value), + entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT, + ) + config_window.sb__received_message_format.grid(row=row) + row+=1 + + + + config_window.sb__received_message_format_with_t_labels = createSettingBox_Labels( + for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT_WITH_T, + for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT_WITH_T, + labels_attr_name="sb__labels_message_format_with_t", + ) + config_window.sb__received_message_format_with_t_labels.grid(row=row, pady=0) + row+=1 + + config_window.sb__received_message_format_with_t = createSettingBoxMessageFormatEntries_WithTranslation( + base_entry_attr_name="sb__entry_received_message_format_with_t", + entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T, + entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T, + entry_textvariable_2=view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T, + textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T, + textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T, + example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT_WITH_T, + entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_with_t_callback(value), + swap_button_command=entry_swap_received_message_format_with_t_callback, + entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT_WITH_T, + ) + config_window.sb__received_message_format_with_t.grid(row=row, pady=0) + row+=1 \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_SendMessageFormats.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_SendMessageFormats.py new file mode 100644 index 00000000..6180ffd8 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_SendMessageFormats.py @@ -0,0 +1,66 @@ +from utils import callFunctionIfCallable + +from .._SettingBoxGenerator import _SettingBoxGenerator + +def createSettingBox_Others_SendMessageFormats(setting_box_wrapper, config_window, settings, view_variable): + sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) + createSettingBox_Labels = sbg.createSettingBox_Labels + createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries + createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation + + def entry_send_message_format_callback(value): + callFunctionIfCallable(view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT, value) + + + def entry_send_message_format_with_t_callback(value): + callFunctionIfCallable(view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T, value) + + def entry_swap_message_format_with_t_callback(_e): + callFunctionIfCallable(view_variable.CALLBACK_SWAP_SEND_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT) + + + row=0 + config_window.sb__send_message_format_labels = createSettingBox_Labels( + for_var_label_text=view_variable.VAR_LABEL_SEND_MESSAGE_FORMAT, + for_var_desc_text=view_variable.VAR_DESC_SEND_MESSAGE_FORMAT, + labels_attr_name="sb__labels_send_message_format", + ) + config_window.sb__send_message_format_labels.grid(row=row, pady=0) + row+=1 + + config_window.sb__message_format = createSettingBoxMessageFormatEntries( + base_entry_attr_name="sb__entry_send_message_format", + entry_textvariable_0=view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT, + entry_textvariable_1=view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT, + textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT, + example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT, + entry_bind__Any_KeyRelease=lambda value: entry_send_message_format_callback(value), + entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT, + ) + config_window.sb__message_format.grid(row=row) + row+=1 + + + + config_window.sb__send_message_format_with_t_labels = createSettingBox_Labels( + for_var_label_text=view_variable.VAR_LABEL_SEND_MESSAGE_FORMAT_WITH_T, + for_var_desc_text=view_variable.VAR_DESC_SEND_MESSAGE_FORMAT_WITH_T, + labels_attr_name="sb__labels_send_message_format_with_t", + ) + config_window.sb__send_message_format_with_t_labels.grid(row=row, pady=0) + row+=1 + + config_window.sb__message_format_with_t = createSettingBoxMessageFormatEntries_WithTranslation( + base_entry_attr_name="sb__entry_send_message_format_with_t", + entry_textvariable_0=view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T, + entry_textvariable_1=view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T, + entry_textvariable_2=view_variable.VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T, + textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T, + textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T, + example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT_WITH_T, + entry_bind__Any_KeyRelease=lambda value: entry_send_message_format_with_t_callback(value), + swap_button_command=entry_swap_message_format_with_t_callback, + entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT_WITH_T, + ) + config_window.sb__message_format_with_t.grid(row=row, pady=0) + row+=1 \ No newline at end of file From 6a9732aaa850d479dd011b378d325127f4428c8d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:49:35 +0900 Subject: [PATCH 11/43] =?UTF-8?q?[Update]=20Add=20Message=20Formats=20Feat?= =?UTF-8?q?ures=20more.=20=E6=A9=9F=E8=83=BD=E3=81=A8=E3=81=97=E3=81=A6?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=80=82=E5=AE=9F=E9=9A=9B=E3=81=AB=E5=90=84?= =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E9=80=81=E4=BF=A1?= =?UTF-8?q?=E6=99=82=E3=81=AB=E5=90=84=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=8C=E6=A9=9F=E8=83=BD=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controller.py b/controller.py index ef61dccb..f713ff9b 100644 --- a/controller.py +++ b/controller.py @@ -45,7 +45,7 @@ def sendMicMessage(message): osc_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: - osc_message = message + osc_message = config.SEND_MESSAGE_FORMAT.replace("[message]", message) model.oscSendMessage(osc_message) view.printToTextbox_SentMessage(message, translation) @@ -106,10 +106,10 @@ def receiveSpeakerMessage(message): if config.ENABLE_TRANSCRIPTION_RECEIVE is True: if config.ENABLE_NOTICE_XSOVERLAY is True: if len(translation) > 0: - xsoverlay_message = config.MESSAGE_FORMAT.replace("[message]", message) + xsoverlay_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message) xsoverlay_message = xsoverlay_message.replace("[translation]", translation) else: - xsoverlay_message = message + xsoverlay_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) model.notificationXSOverlay(xsoverlay_message) # ------------Speaker2Chatbox------------ @@ -119,7 +119,7 @@ def receiveSpeakerMessage(message): osc_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: - osc_message = message + osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) model.oscSendMessage(osc_message) # ------------Speaker2Chatbox------------ @@ -183,10 +183,10 @@ def sendChatMessage(message): # send OSC message if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if len(translation) > 0: - osc_message = config.MESSAGE_FORMAT.replace("[message]", message) + osc_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: - osc_message = message + osc_message = config.SEND_MESSAGE_FORMAT.replace("[message]", message) model.oscSendMessage(osc_message) # update textbox message log (Sent) From 8a0b2de54092d4ca114ab43baeb3c9f86d31e3e6 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 19 Dec 2023 22:28:18 +0900 Subject: [PATCH 12/43] =?UTF-8?q?[Update]=20Message=20Format:=20config.jso?= =?UTF-8?q?n=E3=81=A7=E5=85=83=E3=80=85=E3=81=AEkey=20"MESSAGE=5FFORMAT"?= =?UTF-8?q?=E3=81=8C=E5=AD=98=E5=9C=A8=E3=81=97=E3=81=A6=E3=81=84=E3=81=9F?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=80=81"SEND=5FMESSAGE=5FFORMAT=5FWITH=5FT"?= =?UTF-8?q?=E3=81=B8=E3=81=A8=E5=BC=95=E3=81=8D=E7=B6=99=E3=81=90=E5=87=A6?= =?UTF-8?q?=E7=90=86=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config.py b/config.py index 4477be25..7160e48c 100644 --- a/config.py +++ b/config.py @@ -667,8 +667,13 @@ class Config: with open(self.PATH_CONFIG, 'r', encoding="utf-8") as fp: config = json_load(fp) + old_message_format = None for key in config.keys(): + if key == "MESSAGE_FORMAT": + old_message_format = config[key] setattr(self, key, config[key]) + if old_message_format is not None: + setattr(self, "SEND_MESSAGE_FORMAT_WITH_T", old_message_format) with open(self.PATH_CONFIG, 'w', encoding="utf-8") as fp: config = {} From 870e276ec5e317e97237edeb7872792cd99855f2 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 19 Dec 2023 23:45:11 +0900 Subject: [PATCH 13/43] =?UTF-8?q?[Refactor]=20controller.py=20Message=20fo?= =?UTF-8?q?rmat=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B=E9=96=A2?= =?UTF-8?q?=E6=95=B0=E5=91=A8=E3=82=8A=E3=81=A7=E3=80=81=E5=85=B1=E9=80=9A?= =?UTF-8?q?=E3=81=97=E3=81=9F=E5=87=A6=E7=90=86=E5=88=87=E3=82=8A=E5=87=BA?= =?UTF-8?q?=E3=81=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/controller.py b/controller.py index f713ff9b..7f4a0db4 100644 --- a/controller.py +++ b/controller.py @@ -23,6 +23,23 @@ def callbackFilepathConfigFile(): print("callbackFilepathConfigFile", config.LOCAL_PATH.replace('/', '\\')) Popen(['explorer', config.LOCAL_PATH.replace('/', '\\')], shell=True) +def messageFormatter(format_type:str, translation, message): + if format_type == "RECEIVED": + FORMAT_WITH_T = config.RECEIVED_MESSAGE_FORMAT_WITH_T + FORMAT = config.RECEIVED_MESSAGE_FORMAT + elif format_type == "SEND": + FORMAT_WITH_T = config.SEND_MESSAGE_FORMAT_WITH_T + FORMAT = config.SEND_MESSAGE_FORMAT + else: + raise ValueError("format_type is not found", format_type) + + if len(translation) > 0: + osc_message = FORMAT_WITH_T.replace("[message]", message) + osc_message = osc_message.replace("[translation]", translation) + else: + osc_message = FORMAT.replace("[message]", message) + return osc_message + # func transcription send message def sendMicMessage(message): if len(message) > 0: @@ -41,11 +58,7 @@ def sendMicMessage(message): if config.ENABLE_TRANSCRIPTION_SEND is True: if config.ENABLE_SEND_MESSAGE_TO_VRC is True: - if len(translation) > 0: - osc_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message) - osc_message = osc_message.replace("[translation]", translation) - else: - osc_message = config.SEND_MESSAGE_FORMAT.replace("[message]", message) + osc_message = messageFormatter("SEND", translation, message) model.oscSendMessage(osc_message) view.printToTextbox_SentMessage(message, translation) @@ -105,21 +118,13 @@ def receiveSpeakerMessage(message): if config.ENABLE_TRANSCRIPTION_RECEIVE is True: if config.ENABLE_NOTICE_XSOVERLAY is True: - if len(translation) > 0: - xsoverlay_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message) - xsoverlay_message = xsoverlay_message.replace("[translation]", translation) - else: - xsoverlay_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) + xsoverlay_message = messageFormatter("RECEIVED", translation, message) model.notificationXSOverlay(xsoverlay_message) # ------------Speaker2Chatbox------------ # send OSC message if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: - if len(translation) > 0: - osc_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message) - osc_message = osc_message.replace("[translation]", translation) - else: - osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) + osc_message = messageFormatter("RECEIVED", translation, message) model.oscSendMessage(osc_message) # ------------Speaker2Chatbox------------ @@ -182,11 +187,7 @@ def sendChatMessage(message): # send OSC message if config.ENABLE_SEND_MESSAGE_TO_VRC is True: - if len(translation) > 0: - osc_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message) - osc_message = osc_message.replace("[translation]", translation) - else: - osc_message = config.SEND_MESSAGE_FORMAT.replace("[message]", message) + osc_message = messageFormatter("SEND", translation, message) model.oscSendMessage(osc_message) # update textbox message log (Sent) From 74bd06c768f1bdb67d02d4ff05e2fcccf2c3724e Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 20 Dec 2023 01:07:42 +0900 Subject: [PATCH 14/43] =?UTF-8?q?[Update]=20Add=20feature,=20Send=20Only?= =?UTF-8?q?=20Translated=20Messages:=20=E7=BF=BB=E8=A8=B3=E3=82=AA?= =?UTF-8?q?=E3=83=B3=E6=99=82=E3=80=81=E7=BF=BB=E8=A8=B3=E5=BE=8C=E3=81=AE?= =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AE=E3=81=BF?= =?UTF-8?q?=E3=82=92=E9=80=81=E4=BF=A1=E3=81=99=E3=82=8B=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 12 ++++++++++ controller.py | 22 +++++++++++++++++-- locales/en.yml | 3 +++ locales/ja.yml | 4 ++++ view.py | 6 +++++ .../createSettingBox_Others.py | 13 +++++++++++ 6 files changed, 58 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 7160e48c..b1afae4f 100644 --- a/config.py +++ b/config.py @@ -458,6 +458,17 @@ class Config: self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property + @json_serializable('ENABLE_SEND_ONLY_TRANSLATED_MESSAGES') + def ENABLE_SEND_ONLY_TRANSLATED_MESSAGES(self): + return self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES + + @ENABLE_SEND_ONLY_TRANSLATED_MESSAGES.setter + def ENABLE_SEND_ONLY_TRANSLATED_MESSAGES(self, value): + if isinstance(value, bool): + self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property @json_serializable('ENABLE_NOTICE_XSOVERLAY') def ENABLE_NOTICE_XSOVERLAY(self): @@ -655,6 +666,7 @@ class Config: self._RECEIVED_MESSAGE_FORMAT = "[message]" self._RECEIVED_MESSAGE_FORMAT_WITH_T = "[message]([translation])" self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True + self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_SEND_MESSAGE_TO_VRC = True self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # speaker2Chatbox diff --git a/controller.py b/controller.py index 7f4a0db4..d9b6dd89 100644 --- a/controller.py +++ b/controller.py @@ -58,9 +58,16 @@ def sendMicMessage(message): if config.ENABLE_TRANSCRIPTION_SEND is True: if config.ENABLE_SEND_MESSAGE_TO_VRC is True: - osc_message = messageFormatter("SEND", translation, message) + if config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES is True: + if config.ENABLE_TRANSLATION is False: + osc_message = messageFormatter("SEND", "", message) + else: + osc_message = messageFormatter("SEND", "", translation) + else: + osc_message = messageFormatter("SEND", translation, message) model.oscSendMessage(osc_message) + view.printToTextbox_SentMessage(message, translation) if config.ENABLE_LOGGER is True: if len(translation) > 0: @@ -187,7 +194,13 @@ def sendChatMessage(message): # send OSC message if config.ENABLE_SEND_MESSAGE_TO_VRC is True: - osc_message = messageFormatter("SEND", translation, message) + if config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES is True: + if config.ENABLE_TRANSLATION is False: + osc_message = messageFormatter("SEND", "", message) + else: + osc_message = messageFormatter("SEND", "", translation) + else: + osc_message = messageFormatter("SEND", translation, message) model.oscSendMessage(osc_message) # update textbox message log (Sent) @@ -650,6 +663,10 @@ def callbackSetEnableAutoClearMessageBox(value): print("callbackSetEnableAutoClearMessageBox", value) config.ENABLE_AUTO_CLEAR_MESSAGE_BOX = value +def callbackSetEnableSendOnlyTranslatedMessages(value): + print("callbackSetEnableSendOnlyTranslatedMessages", value) + config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = value + def callbackSetEnableNoticeXsoverlay(value): print("callbackSetEnableNoticeXsoverlay", value) config.ENABLE_NOTICE_XSOVERLAY = value @@ -856,6 +873,7 @@ def createMainWindow(): # Others Tab "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, + "callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages, "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, diff --git a/locales/en.yml b/locales/en.yml index a4b79641..f805540c 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -174,6 +174,9 @@ config_window: auto_clear_the_message_box: label: Auto Clear The Message Box + send_only_translated_messages: + label: Send Only Translated Messages + notice_xsoverlay: label: Notification XSOverlay (VR Only) desc: Notify received messages by using XSOverlay's notification feature. diff --git a/locales/ja.yml b/locales/ja.yml index 3b56cbcf..5cb6ef99 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -167,9 +167,13 @@ config_window: desc: 文字起こしされた単語数の下限値で、この数値を超えた場合のみ結果をログに表示します。 error_message: 0以上の数値を設定できます。 + auto_clear_the_message_box: label: 送信後はチャットボックスを空にする + send_only_translated_messages: + label: 翻訳後のメッセージのみ送信する + notice_xsoverlay: label: XSOverlayでの通知受け取り機能を有効 (VR限定) desc: 文字起こし(受信)されたメッセージをXSOverlayの機能を使って通知として受け取れます。 diff --git a/view.py b/view.py index 7b95a2f5..b1a89b26 100644 --- a/view.py +++ b/view.py @@ -334,6 +334,11 @@ class View(): CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX=None, VAR_ENABLE_AUTO_CLEAR_MESSAGE_BOX=BooleanVar(value=config.ENABLE_AUTO_CLEAR_MESSAGE_BOX), + VAR_LABEL_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=StringVar(value=i18n.t("config_window.send_only_translated_messages.label")), + VAR_DESC_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=None, + CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=None, + VAR_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=BooleanVar(value=config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES), + VAR_LABEL_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.label")), VAR_DESC_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.desc")), CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=None, @@ -546,6 +551,7 @@ class View(): # Others Tab self.view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = config_window_registers.get("callback_set_enable_auto_clear_chatbox", None) + self.view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = config_window_registers.get("callback_set_send_only_translated_messages", None) self.view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = config_window_registers.get("callback_set_enable_notice_xsoverlay", None) self.view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS = config_window_registers.get("callback_set_enable_auto_export_message_logs", None) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index d129a05d..de2e4394 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -14,6 +14,9 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v def checkbox_auto_clear_message_box_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX, checkbox_box_widget.get()) + def checkbox_send_only_translated_messages_callback(checkbox_box_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES, checkbox_box_widget.get()) + def checkbox_notice_xsoverlay_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) @@ -41,6 +44,16 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v config_window.sb__auto_clear_message_box.grid(row=row) row+=1 + config_window.sb__send_only_translated_messages = createSettingBoxCheckbox( + for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES, + checkbox_attr_name="sb__checkbox_send_only_translated_messages", + command=lambda: checkbox_send_only_translated_messages_callback(config_window.sb__checkbox_send_only_translated_messages), + variable=view_variable.VAR_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES, + ) + config_window.sb__send_only_translated_messages.grid(row=row) + row+=1 + config_window.sb__notice_xsoverlay = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY, From d982a7604898e34c5ac718d5a6f827ce3a9cb040 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 20 Dec 2023 10:28:23 +0900 Subject: [PATCH 15/43] =?UTF-8?q?[Refactor]=20=E3=83=AA=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=AF=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0=20=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=9F[deprecated](=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E6=99=82OSC=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF)=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E5=89=8A=E9=99=A4=E3=82=84=E3=80=81?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E8=BF=BD=E5=8A=A0=E3=80=81?= =?UTF-8?q?=E6=94=B9=E8=A1=8C=E8=AA=BF=E6=95=B4=E3=81=AA=E3=81=A9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 13 ------- controller.py | 36 +++++++------------ view.py | 7 ---- .../createSettingBox_Others.py | 20 +---------- 4 files changed, 14 insertions(+), 62 deletions(-) diff --git a/config.py b/config.py index b1afae4f..b0149e64 100644 --- a/config.py +++ b/config.py @@ -491,18 +491,6 @@ class Config: self._ENABLE_SEND_MESSAGE_TO_VRC = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) - # [deprecated] - # @property - # @json_serializable('STARTUP_OSC_ENABLED_CHECK') - # def STARTUP_OSC_ENABLED_CHECK(self): - # return self._STARTUP_OSC_ENABLED_CHECK - - # @STARTUP_OSC_ENABLED_CHECK.setter - # def STARTUP_OSC_ENABLED_CHECK(self, value): - # if isinstance(value, bool): - # self._STARTUP_OSC_ENABLED_CHECK = value - # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) - @property @json_serializable('SEND_MESSAGE_FORMAT') def SEND_MESSAGE_FORMAT(self): @@ -670,7 +658,6 @@ class Config: self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_SEND_MESSAGE_TO_VRC = True self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # speaker2Chatbox - # self._STARTUP_OSC_ENABLED_CHECK = True # [deprecated] self._ENABLE_LOGGER = False self._IS_CONFIG_WINDOW_COMPACT_MODE = False diff --git a/controller.py b/controller.py index d9b6dd89..6e5a50fd 100644 --- a/controller.py +++ b/controller.py @@ -345,9 +345,7 @@ def callbackCloseConfigWindow(): model.stopCheckMicEnergy() model.stopCheckSpeakerEnergy() view.initMicThresholdCheckButton() - # view.initProgressBar_MicEnergy() # ProgressBarに0をセットしたい view.initSpeakerThresholdCheckButton() - # view.initProgressBar_SpeakerEnergy() # ProgressBarに0をセットしたい if config.ENABLE_TRANSCRIPTION_SEND is True: startThreadingTranscriptionSendMessageOnCloseConfigWindow() @@ -413,6 +411,7 @@ def callbackSetUiLanguage(value): config.UI_LANGUAGE = value view.showRestartButtonIfRequired(locale=config.UI_LANGUAGE) + # Translation Tab def callbackSetDeeplAuthkey(value): print("callbackSetDeeplAuthkey", str(value)) @@ -434,7 +433,8 @@ def callbackSetDeeplAuthkey(value): config.AUTH_KEYS = auth_keys config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE) -# Transcription Tab (Mic) +# Transcription Tab +# Transcription (Mic) def callbackSetMicHost(value): print("callbackSetMicHost", value) config.CHOICE_MIC_HOST = value @@ -568,7 +568,7 @@ def callbackDeleteMicWordFilter(value): except Exception: print("There was no the target word in config.INPUT_MIC_WORD_FILTER") - +# Transcription (Speaker) def callbackSetSpeakerEnergyThreshold(value): print("callbackSetSpeakerEnergyThreshold", value) if value == "": @@ -592,7 +592,6 @@ def callbackSetSpeakerDynamicEnergyThreshold(value): else: view.openSpeakerEnergyThresholdWidget() - def setProgressBarSpeakerEnergy(energy): view.updateSetProgressBar_SpeakerEnergy(energy) @@ -680,6 +679,11 @@ def callbackSetEnableAutoExportMessageLogs(value): else: model.stopLogger() +def callbackSetEnableSendMessageToVrc(value): + print("callbackSetEnableSendMessageToVrc", value) + config.ENABLE_SEND_MESSAGE_TO_VRC = value + +# Others (Message Formats(Send) def callbackSetSendMessageFormat(value): print("callbackSetSendMessageFormat", value) if isUniqueStrings(["[message]"], value) is True: @@ -701,17 +705,7 @@ def callbackSetSendMessageFormatWithT(value): view.showErrorMessage_SendMessageFormatWithT() view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) - -def callbackSetEnableSendMessageToVrc(value): - print("callbackSetEnableSendMessageToVrc", value) - config.ENABLE_SEND_MESSAGE_TO_VRC = value - -# [deprecated] -# def callbackSetStartupOscEnabledCheck(value): -# print("callbackSetStartupOscEnabledCheck", value) -# config.STARTUP_OSC_ENABLED_CHECK = value - - +# Others (Message Formats(Received) def callbackSetReceivedMessageFormat(value): print("callbackSetReceivedMessageFormat", value) if isUniqueStrings(["[message]"], value) is True: @@ -722,7 +716,6 @@ def callbackSetReceivedMessageFormat(value): view.showErrorMessage_ReceivedMessageFormat() view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) - def callbackSetReceivedMessageFormatWithT(value): print("callbackSetReceivedMessageFormatWithT", value) if len(value) > 0: @@ -734,7 +727,6 @@ def callbackSetReceivedMessageFormatWithT(value): view.showErrorMessage_ReceivedMessageFormatWithT() view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) - # ---------------------Speaker2Chatbox--------------------- def callbackSetEnableSendReceivedMessageToVrc(value): print("callbackSetEnableSendReceivedMessageToVrc", value) @@ -755,6 +747,7 @@ def callbackSetOscPort(value): print("callbackSetOscPort", int(value)) config.OSC_PORT = int(value) + def initSetConfigByExeArguments(): parser = argparse.ArgumentParser() parser.add_argument("--ip") @@ -786,10 +779,6 @@ def createMainWindow(): # set word filter model.addKeywords() - # check OSC started [deprecated] - # if config.STARTUP_OSC_ENABLED_CHECK is True and config.ENABLE_SEND_MESSAGE_TO_VRC is True: - # model.checkOSCStarted(view.printToTextbox_OSCError) - # check Software Updated if model.checkSoftwareUpdated() is True: view.showUpdateAvailableButton() @@ -877,9 +866,10 @@ def createMainWindow(): "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, - # "callback_set_startup_osc_enabled_check": callbackSetStartupOscEnabledCheck, # [deprecated] + # Others(Message Formats(Send) "callback_set_send_message_format": callbackSetSendMessageFormat, "callback_set_send_message_format_with_t": callbackSetSendMessageFormatWithT, + # Others(Message Formats(Received) "callback_set_received_message_format": callbackSetReceivedMessageFormat, "callback_set_received_message_format_with_t": callbackSetReceivedMessageFormatWithT, diff --git a/view.py b/view.py index b1a89b26..3de218d5 100644 --- a/view.py +++ b/view.py @@ -355,12 +355,6 @@ class View(): CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC=None, VAR_ENABLE_SEND_MESSAGE_TO_VRC=BooleanVar(value=config.ENABLE_SEND_MESSAGE_TO_VRC), - # [deprecated] - # VAR_LABEL_STARTUP_OSC_ENABLED_CHECK=StringVar(value=i18n.t("config_window.startup_osc_enabled_check.label")), - # VAR_DESC_STARTUP_OSC_ENABLED_CHECK=StringVar(value=i18n.t("config_window.startup_osc_enabled_check.desc")), - # CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK=None, - # VAR_STARTUP_OSC_ENABLED_CHECK=BooleanVar(value=config.STARTUP_OSC_ENABLED_CHECK), - VAR_SECOND_TITLE_OTHERS_SEND_MESSAGE_FORMATS=StringVar(value=i18n.t("config_window.side_menu_labels.others_send_message_formats")), @@ -556,7 +550,6 @@ class View(): self.view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS = config_window_registers.get("callback_set_enable_auto_export_message_logs", None) self.view_variable.CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_message_to_vrc", None) - # self.view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK = config_window_registers.get("callback_set_startup_osc_enabled_check", None) #[deprecated] self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT = config_window_registers.get("callback_set_send_message_format", None) self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T = config_window_registers.get("callback_set_send_message_format_with_t", None) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index de2e4394..8a10fb6a 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -6,11 +6,8 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) createSettingBoxCheckbox = sbg.createSettingBoxCheckbox createSettingBoxAutoExportMessageLogs = sbg.createSettingBoxAutoExportMessageLogs - createSettingBox_Labels = sbg.createSettingBox_Labels - createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation - # 元 checkbox_auto_clear_chatbox_callback def checkbox_auto_clear_message_box_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX, checkbox_box_widget.get()) @@ -29,9 +26,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v def checkbox_enable_send_message_to_vrc_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC, checkbox_box_widget.get()) - # [deprecated] - # def checkbox_startup_osc_enabled_check_callback(checkbox_box_widget): - # callFunctionIfCallable(view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK, checkbox_box_widget.get()) row=0 config_window.sb__auto_clear_message_box = createSettingBoxCheckbox( @@ -86,16 +80,4 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v variable=view_variable.VAR_ENABLE_SEND_MESSAGE_TO_VRC, ) config_window.sb__enable_send_message_to_vrc.grid(row=row, pady=0) - row+=1 - - # [deprecated] - # config_window.sb__startup_osc_enabled_check = createSettingBoxCheckbox( - # for_var_label_text=view_variable.VAR_LABEL_STARTUP_OSC_ENABLED_CHECK, - # for_var_desc_text=view_variable.VAR_DESC_STARTUP_OSC_ENABLED_CHECK, - # checkbox_attr_name="sb__checkbox_startup_osc_enabled_check", - # command=lambda: checkbox_startup_osc_enabled_check_callback(config_window.sb__checkbox_startup_osc_enabled_check), - # variable=view_variable.VAR_STARTUP_OSC_ENABLED_CHECK, - # ) - # config_window.sb__startup_osc_enabled_check.grid(row=row, pady=0) - # row+=1 - + row+=1 \ No newline at end of file From 3fcaca917a7745486545483977a846b199ec4252 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:13:33 +0900 Subject: [PATCH 16/43] =?UTF-8?q?[Update]=20Main=20Window:=20Transcription?= =?UTF-8?q?=20Mic/Speaker=E3=81=AE=E3=82=AA=E3=83=B3=E3=83=BB=E3=82=AA?= =?UTF-8?q?=E3=83=95=E6=99=82=E3=81=AB=E3=80=81Language=20Settings?= =?UTF-8?q?=E9=83=A8=E5=88=86=E3=81=AB=E3=81=9D=E3=82=8C=E3=81=9E=E3=82=8C?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E8=A1=A8=E7=A4=BA=E3=80=82?= =?UTF-8?q?=E5=B0=91=E3=81=97=E3=81=AFYour=20Language=E3=81=A8Target=20Lan?= =?UTF-8?q?guage=E3=82=92=E6=84=8F=E5=9B=B3=E3=81=97=E3=81=9F=E3=82=82?= =?UTF-8?q?=E3=81=AE=E3=81=A8=E3=81=AF=E5=8F=8D=E5=AF=BE=E3=81=AB=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=97=E3=81=A6=E3=81=97=E3=81=BE=E3=81=86=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E8=A7=A3=E6=B6=88=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=81=8B=E3=81=AA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 4 ++++ view.py | 11 ++++++++++ .../createSidebarLanguagesSettings.py | 21 ++++++++++++++++++- vrct_gui/ui_managers/UiScalingManager.py | 3 +++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/controller.py b/controller.py index 6e5a50fd..8afef1bf 100644 --- a/controller.py +++ b/controller.py @@ -303,16 +303,20 @@ def callbackToggleTranscriptionSend(is_turned_on): config.ENABLE_TRANSCRIPTION_SEND = is_turned_on if config.ENABLE_TRANSCRIPTION_SEND is True: startThreadingTranscriptionSendMessage() + view.changeTranscriptionDisplayStatus("MIC_ON") else: stopThreadingTranscriptionSendMessage() + view.changeTranscriptionDisplayStatus("MIC_OFF") def callbackToggleTranscriptionReceive(is_turned_on): view.setMainWindowAllWidgetsStatusToDisabled() config.ENABLE_TRANSCRIPTION_RECEIVE = is_turned_on if config.ENABLE_TRANSCRIPTION_RECEIVE is True: startThreadingTranscriptionReceiveMessage() + view.changeTranscriptionDisplayStatus("SPEAKER_ON") else: stopThreadingTranscriptionReceiveMessage() + view.changeTranscriptionDisplayStatus("SPEAKER_OFF") def callbackToggleForeground(is_turned_on): config.ENABLE_FOREGROUND = is_turned_on diff --git a/view.py b/view.py index 3de218d5..ed187e5a 100644 --- a/view.py +++ b/view.py @@ -801,6 +801,17 @@ class View(): self.view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = False vrct_gui._disableMainWindowSidebarCompactMode() + def changeTranscriptionDisplayStatus(self, status): + match (status): + case "MIC_ON": + vrct_gui.sls__box_your_language_mic_status__enabled.place(relx=0.1, rely=0.2, anchor="center") + case "MIC_OFF": + vrct_gui.sls__box_your_language_mic_status__enabled.place_forget() + case "SPEAKER_ON": + vrct_gui.sls__box_target_language_speaker_status__enabled.place(relx=0.1, rely=0.2, anchor="center") + case "SPEAKER_OFF": + vrct_gui.sls__box_target_language_speaker_status__enabled.place_forget() + # Config Window def enableConfigWindowCompactMode(self): diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py index 7561e1ae..cbe96b4e 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py @@ -317,4 +317,23 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable): open_selectable_language_window_command=callbackOpenSelectableTargetLanguageWindow, variable=view_variable.VAR_TARGET_LANGUAGE ) - main_window.sls__box_target_language.grid(row=4, column=0, sticky="ew") \ No newline at end of file + main_window.sls__box_target_language.grid(row=4, column=0, sticky="ew") + + + + # Set Transcription ON/OFF Indicator Widgets + main_window.sls__box_your_language_mic_status__enabled = CTkLabel( + main_window.sls__box_your_language, + text=None, + height=0, + corner_radius=0, + image=CTkImage(settings.image_file.MIC_ICON_DISABLED, size=settings.uism.SLS__BOX_TRANSCRIPTION_STATUS_IMAGE_SIZE), + ) + + main_window.sls__box_target_language_speaker_status__enabled = CTkLabel( + main_window.sls__box_target_language, + text=None, + height=0, + corner_radius=0, + image=CTkImage(settings.image_file.HEADPHONES_ICON_DISABLED, size=settings.uism.SLS__BOX_TRANSCRIPTION_STATUS_IMAGE_SIZE), + ) \ No newline at end of file diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index b3e7f937..08782d05 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -86,6 +86,9 @@ class UiScalingManager(): self.main.SLS__PRESET_TAB_NUMBER_CORNER_RADIUS = self._calculateUiSize(6) self.main.SLS__PRESET_TAB_NUMBER_ADJUSTED_HEIGHT = self._calculateUiSize(36) + self.main.SLS__BOX_TRANSCRIPTION_STATUS_IMAGE_SIZE = self.dupTuple(self._calculateUiSize(14)) + + self.main.SLS__BOX_SECTION_TITLE_FONT_SIZE = self._calculateUiSize(16) self.main.SLS__BOX_SECTION_TITLE_BOTTOM_PADY = self._calculateUiSize(10) self.main.SLS__BOX_IPADX = self._calculateUiSize(10) From dccbfb7e5da04b4621647a3299f3053f0e581818 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 20 Dec 2023 16:20:56 +0900 Subject: [PATCH 17/43] =?UTF-8?q?[Update]=20Config=20Window:=20=E3=82=B9?= =?UTF-8?q?=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB(y=E8=BB=B8)=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E3=82=92=E4=B8=8A=E3=81=92=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82CustomizedCTkScrollableFrame=E3=81=A8=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9=E3=83=AA=E3=82=92?= =?UTF-8?q?=E3=82=AA=E3=83=BC=E3=83=90=E3=83=BC=E3=83=A9=E3=82=A4=E3=83=89?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=81=BE=E3=81=99=E3=80=82=20?= =?UTF-8?q?=E9=81=A9=E7=94=A8=E3=81=97=E3=81=9F=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE=E5=85=88=E9=A0=AD?= =?UTF-8?q?=E3=81=AB=E3=81=9F=E3=81=A0=E6=9B=B8=E3=81=84=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=82=8B=E3=81=A0=E3=81=91=E3=81=AE=E7=8A=B6=E6=85=8B=E3=81=A7?= =?UTF-8?q?=E3=81=99=E3=80=82=E3=81=84=E3=81=9A=E3=82=8C=E5=88=87=E3=82=8A?= =?UTF-8?q?=E5=87=BA=E3=81=97=E3=81=9F=E3=81=BB=E3=81=86=E3=81=8C=E8=89=AF?= =?UTF-8?q?=E3=81=84=E3=81=8B=E3=82=82=E3=81=97=E3=82=8C=E3=81=BE=E3=81=9B?= =?UTF-8?q?=E3=82=93=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../createSideMenuAndSettingsBoxContainers.py | 83 ++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index 232d98ca..f0a547de 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -1,4 +1,83 @@ -from customtkinter import CTkFrame, CTkScrollableFrame +# Override customtkinter's CTkScrollableFrame for scrolling speed up +from customtkinter import CTkFrame, CTkScrollableFrame, CTkFont +from typing import Union, Tuple, Optional +import sys +try: + from typing import Literal +except ImportError: + from typing_extensions import Literal + +class CustomizedCTkScrollableFrame(CTkScrollableFrame): + def __init__( + self, + master: any, + width: int = 200, + height: int = 200, + corner_radius: Optional[Union[int, str]] = None, + border_width: Optional[Union[int, str]] = None, + + bg_color: Union[str, Tuple[str, str]] = "transparent", + fg_color: Optional[Union[str, Tuple[str, str]]] = None, + border_color: Optional[Union[str, Tuple[str, str]]] = None, + scrollbar_fg_color: Optional[Union[str, Tuple[str, str]]] = None, + scrollbar_button_color: Optional[Union[str, Tuple[str, str]]] = None, + scrollbar_button_hover_color: Optional[Union[str, Tuple[str, str]]] = None, + label_fg_color: Optional[Union[str, Tuple[str, str]]] = None, + label_text_color: Optional[Union[str, Tuple[str, str]]] = None, + + label_text: str = "", + label_font: Optional[Union[tuple, CTkFont]] = None, + label_anchor: str = "center", + orientation: Literal["vertical", "horizontal"] = "vertical" + ): + + super().__init__( + master, + width, + height, + corner_radius, + border_width, + + bg_color, + fg_color, + border_color, + scrollbar_fg_color, + scrollbar_button_color, + scrollbar_button_hover_color, + label_fg_color, + label_text_color, + + label_text, + label_font, + label_anchor, + orientation, + ) + + def _mouse_wheel_all(self, event): + if self.check_if_master_is_canvas(event.widget): + if sys.platform.startswith("win"): + if self._shift_pressed: + if self._parent_canvas.xview() != (0.0, 1.0): + self._parent_canvas.xview("scroll", -int(event.delta / 6), "units") + else: + if self._parent_canvas.yview() != (0.0, 1.0): + self._parent_canvas.yview("scroll", -int(event.delta / 2), "units") + elif sys.platform == "darwin": + if self._shift_pressed: + if self._parent_canvas.xview() != (0.0, 1.0): + self._parent_canvas.xview("scroll", -event.delta, "units") + else: + if self._parent_canvas.yview() != (0.0, 1.0): + self._parent_canvas.yview("scroll", -event.delta, "units") + else: + if self._shift_pressed: + if self._parent_canvas.xview() != (0.0, 1.0): + self._parent_canvas.xview("scroll", -event.delta, "units") + else: + if self._parent_canvas.yview() != (0.0, 1.0): + self._parent_canvas.yview("scroll", -event.delta, "units") +# Override customtkinter's CTkScrollableFrame for scrolling speed up__ + from ....ui_utils import setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar @@ -38,7 +117,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl # Setting box container config_window.main_bg_container.grid_rowconfigure(1, weight=1) - config_window.main_setting_box_scrollable_container = CTkScrollableFrame(config_window.main_bg_container, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR) + config_window.main_setting_box_scrollable_container = CustomizedCTkScrollableFrame(config_window.main_bg_container, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR) config_window.main_setting_box_scrollable_container.grid(row=1, column=0, sticky="nsew") applyUiScalingAndFixTheBugScrollBar( From b668d6fd21929c6351fd6fba54b22760bc0212d3 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:36:23 +0900 Subject: [PATCH 18/43] =?UTF-8?q?[Update]=20Main=20Window:=20=E8=A8=80?= =?UTF-8?q?=E8=AA=9E=E9=81=B8=E6=8A=9E=E6=99=82=E3=81=AE=E3=82=B9=E3=82=AF?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=83=AB=E9=80=9F=E5=BA=A6UP=E3=80=82?= =?UTF-8?q?=E3=81=9D=E3=82=8C=E3=81=AB=E3=81=A8=E3=82=82=E3=81=AA=E3=81=84?= =?UTF-8?q?CustomizedCTkScrollableFrame=E3=82=92=E5=88=A5=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=A8=E3=81=97=E3=81=A6=E5=88=87?= =?UTF-8?q?=E3=82=8A=E5=87=BA=E3=81=97=E3=80=81ui=5Futils=E3=81=8B?= =?UTF-8?q?=E3=82=89import=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateSelectableLanguagesWindow.py | 6 +- .../createSideMenuAndSettingsBoxContainers.py | 83 +------------------ .../ui_utils/CustomizedCTkScrollableFrame.py | 79 ++++++++++++++++++ vrct_gui/ui_utils/__init__.py | 3 +- 4 files changed, 86 insertions(+), 85 deletions(-) create mode 100644 vrct_gui/ui_utils/CustomizedCTkScrollableFrame.py diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index 8c666a20..dd6c6327 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -1,9 +1,9 @@ from functools import partial -from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, applyUiScalingAndFixTheBugScrollBar +from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, applyUiScalingAndFixTheBugScrollBar, CustomizedCTkScrollableFrame from utils import callFunctionIfCallable, makeEven -from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont, CTkScrollableFrame +from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont class _CreateSelectableLanguagesWindow(CTkToplevel): def __init__(self, vrct_gui, settings, view_variable): @@ -116,7 +116,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): - self.scroll_frame_container = CTkScrollableFrame(self, corner_radius=0, fg_color=self.settings.ctm.MAIN_BG_COLOR, width=self.width_new, height=self.height_new) + self.scroll_frame_container = CustomizedCTkScrollableFrame(self, corner_radius=0, fg_color=self.settings.ctm.MAIN_BG_COLOR, width=self.width_new, height=self.height_new) self.scroll_frame_container.grid(row=1, column=0, sticky="nsew") applyUiScalingAndFixTheBugScrollBar( diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index f0a547de..30af50de 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -1,85 +1,6 @@ -# Override customtkinter's CTkScrollableFrame for scrolling speed up -from customtkinter import CTkFrame, CTkScrollableFrame, CTkFont -from typing import Union, Tuple, Optional -import sys -try: - from typing import Literal -except ImportError: - from typing_extensions import Literal +from customtkinter import CTkFrame -class CustomizedCTkScrollableFrame(CTkScrollableFrame): - def __init__( - self, - master: any, - width: int = 200, - height: int = 200, - corner_radius: Optional[Union[int, str]] = None, - border_width: Optional[Union[int, str]] = None, - - bg_color: Union[str, Tuple[str, str]] = "transparent", - fg_color: Optional[Union[str, Tuple[str, str]]] = None, - border_color: Optional[Union[str, Tuple[str, str]]] = None, - scrollbar_fg_color: Optional[Union[str, Tuple[str, str]]] = None, - scrollbar_button_color: Optional[Union[str, Tuple[str, str]]] = None, - scrollbar_button_hover_color: Optional[Union[str, Tuple[str, str]]] = None, - label_fg_color: Optional[Union[str, Tuple[str, str]]] = None, - label_text_color: Optional[Union[str, Tuple[str, str]]] = None, - - label_text: str = "", - label_font: Optional[Union[tuple, CTkFont]] = None, - label_anchor: str = "center", - orientation: Literal["vertical", "horizontal"] = "vertical" - ): - - super().__init__( - master, - width, - height, - corner_radius, - border_width, - - bg_color, - fg_color, - border_color, - scrollbar_fg_color, - scrollbar_button_color, - scrollbar_button_hover_color, - label_fg_color, - label_text_color, - - label_text, - label_font, - label_anchor, - orientation, - ) - - def _mouse_wheel_all(self, event): - if self.check_if_master_is_canvas(event.widget): - if sys.platform.startswith("win"): - if self._shift_pressed: - if self._parent_canvas.xview() != (0.0, 1.0): - self._parent_canvas.xview("scroll", -int(event.delta / 6), "units") - else: - if self._parent_canvas.yview() != (0.0, 1.0): - self._parent_canvas.yview("scroll", -int(event.delta / 2), "units") - elif sys.platform == "darwin": - if self._shift_pressed: - if self._parent_canvas.xview() != (0.0, 1.0): - self._parent_canvas.xview("scroll", -event.delta, "units") - else: - if self._parent_canvas.yview() != (0.0, 1.0): - self._parent_canvas.yview("scroll", -event.delta, "units") - else: - if self._shift_pressed: - if self._parent_canvas.xview() != (0.0, 1.0): - self._parent_canvas.xview("scroll", -event.delta, "units") - else: - if self._parent_canvas.yview() != (0.0, 1.0): - self._parent_canvas.yview("scroll", -event.delta, "units") -# Override customtkinter's CTkScrollableFrame for scrolling speed up__ - - -from ....ui_utils import setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar +from ....ui_utils import setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar, CustomizedCTkScrollableFrame from ._addConfigSideMenuItem import _addConfigSideMenuItem from ._createSettingBoxContainer import _createSettingBoxContainer diff --git a/vrct_gui/ui_utils/CustomizedCTkScrollableFrame.py b/vrct_gui/ui_utils/CustomizedCTkScrollableFrame.py new file mode 100644 index 00000000..16b5460f --- /dev/null +++ b/vrct_gui/ui_utils/CustomizedCTkScrollableFrame.py @@ -0,0 +1,79 @@ +# Override customtkinter's CTkScrollableFrame for scrolling speed up +from customtkinter import CTkScrollableFrame, CTkFont +from typing import Union, Tuple, Optional +import sys +try: + from typing import Literal +except ImportError: + from typing_extensions import Literal + +class CustomizedCTkScrollableFrame(CTkScrollableFrame): + def __init__( + self, + master: any, + width: int = 200, + height: int = 200, + corner_radius: Optional[Union[int, str]] = None, + border_width: Optional[Union[int, str]] = None, + + bg_color: Union[str, Tuple[str, str]] = "transparent", + fg_color: Optional[Union[str, Tuple[str, str]]] = None, + border_color: Optional[Union[str, Tuple[str, str]]] = None, + scrollbar_fg_color: Optional[Union[str, Tuple[str, str]]] = None, + scrollbar_button_color: Optional[Union[str, Tuple[str, str]]] = None, + scrollbar_button_hover_color: Optional[Union[str, Tuple[str, str]]] = None, + label_fg_color: Optional[Union[str, Tuple[str, str]]] = None, + label_text_color: Optional[Union[str, Tuple[str, str]]] = None, + + label_text: str = "", + label_font: Optional[Union[tuple, CTkFont]] = None, + label_anchor: str = "center", + orientation: Literal["vertical", "horizontal"] = "vertical" + ): + + super().__init__( + master, + width, + height, + corner_radius, + border_width, + + bg_color, + fg_color, + border_color, + scrollbar_fg_color, + scrollbar_button_color, + scrollbar_button_hover_color, + label_fg_color, + label_text_color, + + label_text, + label_font, + label_anchor, + orientation, + ) + + def _mouse_wheel_all(self, event): + if self.check_if_master_is_canvas(event.widget): + if sys.platform.startswith("win"): + if self._shift_pressed: + if self._parent_canvas.xview() != (0.0, 1.0): + self._parent_canvas.xview("scroll", -int(event.delta / 6), "units") + else: + if self._parent_canvas.yview() != (0.0, 1.0): + self._parent_canvas.yview("scroll", -int(event.delta / 2), "units") + + elif sys.platform == "darwin": + if self._shift_pressed: + if self._parent_canvas.xview() != (0.0, 1.0): + self._parent_canvas.xview("scroll", -event.delta, "units") + else: + if self._parent_canvas.yview() != (0.0, 1.0): + self._parent_canvas.yview("scroll", -event.delta, "units") + else: + if self._shift_pressed: + if self._parent_canvas.xview() != (0.0, 1.0): + self._parent_canvas.xview("scroll", -event.delta, "units") + else: + if self._parent_canvas.yview() != (0.0, 1.0): + self._parent_canvas.yview("scroll", -event.delta, "units") \ No newline at end of file diff --git a/vrct_gui/ui_utils/__init__.py b/vrct_gui/ui_utils/__init__.py index bc2a1337..49ee911d 100644 --- a/vrct_gui/ui_utils/__init__.py +++ b/vrct_gui/ui_utils/__init__.py @@ -1 +1,2 @@ -from .ui_utils import * \ No newline at end of file +from .ui_utils import * +from .CustomizedCTkScrollableFrame import CustomizedCTkScrollableFrame \ No newline at end of file From 7c23adfc244108a1e2bd875e4753fba2320cd0fc Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 29 Dec 2023 01:24:54 +0900 Subject: [PATCH 19/43] =?UTF-8?q?[Update]=20Main=20Window:=20Message=20Box?= =?UTF-8?q?.=20=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E5=85=A5?= =?UTF-8?q?=E5=8A=9B=E6=AC=84=E3=81=AE=E3=82=B5=E3=82=A4=E3=82=BA=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=80=82=E5=8E=B3=E5=AF=86=E3=81=AA=E8=A8=88=E7=AE=97?= =?UTF-8?q?=E3=81=AF=E3=81=97=E3=81=A6=E3=81=BE=E3=81=9B=E3=82=93=E3=80=82?= =?UTF-8?q?=20=E3=80=90=E8=A6=8B=E3=81=9F=E7=9B=AE=E3=81=B8=E3=81=AE?= =?UTF-8?q?=E5=BD=B1=E9=9F=BF=E5=A4=A7=E3=80=91=E3=83=87=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=88=E3=81=AE=E3=83=81=E3=83=A3=E3=83=83=E3=83=88?= =?UTF-8?q?=E5=85=A5=E5=8A=9B=E6=AC=84=E3=82=92=E5=B0=91=E3=81=97=E5=A4=A7?= =?UTF-8?q?=E3=81=8D=E3=81=8F=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= =?UTF-8?q?=EF=BC=88=E3=82=82=E3=81=A1=E3=82=8D=E3=82=93=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=EF=BC=89=20=E3=83=86=E3=82=AD?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=81=A8?= =?UTF-8?q?=E3=81=AE=E6=AF=94=E7=8E=87=E3=81=A8=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=81=A7=E3=80=81Window=E3=82=B5=E3=82=A4?= =?UTF-8?q?=E3=82=BA=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=80=81=E3=81=9D=E3=82=8C=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B?= =?UTF-8?q?=E3=81=A6=E5=8F=AF=E5=A4=89=E3=81=97=E3=81=BE=E3=81=99=E3=80=82?= =?UTF-8?q?=20CTkEntry=E3=81=8B=E3=82=89CTkTextbox=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82=E3=83=97?= =?UTF-8?q?=E3=83=AC=E3=83=BC=E3=82=B9=E3=83=9B=E3=83=AB=E3=83=80=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E4=BD=BF=E7=94=A8=E3=81=8C=E5=8E=B3=E3=81=97=E3=81=8F?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E5=BB=83=E6=AD=A2?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=A6=E3=82=82=E3=80=81=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E4=B8=AD=E3=81=AE=E4=BD=8D=E7=BD=AE=E3=81=8C=E4=B8=AD=E5=A4=AE?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=89=E3=81=AA=E3=81=84=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=80=81=E3=83=87=E3=82=B6=E3=82=A4=E3=83=B3=E3=81=8C=E8=8B=A5?= =?UTF-8?q?=E5=B9=B2=E5=B4=A9=E3=82=8C=E3=81=BE=E3=81=97=E3=81=9F=E3=81=8C?= =?UTF-8?q?=E8=A8=B1=E5=AE=B9=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 12 +++++++ controller.py | 8 ++++- locales/en.yml | 4 +++ locales/ja.yml | 4 +++ view.py | 33 +++++++++++++++++-- vrct_gui/_changeMainWindowWidgetsStatus.py | 6 ++-- .../createSettingBox_Appearance.py | 16 +++++++++ .../widgets/create_entry_message_box.py | 13 ++++---- .../main_window/widgets/create_textbox.py | 1 + vrct_gui/ui_managers/UiScalingManager.py | 3 +- 10 files changed, 85 insertions(+), 15 deletions(-) diff --git a/config.py b/config.py index b0149e64..a7f2401b 100644 --- a/config.py +++ b/config.py @@ -244,6 +244,17 @@ class Config: self._TEXTBOX_UI_SCALING = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property + @json_serializable('MESSAGE_BOX_RATIO') + def MESSAGE_BOX_RATIO(self): + return self._MESSAGE_BOX_RATIO + + @MESSAGE_BOX_RATIO.setter + def MESSAGE_BOX_RATIO(self, value): + if isinstance(value, int) and 1 <= value <= 99: + self._MESSAGE_BOX_RATIO = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property @json_serializable('FONT_FAMILY') def FONT_FAMILY(self): @@ -626,6 +637,7 @@ class Config: self._APPEARANCE_THEME = "System" self._UI_SCALING = "100%" self._TEXTBOX_UI_SCALING = 100 + self._MESSAGE_BOX_RATIO = 10 self._FONT_FAMILY = "Yu Gothic UI" self._UI_LANGUAGE = "en" self._CHOICE_MIC_HOST = getDefaultInputDevice()["host"]["name"] diff --git a/controller.py b/controller.py index 8afef1bf..9096dcd8 100644 --- a/controller.py +++ b/controller.py @@ -214,7 +214,7 @@ def sendChatMessage(message): if config.ENABLE_AUTO_CLEAR_MESSAGE_BOX is True: view.clearMessageBox() -def messageBoxPressKeyEnter(e): +def messageBoxPressKeyEnter(): model.oscStopSendTyping() message = view.getTextFromMessageBox() sendChatMessage(message) @@ -403,6 +403,11 @@ def callbackSetTextboxUiScaling(value): config.TEXTBOX_UI_SCALING = int(value) view.setMainWindowTextboxUiSize(config.TEXTBOX_UI_SCALING/100) +def callbackSetMessageBoxRatio(value): + print("callbackSetMessageBoxRatio", int(value)) + config.MESSAGE_BOX_RATIO = int(value) + view.setMainWindowMessageBoxRatio(config.MESSAGE_BOX_RATIO) + def callbackSetFontFamily(value): print("callbackSetFontFamily", value) config.FONT_FAMILY = value @@ -836,6 +841,7 @@ def createMainWindow(): "callback_set_appearance": callbackSetAppearance, "callback_set_ui_scaling": callbackSetUiScaling, "callback_set_textbox_ui_scaling": callbackSetTextboxUiScaling, + "callback_set_message_box_ratio": callbackSetMessageBoxRatio, "callback_set_font_family": callbackSetFontFamily, "callback_set_ui_language": callbackSetUiLanguage, diff --git a/locales/en.yml b/locales/en.yml index f805540c..dbfc39c6 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -103,6 +103,10 @@ config_window: label: Text Box Font Size desc: You can adjust the font size used in the logs relative to the UI size. + message_box_ratio: + label: Message Box Size + desc: "You can change the size of the input message box. It is in ratio to the text box.\n*No exact calculations." + font_family: label: Font Family diff --git a/locales/ja.yml b/locales/ja.yml index 5cb6ef99..cca4e254 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -100,6 +100,10 @@ config_window: label: テキストボックス フォントサイズ desc: ログに表示されるフォントのサイズを、UIサイズを基準にして倍率を変えられます。 + message_box_ratio: + label: メッセージ入力欄のサイズ + desc: "メッセージ入力欄のサイズを変更できます。テキストボックスとの比率となっています。\n※厳密な計算はしていません。" + font_family: label: 使用フォント diff --git a/view.py b/view.py index ed187e5a..46973a39 100644 --- a/view.py +++ b/view.py @@ -220,6 +220,14 @@ class View(): CALLBACK_BUTTON_PRESS_TEXTBOX_UI_SCALING=self._closeTheCoverOfMainWindow, CALLBACK_BUTTON_RELEASE_TEXTBOX_UI_SCALING=self._openTheCoverOfMainWindow, + VAR_LABEL_MESSAGE_BOX_RATIO=StringVar(value=i18n.t("config_window.message_box_ratio.label")), + VAR_DESC_MESSAGE_BOX_RATIO=StringVar(value=i18n.t("config_window.message_box_ratio.desc")), + SLIDER_RANGE_MESSAGE_BOX_RATIO=(1, 99), + CALLBACK_SET_MESSAGE_BOX_RATIO=None, + VAR_MESSAGE_BOX_RATIO=IntVar(value=config.MESSAGE_BOX_RATIO), + CALLBACK_BUTTON_PRESS_MESSAGE_BOX_RATIO=self._closeTheCoverOfMainWindow, + CALLBACK_BUTTON_RELEASE_MESSAGE_BOX_RATIO=self._openTheCoverOfMainWindow, + VAR_LABEL_FONT_FAMILY=StringVar(value=i18n.t("config_window.font_family.label")), VAR_DESC_FONT_FAMILY=None, LIST_FONT_FAMILY=self.getAvailableFonts(), @@ -480,8 +488,12 @@ class View(): self.view_variable.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB = main_window_registers.get("callback_selected_language_preset_tab", None) + def adjustedMessageBoxReturnFunction(_e): + main_window_registers.get("message_box_bind_Return")() + return "break" + entry_message_box = getattr(vrct_gui, "entry_message_box") - entry_message_box.bind("", main_window_registers.get("message_box_bind_Return")) + entry_message_box.bind("", adjustedMessageBoxReturnFunction) entry_message_box.bind("", main_window_registers.get("message_box_bind_Any_KeyPress")) @@ -512,6 +524,7 @@ class View(): self.view_variable.CALLBACK_SET_APPEARANCE = config_window_registers.get("callback_set_appearance", None) self.view_variable.CALLBACK_SET_UI_SCALING = config_window_registers.get("callback_set_ui_scaling", None) self.view_variable.CALLBACK_SET_TEXTBOX_UI_SCALING = config_window_registers.get("callback_set_textbox_ui_scaling", None) + self.view_variable.CALLBACK_SET_MESSAGE_BOX_RATIO = config_window_registers.get("callback_set_message_box_ratio", None) self.view_variable.CALLBACK_SET_FONT_FAMILY = config_window_registers.get("callback_set_font_family", None) self.view_variable.CALLBACK_SET_UI_LANGUAGE = config_window_registers.get("callback_set_ui_language", None) @@ -571,6 +584,7 @@ class View(): self.enableConfigWindowCompactMode() vrct_gui.config_window.setting_box_compact_mode_switch_box.select() + self.setMainWindowMessageBoxRatio(config.MESSAGE_BOX_RATIO) if config.CHOICE_MIC_HOST == "NoHost": self.view_variable.VAR_MIC_HOST.set("No Mic Host Detected") @@ -774,7 +788,7 @@ class View(): # Common @staticmethod def _clearEntryBox(entry_widget): - entry_widget.delete(0, CTK_END) + entry_widget.delete("1.0", "end-1c") def clearErrorMessage(self): vrct_gui._clearErrorMessage() @@ -1063,6 +1077,19 @@ class View(): def setMainWindowTextboxUiSize(custom_font_size_scale:float): vrct_gui.print_to_textbox.setTagsSettings(custom_font_size_scale=custom_font_size_scale) + @staticmethod + def setMainWindowMessageBoxRatio(message_box_ratio:int): + if message_box_ratio <= 0 or message_box_ratio > 99: + raise ValueError("Input must be between 1 and 99 (inclusive)") + + vrct_gui.main_bg_container.grid_rowconfigure(tuple(range(1, 101)), weight=1) + textbox_ratio = int(100 - message_box_ratio) + message_box_row = int(textbox_ratio + 1) + message_box_rowwpan = int(100 - textbox_ratio) + # print(textbox_ratio, message_box_row, message_box_rowwpan) + vrct_gui.main_textbox_container.grid(row=1, rowspan=textbox_ratio, column=0, sticky="nsew") + vrct_gui.main_entry_message_container.grid(row=message_box_row, rowspan=message_box_rowwpan, column=0, sticky="nsew") + # Function def _adjustUiSizeAndRestart(self): current_percentage = int(config.UI_SCALING.replace("%","")) @@ -1394,7 +1421,7 @@ class View(): # Message Box @staticmethod def getTextFromMessageBox(): - return vrct_gui.entry_message_box.get() + return vrct_gui.entry_message_box.get('1.0', CTK_END) def clearMessageBox(self): self._clearEntryBox(vrct_gui.entry_message_box) diff --git a/vrct_gui/_changeMainWindowWidgetsStatus.py b/vrct_gui/_changeMainWindowWidgetsStatus.py index 53c29f2a..75668102 100644 --- a/vrct_gui/_changeMainWindowWidgetsStatus.py +++ b/vrct_gui/_changeMainWindowWidgetsStatus.py @@ -141,9 +141,11 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta case "entry_message_box": if status == "disabled": - vrct_gui.entry_message_box.configure(state="disabled", placeholder_text_color=settings.ctm.TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR, text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR) + pass + vrct_gui.entry_message_box.configure(state="disabled", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR) elif status == "normal": - vrct_gui.entry_message_box.configure(state="normal", placeholder_text_color=settings.ctm.TEXTBOX_ENTRY_PLACEHOLDER_COLOR, text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR) + pass + vrct_gui.entry_message_box.configure(state="normal", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR) case _: diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py index dd5f68ab..a228e5a1 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py @@ -21,6 +21,9 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi def slider_text_box_ui_scaling_callback(value): callFunctionIfCallable(view_variable.CALLBACK_SET_TEXTBOX_UI_SCALING, value) + def slider_message_box_ratio_callback(value): + callFunctionIfCallable(view_variable.CALLBACK_SET_MESSAGE_BOX_RATIO, value) + def optionmenu_font_family_callback(value): callFunctionIfCallable(view_variable.CALLBACK_SET_FONT_FAMILY, value) @@ -82,6 +85,19 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi config_window.sb__textbox_uis_scaling.grid(row=row) row+=1 + config_window.sb__message_box_ratio = createSettingBoxSlider( + for_var_label_text=view_variable.VAR_LABEL_MESSAGE_BOX_RATIO, + for_var_desc_text=view_variable.VAR_DESC_MESSAGE_BOX_RATIO, + slider_attr_name="sb__slider_message_box_ratio", + slider_range=view_variable.SLIDER_RANGE_MESSAGE_BOX_RATIO, + command=lambda value: slider_message_box_ratio_callback(value), + variable=view_variable.VAR_MESSAGE_BOX_RATIO, + slider_bind__ButtonPress=view_variable.CALLBACK_BUTTON_PRESS_MESSAGE_BOX_RATIO, + slider_bind__ButtonRelease=view_variable.CALLBACK_BUTTON_RELEASE_MESSAGE_BOX_RATIO, + sliderTooltipFormatter=view_variable.CALLBACK_SLIDER_TOOLTIP_PERCENTAGE_FORMATTER, + ) + config_window.sb__message_box_ratio.grid(row=row) + row+=1 config_window.sb__font_family = createSettingBoxDropdownMenu( for_var_label_text=view_variable.VAR_LABEL_FONT_FAMILY, diff --git a/vrct_gui/main_window/widgets/create_entry_message_box.py b/vrct_gui/main_window/widgets/create_entry_message_box.py index e583234f..2be17e9c 100644 --- a/vrct_gui/main_window/widgets/create_entry_message_box.py +++ b/vrct_gui/main_window/widgets/create_entry_message_box.py @@ -1,23 +1,22 @@ -from customtkinter import CTkFont, CTkFrame, CTkEntry +from customtkinter import CTkFont, CTkFrame, CTkTextbox def createEntryMessageBox(settings, main_window): main_window.main_entry_message_container = CTkFrame(main_window.main_bg_container, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0) - main_window.main_entry_message_container.grid(row=2, column=0, sticky="ew") + main_window.main_entry_message_container.grid(row=2, column=0, sticky="nsew") main_window.main_entry_message_container.grid_columnconfigure(0, weight=1) - main_window.entry_message_box = CTkEntry( + main_window.main_entry_message_container.grid_rowconfigure(0, weight=1) + main_window.entry_message_box = CTkTextbox( main_window.main_entry_message_container, border_color=settings.ctm.TEXTBOX_ENTRY_BORDER_COLOR, fg_color=settings.ctm.TEXTBOX_ENTRY_BG_COLOR, text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR, - placeholder_text="Enter your message...", - placeholder_text_color=settings.ctm.TEXTBOX_ENTRY_PLACEHOLDER_COLOR, - height=settings.uism.TEXTBOX_ENTRY_HEIGHT, + border_width=settings.uism.TEXTBOX_ENTRY_BORDER_SIZE, + height=0, font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.TEXTBOX_ENTRY_FONT_SIZE, weight="normal"), ) 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._entry.grid(padx=settings.uism.TEXTBOX_ENTRY_IPADX, pady=settings.uism.TEXTBOX_ENTRY_IPADY) def messageBoxAnyKeyPress(e): diff --git a/vrct_gui/main_window/widgets/create_textbox.py b/vrct_gui/main_window/widgets/create_textbox.py index 99e977f4..41203049 100644 --- a/vrct_gui/main_window/widgets/create_textbox.py +++ b/vrct_gui/main_window/widgets/create_textbox.py @@ -142,6 +142,7 @@ def createTextbox(settings, main_window, view_variable): fg_color=settings.ctm.TEXTBOX_BG_COLOR, text_color="lime", # Textbox's text_color is set when printing. so this is for prevent from non-setting text_color like the gloves used in food factories are blue. wrap="word", + height=0, )) textbox_widget = getattr(main_window, textbox_setting["textbox_attr_name"]) textbox_widget.grid(row=0, column=0, padx=settings.uism.TEXTBOX_PADX, pady=0, sticky="nsew") diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 08782d05..7c79e02e 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -50,11 +50,10 @@ class UiScalingManager(): self.main.TEXTBOX_FONT_SIZE__MAIN_TEXT_FONT = self._calculateUiSize(16) self.main.TEXTBOX_ENTRY_FONT_SIZE = self._calculateUiSize(16) + self.main.TEXTBOX_ENTRY_BORDER_SIZE = self._calculateUiSize(2, is_allowed_odd=True) self.main.TEXTBOX_ENTRY_HEIGHT = self._calculateUiSize(40) self.main.TEXTBOX_ENTRY_PADX = self.main.TEXTBOX_PADX self.main.TEXTBOX_ENTRY_PADY = self._calculateUiSize(10) - self.main.TEXTBOX_ENTRY_IPADX = self._calculateUiSize(14) - self.main.TEXTBOX_ENTRY_IPADY = (self._calculateUiSize(2, True), self._calculateUiSize(3, True)) # Sidebar From 1d380264e48927fef49f9c87dbe71eee927ccbe3 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 29 Dec 2023 02:20:58 +0900 Subject: [PATCH 20/43] =?UTF-8?q?[bugfix/chore]=20Main=20Window:=20Message?= =?UTF-8?q?=20Box.=20=E5=85=A5=E5=8A=9B=E3=83=9C=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=B9=E3=81=8C=E7=A9=BA=E3=81=AE=E7=8A=B6=E6=85=8B=E3=81=A7?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=BF=E3=83=BC=E3=82=AD=E3=83=BC=E3=82=92?= =?UTF-8?q?=E6=8A=BC=E3=81=97=E3=81=9F=E6=99=82=E3=81=AB=E9=80=81=E4=BF=A1?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=A6=E3=81=97=E3=81=BE=E3=81=86=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82=E2=80=BBCTkEntry=E3=81=8B?= =?UTF-8?q?=E3=82=89CTkTextbox=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=93=E3=81=A8=E3=81=AB=E3=82=88=E3=82=8B=E5=BD=B1?= =?UTF-8?q?=E9=9F=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view.py b/view.py index 46973a39..b105ffd6 100644 --- a/view.py +++ b/view.py @@ -490,7 +490,7 @@ class View(): def adjustedMessageBoxReturnFunction(_e): main_window_registers.get("message_box_bind_Return")() - return "break" + return "break" # For deleting the next line that will be inserted when the Enter key is pressed. entry_message_box = getattr(vrct_gui, "entry_message_box") entry_message_box.bind("", adjustedMessageBoxReturnFunction) @@ -788,7 +788,7 @@ class View(): # Common @staticmethod def _clearEntryBox(entry_widget): - entry_widget.delete("1.0", "end-1c") + entry_widget.delete("1.0", "end") def clearErrorMessage(self): vrct_gui._clearErrorMessage() @@ -1421,7 +1421,7 @@ class View(): # Message Box @staticmethod def getTextFromMessageBox(): - return vrct_gui.entry_message_box.get('1.0', CTK_END) + return vrct_gui.entry_message_box.get('1.0', "end-1c") def clearMessageBox(self): self._clearEntryBox(vrct_gui.entry_message_box) From 4eeb76f9fb6b37578f300f760d7d38811f266ad6 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 29 Dec 2023 03:22:34 +0900 Subject: [PATCH 21/43] =?UTF-8?q?[Update]=20UI:=20Theme=E3=81=AE=E3=83=87?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=E5=80=A4=E3=82=92System?= =?UTF-8?q?=E3=81=8B=E3=82=89Dark=E3=81=AB=E3=80=82Light=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=82=92=E4=BD=9C=E3=82=8A=E3=81=AF=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=8C=E3=80=81=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AB?= =?UTF-8?q?=E3=81=AF=E3=81=A7=E3=81=8D=E3=82=8B=E3=81=A0=E3=81=91Dark?= =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=9E=E3=82=92=E4=BD=BF=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E6=AC=B2=E3=81=97=E3=81=84=E3=81=9F=E3=82=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index a7f2401b..aac57a8d 100644 --- a/config.py +++ b/config.py @@ -634,7 +634,7 @@ class Config: ## Config Window self._TRANSPARENCY = 100 - self._APPEARANCE_THEME = "System" + self._APPEARANCE_THEME = "Dark" self._UI_SCALING = "100%" self._TEXTBOX_UI_SCALING = 100 self._MESSAGE_BOX_RATIO = 10 From 38edeaebf326e805bc5bcf59d948dbdcf6ef396a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 30 Dec 2023 17:25:29 +0900 Subject: [PATCH 22/43] =?UTF-8?q?[Update]=20Main=20Window:=20Add=20Restore?= =?UTF-8?q?=20the=20main=20window=20position=20feature.=20VRCT=E7=B5=82?= =?UTF-8?q?=E4=BA=86=E6=99=82=EF=BC=88=E3=83=A1=E3=82=A4=E3=83=B3=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=AEX=E3=82=92=E6=8A=BC=E3=81=97=E3=81=9F?= =?UTF-8?q?=E6=99=82=EF=BC=89=E3=81=AE=E7=94=BB=E9=9D=A2=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E3=81=A8=E3=82=B5=E3=82=A4=E3=82=BA=E3=82=92=E8=A8=98=E9=8C=B2?= =?UTF-8?q?=E3=81=97=E3=80=81=E6=AC=A1=E5=9B=9E=E8=B5=B7=E5=8B=95=E6=99=82?= =?UTF-8?q?=E3=81=AB=E5=90=8C=E3=81=98=E5=A0=B4=E6=89=80=E5=90=8C=E3=81=98?= =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=82=BA=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=95?= =?UTF-8?q?=E3=81=9B=E3=82=8B=E6=A9=9F=E8=83=BD=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=80=82=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=E3=81=A7?= =?UTF-8?q?=E3=82=AA=E3=83=B3=E3=81=A7=E3=81=99=E3=80=82=20=E2=80=BB?= =?UTF-8?q?=E6=AC=A1=E5=9B=9E=E3=82=A2=E3=83=97=E3=83=87=E5=BE=8C=E3=81=AE?= =?UTF-8?q?=E5=88=9D=E6=9C=9F=E8=B5=B7=E5=8B=95=E6=99=82=E3=81=AF=E3=81=BF?= =?UTF-8?q?=E3=82=93=E3=81=AA=E3=80=81=E4=B8=80=E7=95=AA=E5=B7=A6=E4=B8=8A?= =?UTF-8?q?=E7=AB=AF=E5=BA=A7=E6=A8=99x-0=20y-0=E3=81=A7=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=BE=E3=81=99=E3=80=82=E3=81=93=E3=81=AE?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=82=92=E3=82=AA=E3=83=95=E3=81=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=81=A8=E5=B8=B8=E3=81=AB=E7=94=BB=E9=9D=A2=E4=B8=AD?= =?UTF-8?q?=E5=A4=AE=EF=BC=88=E4=BB=8A=E3=81=BE=E3=81=A7=E9=80=9A=E3=82=8A?= =?UTF-8?q?=EF=BC=89=E3=81=AB=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=BE?= =?UTF-8?q?=E3=81=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 31 +++++++++++++++++++ controller.py | 9 ++++++ locales/en.yml | 4 +++ locales/ja.yml | 4 +++ view.py | 29 +++++++++++++++-- .../createSettingBox_Appearance.py | 15 ++++++++- .../main_window/createMainWindowWidgets.py | 2 +- vrct_gui/vrct_gui.py | 20 +++++++++--- 8 files changed, 105 insertions(+), 9 deletions(-) diff --git a/config.py b/config.py index aac57a8d..8c3398ef 100644 --- a/config.py +++ b/config.py @@ -280,6 +280,30 @@ class Config: self._UI_LANGUAGE = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property + @json_serializable('ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY') + def ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY(self): + return self._ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY + + @ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY.setter + def ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY(self, value): + if isinstance(value, bool): + self._ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + + @property + @json_serializable('MAIN_WINDOW_GEOMETRY') + def MAIN_WINDOW_GEOMETRY(self): + return self._MAIN_WINDOW_GEOMETRY + + @MAIN_WINDOW_GEOMETRY.setter + def MAIN_WINDOW_GEOMETRY(self, value): + if isinstance(value, dict) and set(value.keys()) == set(self.MAIN_WINDOW_GEOMETRY.keys()): + for key, value in value.items(): + if isinstance(value, str): + self._MAIN_WINDOW_GEOMETRY[key] = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.MAIN_WINDOW_GEOMETRY) + @property @json_serializable('CHOICE_MIC_HOST') def CHOICE_MIC_HOST(self): @@ -640,6 +664,13 @@ class Config: self._MESSAGE_BOX_RATIO = 10 self._FONT_FAMILY = "Yu Gothic UI" self._UI_LANGUAGE = "en" + self._ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY = True + self._MAIN_WINDOW_GEOMETRY = { + "x_pos": "0", + "y_pos": "0", + "width": "870", + "height": "640", + } self._CHOICE_MIC_HOST = getDefaultInputDevice()["host"]["name"] self._CHOICE_MIC_DEVICE = getDefaultInputDevice()["device"]["name"] self._INPUT_MIC_ENERGY_THRESHOLD = 300 diff --git a/controller.py b/controller.py index 9096dcd8..0f505099 100644 --- a/controller.py +++ b/controller.py @@ -23,6 +23,10 @@ def callbackFilepathConfigFile(): print("callbackFilepathConfigFile", config.LOCAL_PATH.replace('/', '\\')) Popen(['explorer', config.LOCAL_PATH.replace('/', '\\')], shell=True) +def callbackQuitVrct(): + main_window_geometry = view.getMainWindowGeometry() + config.MAIN_WINDOW_GEOMETRY = main_window_geometry + def messageFormatter(format_type:str, translation, message): if format_type == "RECEIVED": FORMAT_WITH_T = config.RECEIVED_MESSAGE_FORMAT_WITH_T @@ -420,6 +424,9 @@ def callbackSetUiLanguage(value): config.UI_LANGUAGE = value view.showRestartButtonIfRequired(locale=config.UI_LANGUAGE) +def callbackSetEnableRestoreMainWindowGeometry(value): + print("callbackSetEnableAutoClearMessageBox", value) + config.ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY = value # Translation Tab def callbackSetDeeplAuthkey(value): @@ -803,6 +810,7 @@ def createMainWindow(): "callback_restart_software": callbackRestartSoftware, "callback_filepath_logs": callbackFilepathLogs, "callback_filepath_config_file": callbackFilepathConfigFile, + "callback_quit_vrct": callbackQuitVrct, }, window_action_registers={ @@ -844,6 +852,7 @@ def createMainWindow(): "callback_set_message_box_ratio": callbackSetMessageBoxRatio, "callback_set_font_family": callbackSetFontFamily, "callback_set_ui_language": callbackSetUiLanguage, + "callback_set_enable_restore_main_window_geometry": callbackSetEnableRestoreMainWindowGeometry, # Translation Tab "callback_set_deepl_authkey": callbackSetDeeplAuthkey, diff --git a/locales/en.yml b/locales/en.yml index dbfc39c6..fd159673 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -113,6 +113,10 @@ config_window: ui_language: label: UI Language + to_restore_main_window_geometry: + label: Remember The Main Window Position + desc: Restore the position and size of the previous window upon startup. + deepl_auth_key: label: DeepL Auth Key diff --git a/locales/ja.yml b/locales/ja.yml index cca4e254..73337446 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -110,6 +110,10 @@ config_window: ui_language: label: UIの言語 / UI Language + to_restore_main_window_geometry: + label: メイン画面の位置を記憶する + desc: 起動時、前回の画面の位置とサイズを復元します。 + deepl_auth_key: label: DeepL 認証キー diff --git a/view.py b/view.py index b105ffd6..712821e7 100644 --- a/view.py +++ b/view.py @@ -45,6 +45,13 @@ class View(): self.settings.main = SimpleNamespace( ctm=all_ctm.main, uism=all_uism.main, + geometry=SimpleNamespace( + width=config.MAIN_WINDOW_GEOMETRY["width"], + height=config.MAIN_WINDOW_GEOMETRY["height"], + x_pos=config.MAIN_WINDOW_GEOMETRY["x_pos"], + y_pos=config.MAIN_WINDOW_GEOMETRY["y_pos"], + ), + to_restore_main_window_geometry=config.ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY, **common_args ) @@ -84,7 +91,8 @@ class View(): CALLBACK_OPEN_FILEPATH_LOGS=None, CALLBACK_OPEN_FILEPATH_CONFIG_FILE=None, - CALLBACK_QUIT_VRCT=vrct_gui._quitVRCT, + CALLBACK_DELETE_MAIN_WINDOW=self.quitVRCT, + CALLBACK_QUIT_VRCT=None, CALLBACK_WHEN_DETECT_WINDOW_OVERED_SIZE=self._showDisplayOverUiSizeConfirmationModal, @@ -240,6 +248,10 @@ class View(): CALLBACK_SET_UI_LANGUAGE=None, VAR_UI_LANGUAGE=StringVar(value=selectable_languages[config.UI_LANGUAGE]), + VAR_LABEL_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY=StringVar(value=i18n.t("config_window.to_restore_main_window_geometry.label")), + VAR_DESC_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY=StringVar(value=i18n.t("config_window.to_restore_main_window_geometry.desc")), + CALLBACK_SET_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY=None, + VAR_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY=BooleanVar(value=config.ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY), # Translation Tab VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value=i18n.t("config_window.deepl_auth_key.label")), @@ -463,6 +475,7 @@ class View(): self.view_variable.CALLBACK_RESTART_SOFTWARE=common_registers.get("callback_restart_software", None) self.view_variable.CALLBACK_OPEN_FILEPATH_LOGS=common_registers.get("callback_filepath_logs", None) self.view_variable.CALLBACK_OPEN_FILEPATH_CONFIG_FILE=common_registers.get("callback_filepath_config_file", None) + self.view_variable.CALLBACK_QUIT_VRCT=common_registers.get("callback_quit_vrct", None) if window_action_registers is not None: @@ -527,6 +540,7 @@ class View(): self.view_variable.CALLBACK_SET_MESSAGE_BOX_RATIO = config_window_registers.get("callback_set_message_box_ratio", None) self.view_variable.CALLBACK_SET_FONT_FAMILY = config_window_registers.get("callback_set_font_family", None) self.view_variable.CALLBACK_SET_UI_LANGUAGE = config_window_registers.get("callback_set_ui_language", None) + self.view_variable.CALLBACK_SET_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY = config_window_registers.get("callback_set_enable_restore_main_window_geometry", None) # Translation Tab @@ -760,7 +774,9 @@ class View(): vrct_gui._showGUI() vrct_gui._startMainLoop() - + def quitVRCT(self): + callFunctionIfCallable(self.view_variable.CALLBACK_QUIT_VRCT) + vrct_gui._quitVRCT() # Common @staticmethod @@ -774,6 +790,15 @@ class View(): def openWebPage(url:str): webbrowser.open_new_tab(url) + @staticmethod + def getMainWindowGeometry(): + result = { + "width": str(vrct_gui.winfo_toplevel().winfo_width()), + "height": str(vrct_gui.winfo_toplevel().winfo_height()), + "x_pos": str(vrct_gui.winfo_toplevel().winfo_x()), + "y_pos": str(vrct_gui.winfo_toplevel().winfo_y()), + } + return result # Open Webpage Functions def openWebPage_Booth(self): diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py index a228e5a1..615c0e4e 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py @@ -6,6 +6,7 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu createSettingBoxSlider = sbg.createSettingBoxSlider + createSettingBoxCheckbox = sbg.createSettingBoxCheckbox # 関数名は変えるかもしれない。 # テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中 @@ -30,6 +31,8 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi def optionmenu_ui_language_callback(value): callFunctionIfCallable(view_variable.CALLBACK_SET_UI_LANGUAGE, value) + def checkbox_enable_restore_main_window_geometry_callback(checkbox_box_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY, checkbox_box_widget.get()) row=0 config_window.sb__transparency = createSettingBoxSlider( @@ -119,5 +122,15 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi command=lambda value: optionmenu_ui_language_callback(value), variable=view_variable.VAR_UI_LANGUAGE, ) - config_window.sb__ui_language.grid(row=row, pady=0) + config_window.sb__ui_language.grid(row=row) + row+=1 + + config_window.sb__enable_restore_main_window_geometry = createSettingBoxCheckbox( + for_var_label_text=view_variable.VAR_LABEL_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY, + checkbox_attr_name="sb__checkbox_enable_restore_main_window_geometry", + command=lambda: checkbox_enable_restore_main_window_geometry_callback(config_window.sb__checkbox_enable_restore_main_window_geometry), + variable=view_variable.VAR_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY, + ) + config_window.sb__enable_restore_main_window_geometry.grid(row=row, pady=0) row+=1 \ No newline at end of file diff --git a/vrct_gui/main_window/createMainWindowWidgets.py b/vrct_gui/main_window/createMainWindowWidgets.py index 8e8c96b6..16a402d7 100644 --- a/vrct_gui/main_window/createMainWindowWidgets.py +++ b/vrct_gui/main_window/createMainWindowWidgets.py @@ -6,7 +6,7 @@ from utils import callFunctionIfCallable from ..ui_utils import createButtonWithImage, getImagePath, bindButtonFunctionAndColor def createMainWindowWidgets(vrct_gui, settings, view_variable): - vrct_gui.protocol("WM_DELETE_WINDOW", lambda: callFunctionIfCallable(view_variable.CALLBACK_QUIT_VRCT)) + vrct_gui.protocol("WM_DELETE_WINDOW", lambda: callFunctionIfCallable(view_variable.CALLBACK_DELETE_MAIN_WINDOW)) vrct_gui.iconbitmap(getImagePath("vrct_logo_mark_black.ico")) diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index a0926150..7c0bdc7f 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -43,11 +43,21 @@ class VRCT_GUI(CTk): def _showGUI(self): self.attributes("-alpha", 0) self.deiconify() - self.geometry("{}x{}".format( - self.settings.main.uism.MAIN_AREA_MIN_WIDTH + self.settings.main.uism.SIDEBAR_MIN_WIDTH, - self.winfo_height() - )) - setGeometryToCenterOfScreen(root_widget=self) + if self.settings.main.to_restore_main_window_geometry is True: + self.geometry("{}x{}+{}+{}".format( + self.settings.main.geometry.width, + self.settings.main.geometry.height, + self.settings.main.geometry.x_pos, + self.settings.main.geometry.y_pos, + )) + else: + self.geometry("{}x{}".format( + self.settings.main.uism.MAIN_AREA_MIN_WIDTH + self.settings.main.uism.SIDEBAR_MIN_WIDTH, + self.winfo_height() + )) + setGeometryToCenterOfScreen(root_widget=self) + + if self._view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is True: self._enableMainWindowSidebarCompactMode() fadeInAnimation(self, steps=5, interval=0.008) From 053b8080a46c844b940a9c513e836ccbafe26a32 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 30 Dec 2023 18:13:40 +0900 Subject: [PATCH 23/43] [bugfix] Confirmation Modal: Add lift() after displaying the confirmation modal to prevent it from being hidden by the main window cover. --- vrct_gui/_CreateConfirmationModal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vrct_gui/_CreateConfirmationModal.py b/vrct_gui/_CreateConfirmationModal.py index 09f55d64..7391a594 100644 --- a/vrct_gui/_CreateConfirmationModal.py +++ b/vrct_gui/_CreateConfirmationModal.py @@ -221,6 +221,7 @@ class _CreateConfirmationModal(CTkToplevel): target_widget=self ) fadeInAnimation(self, steps=5, interval=0.005, max_alpha=1) + self.lift() self.focus_set() From 6152f5e91a19be10eb220f4484754d3f72759d6d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 30 Dec 2023 19:41:19 +0900 Subject: [PATCH 24/43] =?UTF-8?q?[Update]=20Speaker2Chatbox:=20config.py?= =?UTF-8?q?=E3=81=AEself.=5FENABLE=5FSPEAKER2CHATBOX=20True/False=E3=81=AB?= =?UTF-8?q?=E3=82=88=E3=81=A3=E3=81=A6=E3=80=81Speaker2Chatbox=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E3=81=AE=E6=9C=89=E5=8A=B9=E7=84=A1=E5=8A=B9=E5=88=87?= =?UTF-8?q?=E3=82=8A=E6=9B=BF=E3=81=88=E3=80=82=20=E9=80=9A=E5=B8=B8?= =?UTF-8?q?=E3=81=AFFalse:=20=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E9=A0=85=E7=9B=AE=E3=82=82disabled=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=8A=E3=81=BE=E3=81=99=E3=80=82=20True?= =?UTF-8?q?=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB=E8=A8=AD=E5=AE=9A=E9=A0=85?= =?UTF-8?q?=E7=9B=AE=E3=81=8C=E9=96=8B=E6=94=BE=E3=81=95=E3=82=8C=E3=80=81?= =?UTF-8?q?On/Off=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ※通常公開しない理由: 相手の発言をチャットボックスに表示できる(オウム返しのようになる)ため、迷惑目的での使用が想定でき、それをできるだけ防ぐためです。オープンソースとはいえ、ある程度抑制できると考えています。 使用者は開発者に直接相談し、config.pyのself._ENABLE_SPEAKER2CHATBOXがTrueなコードをビルドしたものを配布する予定です。 --- config.py | 10 +++++++++- controller.py | 11 ++++++----- locales/en.yml | 1 + view.py | 7 +++++++ vrct_gui/_changeConfigWindowWidgetsStatus.py | 15 ++++++++++++++- .../createSettingBox_Others_Additional.py | 2 +- vrct_gui/ui_managers/Themes/_darkTheme.py | 1 + vrct_gui/ui_managers/Themes/_lightTheme.py | 1 + 8 files changed, 40 insertions(+), 8 deletions(-) diff --git a/config.py b/config.py index 8c3398ef..d4231f91 100644 --- a/config.py +++ b/config.py @@ -39,6 +39,10 @@ class Config: def VERSION(self): return self._VERSION + @property + def ENABLE_SPEAKER2CHATBOX(self): + return self._ENABLE_SPEAKER2CHATBOX + @property def LOCAL_PATH(self): return self._LOCAL_PATH @@ -589,7 +593,10 @@ class Config: @ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC.setter def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self, value): if isinstance(value, bool): - self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value + if self._ENABLE_SPEAKER2CHATBOX is True: + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value + else: + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) # Speaker2Chatbox------------------ @@ -620,6 +627,7 @@ class Config: def init_config(self): # Read Only self._VERSION = "2.0.1" + self._ENABLE_SPEAKER2CHATBOX = False self._LOCAL_PATH = os_path.dirname(sys.argv[0]) self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs") diff --git a/controller.py b/controller.py index 0f505099..fe6db61a 100644 --- a/controller.py +++ b/controller.py @@ -133,11 +133,12 @@ def receiveSpeakerMessage(message): model.notificationXSOverlay(xsoverlay_message) # ------------Speaker2Chatbox------------ - # send OSC message - if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: - osc_message = messageFormatter("RECEIVED", translation, message) - model.oscSendMessage(osc_message) - # ------------Speaker2Chatbox------------ + if config.ENABLE_SPEAKER2CHATBOX is True: + # send OSC message + if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: + osc_message = messageFormatter("RECEIVED", translation, message) + model.oscSendMessage(osc_message) + # ------------Speaker2Chatbox------------ # update textbox message log (Received) view.printToTextbox_ReceivedMessage(message, translation) diff --git a/locales/en.yml b/locales/en.yml index fd159673..e90f49a0 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -225,6 +225,7 @@ config_window: # Speaker2Chatbox send_received_message_to_vrc: label: Send Received Message To VRChat + desc: Send the message you received from the speaker's sound to VRChat's chatbox. However, this feature is intended for users who genuinely need it. Please consult with the developer. # Speaker2Chatbox diff --git a/view.py b/view.py index 712821e7..a169d0a5 100644 --- a/view.py +++ b/view.py @@ -616,6 +616,13 @@ class View(): ) self.replaceMicThresholdCheckButton_Disabled() + if config.ENABLE_SPEAKER2CHATBOX is False: + vrct_gui._changeConfigWindowWidgetsStatus( + status="disabled", + target_names=[ + "sb__checkbox_enable_send_received_message_to_vrc", + ] + ) if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True: self.closeMicEnergyThresholdWidget() diff --git a/vrct_gui/_changeConfigWindowWidgetsStatus.py b/vrct_gui/_changeConfigWindowWidgetsStatus.py index 95ebb187..b9b0f9d8 100644 --- a/vrct_gui/_changeConfigWindowWidgetsStatus.py +++ b/vrct_gui/_changeConfigWindowWidgetsStatus.py @@ -5,10 +5,13 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta # target_names = [] - def disableOptionmenuWidget(target_widget): + def disableLabelsWidgets(target_widget): target_widget.label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) if target_widget.desc_widget is not None: target_widget.desc_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) + + def disableOptionmenuWidget(target_widget): + disableLabelsWidgets(target_widget) target_widget.optionmenu_label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) target_widget.optionmenu_img_widget.configure(image=CTkImage(settings.image_file.ARROW_LEFT_DISABLED.rotate(90), size=settings.uism.SB__OPTIONMENU_IMG_SIZE)) target_widget.optionmenu_box.unbindFunction() @@ -32,6 +35,16 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta target_widget = config_window.sb__widgets["sb__optionmenu_appearance_theme"] disableOptionmenuWidget(target_widget) + + case "sb__checkbox_enable_send_received_message_to_vrc": + if status == "disabled": + target_widget = config_window.sb__widgets["sb__checkbox_enable_send_received_message_to_vrc"] + disableLabelsWidgets(target_widget) + config_window.sb__checkbox_enable_send_received_message_to_vrc.configure( + state="disabled", + border_color=settings.ctm.SB__CHECKBOX_BORDER_DISABLED_COLOR + ) + case _: raise ValueError(f"No matching case for target_name: {target_name}") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py index 53551128..b7f39f91 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py @@ -13,7 +13,7 @@ def createSettingBox_Others_Additional(setting_box_wrapper, config_window, setti row=0 config_window.sb__enable_send_received_message_to_vrc = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, - # for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, checkbox_attr_name="sb__checkbox_enable_send_received_message_to_vrc", command=lambda: checkbox_enable_send_received_message_to_vrc_callback(config_window.sb__checkbox_enable_send_received_message_to_vrc), variable=view_variable.VAR_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, diff --git a/vrct_gui/ui_managers/Themes/_darkTheme.py b/vrct_gui/ui_managers/Themes/_darkTheme.py index ed3c7cd8..93c81365 100644 --- a/vrct_gui/ui_managers/Themes/_darkTheme.py +++ b/vrct_gui/ui_managers/Themes/_darkTheme.py @@ -211,6 +211,7 @@ def _darkTheme(base_color): SB__SWITCH_BOX_BUTTON_HOVERED_COLOR = base_color.DARK_350_COLOR, SB__CHECKBOX_BORDER_COLOR = base_color.DARK_600_COLOR, + SB__CHECKBOX_BORDER_DISABLED_COLOR = base_color.DARK_800_COLOR, SB__CHECKBOX_HOVER_COLOR = base_color.DARK_800_COLOR, SB__CHECKBOX_CHECKED_COLOR = base_color.PRIMARY_700_COLOR, SB__CHECKBOX_CHECKMARK_COLOR = base_color.DARK_BASIC_TEXT_COLOR, diff --git a/vrct_gui/ui_managers/Themes/_lightTheme.py b/vrct_gui/ui_managers/Themes/_lightTheme.py index 95accf92..96c11238 100644 --- a/vrct_gui/ui_managers/Themes/_lightTheme.py +++ b/vrct_gui/ui_managers/Themes/_lightTheme.py @@ -204,6 +204,7 @@ def _lightTheme(base_color): SB__SWITCH_BOX_BUTTON_HOVERED_COLOR = base_color.LIGHT_200_COLOR, SB__CHECKBOX_BORDER_COLOR = base_color.LIGHT_600_COLOR, + SB__CHECKBOX_BORDER_DISABLED_COLOR = base_color.LIGHT_300_COLOR, SB__CHECKBOX_HOVER_COLOR = base_color.LIGHT_350_COLOR, SB__CHECKBOX_CHECKED_COLOR = base_color.PRIMARY_250_COLOR, SB__CHECKBOX_CHECKMARK_COLOR = base_color.LIGHT_BASIC_TEXT_COLOR, From 94b928e1949412536363759bae84aeecadb3e20c Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 2 Jan 2024 03:14:29 +0900 Subject: [PATCH 25/43] =?UTF-8?q?[Refactor]=20config.py=E3=81=B8=E3=80=81?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E5=8F=AF=E8=83=BD=E3=81=AA=E7=AF=84=E5=9B=B2?= =?UTF-8?q?=E3=81=AA=E3=81=A9=E3=82=92=E7=A7=BB=E5=8B=95=E3=80=82=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E5=80=A4=E3=81=AE=E3=82=BD=E3=83=BC=E3=82=B9=E4=B8=80?= =?UTF-8?q?=E5=85=83=E5=8C=96=E3=80=82=20language.py=E3=81=AE=E4=B8=AD?= =?UTF-8?q?=E8=BA=AB=E3=81=AFconfig.SELECTABLE=5FUI=5FLANGUAGES=5FDICT?= =?UTF-8?q?=E3=81=AB=E7=A7=BB=E5=8B=95=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82=20=E8=A8=AD=E5=AE=9A=E5=8F=AF=E8=83=BD=E3=81=AA?= =?UTF-8?q?=E7=AF=84=E5=9B=B2=E3=80=81TRANSPARENCY=E3=81=8C0~100=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7?= =?UTF-8?q?50~100=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 52 ++++++++++++++++++++++++++++++++++++++++++--------- controller.py | 7 +++---- languages.py | 6 ------ utils.py | 4 ++-- view.py | 34 ++++++++++++++++----------------- 5 files changed, 64 insertions(+), 39 deletions(-) delete mode 100644 languages.py diff --git a/config.py b/config.py index d4231f91..d5d57b4a 100644 --- a/config.py +++ b/config.py @@ -5,7 +5,6 @@ from json import load as json_load from json import dump as json_dump import tkinter as tk from tkinter import font -from languages import selectable_languages from models.translation.translation_languages import translatorEngine from models.transcription.transcription_utils import getInputDevices, getDefaultInputDevice from utils import generatePercentageStringsList, isUniqueStrings @@ -67,6 +66,30 @@ class Config: def DOCUMENTS_URL(self): return self._DOCUMENTS_URL + @property + def TRANSPARENCY_RANGE(self): + return self._TRANSPARENCY_RANGE + + @property + def APPEARANCE_THEME_LIST(self): + return self._APPEARANCE_THEME_LIST + + @property + def UI_SCALING_LIST(self): + return self._UI_SCALING_LIST + + @property + def TEXTBOX_UI_SCALING_RANGE(self): + return self._TEXTBOX_UI_SCALING_RANGE + + @property + def MESSAGE_BOX_RATIO_RANGE(self): + return self._MESSAGE_BOX_RATIO_RANGE + + @property + def SELECTABLE_UI_LANGUAGES_DICT(self): + return self._SELECTABLE_UI_LANGUAGES_DICT + @property def MAX_MIC_ENERGY_THRESHOLD(self): return self._MAX_MIC_ENERGY_THRESHOLD @@ -211,7 +234,7 @@ class Config: @TRANSPARENCY.setter def TRANSPARENCY(self, value): - if isinstance(value, int) and 0 <= value <= 100: + if isinstance(value, int) and self.TRANSPARENCY_RANGE[0] <= value <= self.TRANSPARENCY_RANGE[1]: self._TRANSPARENCY = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -222,7 +245,7 @@ class Config: @APPEARANCE_THEME.setter def APPEARANCE_THEME(self, value): - if value in ["Light", "Dark", "System"]: + if value in self.APPEARANCE_THEME_LIST: self._APPEARANCE_THEME = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -233,7 +256,7 @@ class Config: @UI_SCALING.setter def UI_SCALING(self, value): - if value in generatePercentageStringsList(start=40,end=200, step=10): + if value in self.UI_SCALING_LIST: self._UI_SCALING = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -244,7 +267,7 @@ class Config: @TEXTBOX_UI_SCALING.setter def TEXTBOX_UI_SCALING(self, value): - if isinstance(value, int) and 50 <= value <= 200: + if isinstance(value, int) and self.TEXTBOX_UI_SCALING_RANGE[0] <= value <= self.TEXTBOX_UI_SCALING_RANGE[1]: self._TEXTBOX_UI_SCALING = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -255,7 +278,7 @@ class Config: @MESSAGE_BOX_RATIO.setter def MESSAGE_BOX_RATIO(self, value): - if isinstance(value, int) and 1 <= value <= 99: + if isinstance(value, int) and self.MESSAGE_BOX_RATIO_RANGE[0] <= value <= self.MESSAGE_BOX_RATIO_RANGE[1]: self._MESSAGE_BOX_RATIO = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -280,7 +303,7 @@ class Config: @UI_LANGUAGE.setter def UI_LANGUAGE(self, value): - if value in list(selectable_languages.keys()): + if value in list(self.SELECTABLE_UI_LANGUAGES_DICT.keys()): self._UI_LANGUAGE = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -627,7 +650,7 @@ class Config: def init_config(self): # Read Only self._VERSION = "2.0.1" - self._ENABLE_SPEAKER2CHATBOX = False + self._ENABLE_SPEAKER2CHATBOX = False # Speaker2Chatbox self._LOCAL_PATH = os_path.dirname(sys.argv[0]) self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs") @@ -635,6 +658,17 @@ class Config: self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest" self._BOOTH_URL = "https://misyaguziya.booth.pm/" self._DOCUMENTS_URL = "https://mzsoftware.notion.site/VRCT-Documents-be79b7a165f64442ad8f326d86c22246" + self._TRANSPARENCY_RANGE = (50, 100) + self._APPEARANCE_THEME_LIST = ["Light", "Dark", "System"] + self._UI_SCALING_LIST = generatePercentageStringsList(start=40, end=200, step=10) + self._TEXTBOX_UI_SCALING_RANGE = (50, 200) + self._MESSAGE_BOX_RATIO_RANGE = (1, 99) + self._SELECTABLE_UI_LANGUAGES_DICT = { + "en": "English", + "ja": "日本語", + "ko": "한국어(일부 지원)" + # If you want to add a new language and key, please append it here. + } self._MAX_MIC_ENERGY_THRESHOLD = 2000 self._MAX_SPEAKER_ENERGY_THRESHOLD = 4000 @@ -708,7 +742,7 @@ class Config: self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_SEND_MESSAGE_TO_VRC = True - self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # speaker2Chatbox + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # Speaker2Chatbox self._ENABLE_LOGGER = False self._IS_CONFIG_WINDOW_COMPACT_MODE = False diff --git a/controller.py b/controller.py index fe6db61a..ce31b75b 100644 --- a/controller.py +++ b/controller.py @@ -4,8 +4,7 @@ from threading import Thread from config import config from model import model from view import view -from utils import get_key_by_value, isUniqueStrings -from languages import selectable_languages +from utils import getKeyByValue, isUniqueStrings import argparse # Common @@ -420,8 +419,8 @@ def callbackSetFontFamily(value): def callbackSetUiLanguage(value): print("callbackSetUiLanguage", value) - value = get_key_by_value(selectable_languages, value) - print("callbackSetUiLanguage__after_get_key_by_value", value) + value = getKeyByValue(config.SELECTABLE_UI_LANGUAGES_DICT, value) + print("callbackSetUiLanguage__after_getKeyByValue", value) config.UI_LANGUAGE = value view.showRestartButtonIfRequired(locale=config.UI_LANGUAGE) diff --git a/languages.py b/languages.py deleted file mode 100644 index 4c7b8c94..00000000 --- a/languages.py +++ /dev/null @@ -1,6 +0,0 @@ -selectable_languages = { - "en": "English", - "ja": "日本語", - "ko": "한국어(일부 지원)" - # 新しい言語とキーを追加する場合はここに追記してください -} \ No newline at end of file diff --git a/utils.py b/utils.py index a5e38fda..87b7d981 100644 --- a/utils.py +++ b/utils.py @@ -6,7 +6,7 @@ def getImageFile(file_name): img = Image_open(os_path.join(os_path.dirname(__file__), "img", file_name)) return img -def get_key_by_value(dictionary, value): +def getKeyByValue(dictionary, value): for key, val in dictionary.items(): if val == value: return key @@ -24,7 +24,7 @@ def makeEven(number, minus:bool=False): return number if isEven(number) else number - 1 return number if isEven(number) else number + 1 -def generatePercentageStringsList(start=40, end=200, step=10): +def generatePercentageStringsList(start:int, end:int, step:int): strings = [] for percent in range(start, end + 1, step): strings.append(f"{percent}%") diff --git a/view.py b/view.py index a169d0a5..2d41cf5f 100644 --- a/view.py +++ b/view.py @@ -5,12 +5,10 @@ from tkinter import font as tk_font import webbrowser import i18n -from languages import selectable_languages - -from customtkinter import StringVar, IntVar, BooleanVar, END as CTK_END, get_appearance_mode +from customtkinter import StringVar, IntVar, BooleanVar, get_appearance_mode from vrct_gui.ui_managers import ColorThemeManager, UiScalingManager from vrct_gui import vrct_gui -from utils import callFunctionIfCallable, generatePercentageStringsList, intToPercentageStringsFormatter +from utils import callFunctionIfCallable, intToPercentageStringsFormatter from config import config @@ -143,7 +141,7 @@ class View(): CALLBACK_SELECTED_LANGUAGE_PRESET_TAB=None, VAR_LABEL_YOUR_LANGUAGE=StringVar(value=i18n.t("main_window.your_language")), - VAR_YOUR_LANGUAGE = StringVar(value="Japanese\n(Japan)"), + VAR_YOUR_LANGUAGE = StringVar(value=f"{config.SOURCE_LANGUAGE}\n({config.SOURCE_COUNTRY})"), CALLBACK_OPEN_SELECTABLE_YOUR_LANGUAGE_WINDOW=None, IS_OPENED_SELECTABLE_YOUR_LANGUAGE_WINDOW=False, CALLBACK_SELECTED_YOUR_LANGUAGE=None, @@ -153,7 +151,7 @@ class View(): CALLBACK_SWAP_LANGUAGES=None, VAR_LABEL_TARGET_LANGUAGE=StringVar(value=i18n.t("main_window.target_language")), - VAR_TARGET_LANGUAGE = StringVar(value="English\n(United States)"), + VAR_TARGET_LANGUAGE = StringVar(value=f"{config.TARGET_LANGUAGE}\n({config.TARGET_COUNTRY})"), CALLBACK_OPEN_SELECTABLE_TARGET_LANGUAGE_WINDOW=None, IS_OPENED_SELECTABLE_TARGET_LANGUAGE_WINDOW=False, CALLBACK_SELECTED_TARGET_LANGUAGE=None, @@ -202,7 +200,7 @@ class View(): # Appearance Tab VAR_LABEL_TRANSPARENCY=StringVar(value=i18n.t("config_window.transparency.label")), VAR_DESC_TRANSPARENCY=StringVar(value=i18n.t("config_window.transparency.desc")), - SLIDER_RANGE_TRANSPARENCY=(50, 100), + SLIDER_RANGE_TRANSPARENCY=config.TRANSPARENCY_RANGE, CALLBACK_SET_TRANSPARENCY=None, VAR_TRANSPARENCY=IntVar(value=config.TRANSPARENCY), CALLBACK_BUTTON_PRESS_TRANSPARENCY=self._closeTheCoverOfMainWindow, @@ -210,19 +208,19 @@ class View(): VAR_LABEL_APPEARANCE_THEME=StringVar(value=i18n.t("config_window.appearance_theme.label")), VAR_DESC_APPEARANCE_THEME=StringVar(value=i18n.t("config_window.appearance_theme.desc")), - LIST_APPEARANCE_THEME=["Light", "Dark", "System"], + LIST_APPEARANCE_THEME=config.APPEARANCE_THEME_LIST, CALLBACK_SET_APPEARANCE_THEME=None, VAR_APPEARANCE_THEME=StringVar(value=config.APPEARANCE_THEME), VAR_LABEL_UI_SCALING=StringVar(value=i18n.t("config_window.ui_size.label")), VAR_DESC_UI_SCALING=None, - LIST_UI_SCALING=generatePercentageStringsList(start=40,end=200, step=10), + LIST_UI_SCALING=config.UI_SCALING_LIST, CALLBACK_SET_UI_SCALING=None, VAR_UI_SCALING=StringVar(value=config.UI_SCALING), VAR_LABEL_TEXTBOX_UI_SCALING=StringVar(value=i18n.t("config_window.textbox_ui_size.label")), VAR_DESC_TEXTBOX_UI_SCALING=StringVar(value=i18n.t("config_window.textbox_ui_size.desc")), - SLIDER_RANGE_TEXTBOX_UI_SCALING=(50, 200), + SLIDER_RANGE_TEXTBOX_UI_SCALING=config.TEXTBOX_UI_SCALING_RANGE, CALLBACK_SET_TEXTBOX_UI_SCALING=None, VAR_TEXTBOX_UI_SCALING=IntVar(value=config.TEXTBOX_UI_SCALING), CALLBACK_BUTTON_PRESS_TEXTBOX_UI_SCALING=self._closeTheCoverOfMainWindow, @@ -230,7 +228,7 @@ class View(): VAR_LABEL_MESSAGE_BOX_RATIO=StringVar(value=i18n.t("config_window.message_box_ratio.label")), VAR_DESC_MESSAGE_BOX_RATIO=StringVar(value=i18n.t("config_window.message_box_ratio.desc")), - SLIDER_RANGE_MESSAGE_BOX_RATIO=(1, 99), + SLIDER_RANGE_MESSAGE_BOX_RATIO=config.MESSAGE_BOX_RATIO_RANGE, CALLBACK_SET_MESSAGE_BOX_RATIO=None, VAR_MESSAGE_BOX_RATIO=IntVar(value=config.MESSAGE_BOX_RATIO), CALLBACK_BUTTON_PRESS_MESSAGE_BOX_RATIO=self._closeTheCoverOfMainWindow, @@ -244,9 +242,9 @@ class View(): VAR_LABEL_UI_LANGUAGE=StringVar(value=i18n.t("config_window.ui_language.label")), VAR_DESC_UI_LANGUAGE=None, - LIST_UI_LANGUAGE=list(selectable_languages.values()), + LIST_UI_LANGUAGE=list(config.SELECTABLE_UI_LANGUAGES_DICT.values()), CALLBACK_SET_UI_LANGUAGE=None, - VAR_UI_LANGUAGE=StringVar(value=selectable_languages[config.UI_LANGUAGE]), + VAR_UI_LANGUAGE=StringVar(value=config.SELECTABLE_UI_LANGUAGES_DICT[config.UI_LANGUAGE]), VAR_LABEL_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY=StringVar(value=i18n.t("config_window.to_restore_main_window_geometry.label")), VAR_DESC_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY=StringVar(value=i18n.t("config_window.to_restore_main_window_geometry.desc")), @@ -1111,13 +1109,13 @@ class View(): @staticmethod def setMainWindowMessageBoxRatio(message_box_ratio:int): - if message_box_ratio <= 0 or message_box_ratio > 99: - raise ValueError("Input must be between 1 and 99 (inclusive)") + if message_box_ratio < config.MESSAGE_BOX_RATIO_RANGE[0] or message_box_ratio > config.MESSAGE_BOX_RATIO_RANGE[1]: + raise ValueError(f"Input must be between {config.MESSAGE_BOX_RATIO_RANGE[0]} and {config.MESSAGE_BOX_RATIO_RANGE[1]} (inclusive)") - vrct_gui.main_bg_container.grid_rowconfigure(tuple(range(1, 101)), weight=1) - textbox_ratio = int(100 - message_box_ratio) + vrct_gui.main_bg_container.grid_rowconfigure(tuple(range(config.MESSAGE_BOX_RATIO_RANGE[0], config.MESSAGE_BOX_RATIO_RANGE[1]+2)), weight=1) + textbox_ratio = int((config.MESSAGE_BOX_RATIO_RANGE[1]+1) - message_box_ratio) message_box_row = int(textbox_ratio + 1) - message_box_rowwpan = int(100 - textbox_ratio) + message_box_rowwpan = int((config.MESSAGE_BOX_RATIO_RANGE[1]+1) - textbox_ratio) # print(textbox_ratio, message_box_row, message_box_rowwpan) vrct_gui.main_textbox_container.grid(row=1, rowspan=textbox_ratio, column=0, sticky="nsew") vrct_gui.main_entry_message_container.grid(row=message_box_row, rowspan=message_box_rowwpan, column=0, sticky="nsew") From 31755c5031ede9980821f59e3e8d2c4c9762d0eb Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 2 Jan 2024 07:11:31 +0900 Subject: [PATCH 26/43] =?UTF-8?q?[Update]=20Config=20Window:=20Dropdown=20?= =?UTF-8?q?Menu.=20=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E9=80=9F?= =?UTF-8?q?=E5=BA=A6UP,=20=E5=B9=85=E8=AA=BF=E6=95=B4=EF=BC=88=E3=83=95?= =?UTF-8?q?=E3=82=A9=E3=83=B3=E3=83=88=E3=82=84=E8=A8=80=E8=AA=9E=E3=81=AB?= =?UTF-8?q?=E3=82=88=E3=81=A3=E3=81=A6=E6=96=87=E5=AD=97=E5=B9=85=E3=81=8C?= =?UTF-8?q?=E5=A4=89=E3=82=8F=E3=82=8B=E3=81=AE=E3=81=A7=E3=80=81=E3=83=9E?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=B3=E3=81=A8=E3=81=97=E3=81=A6=E5=B0=91?= =?UTF-8?q?=E3=81=97=E8=BF=BD=E5=8A=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateDropdownMenuWindow.py | 10 ++++------ vrct_gui/ui_managers/UiScalingManager.py | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index b0f459dd..0eade683 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -1,9 +1,9 @@ from types import SimpleNamespace -from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont, CTkScrollableFrame +from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont from time import sleep -from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestHeight, applyUiScalingAndFixTheBugScrollBar, getLatestWidth, getLongestText +from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestHeight, applyUiScalingAndFixTheBugScrollBar, getLatestWidth, getLongestText, CustomizedCTkScrollableFrame from functools import partial from utils import isEven, makeEven @@ -121,7 +121,7 @@ class _CreateDropdownMenuWindow(CTkToplevel): BORDER_WIDTH=self.window_border_width - self.scroll_frame_container = CTkScrollableFrame( + self.scroll_frame_container = CustomizedCTkScrollableFrame( self.dropdown_menu_container, corner_radius=0, fg_color=self.window_bg_color, @@ -180,7 +180,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): __dropdown_menu_value_wrapper.grid_rowconfigure((0,2), weight=1) - # __dropdown_menu_value_wrapper.grid_columnconfigure(0, weight=1) __label_widget = CTkLabel( __dropdown_menu_value_wrapper, text=longest_text, @@ -190,7 +189,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): anchor="w", text_color=self.values_text_color, ) - # setattr(self, f"l", __label_widget) __label_widget.grid(row=1, column=0, padx=self.value_ipadx, pady=self.value_ipady, sticky="w") @@ -198,7 +196,7 @@ class _CreateDropdownMenuWindow(CTkToplevel): label_width = getLatestWidth(__label_widget) label_width += self.scroll_frame_container._scrollbar.winfo_width() + (self.window_border_width*2) + (self.scrollbar_ipadx[0] + self.scrollbar_ipadx[1]) if label_width > self.new_width: - additional_width = int(label_width - self.new_width) + additional_width = int(label_width - self.new_width + self.settings.uism.MARGIN_WIDTH) self.new_width += additional_width # for fixing 1px bug diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 7c79e02e..85b1997f 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -162,6 +162,8 @@ class UiScalingManager(): self.confirmation_modal.BUTTONS_IPADX = self._calculateUiSize(10) self.confirmation_modal.BUTTONS_IPADY = self._calculateUiSize(6) + # Dropdown Menu Window + self.config_window.MARGIN_WIDTH = self._calculateUiSize(16) # Config Window self.config_window.DEFAULT_WIDTH = self._calculateUiSize(1080) From 3891cafc1519cf135fe3941b64dde087e9cfb4c4 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:52:21 +0900 Subject: [PATCH 27/43] =?UTF-8?q?[Update]=20Main=20Window=20Cover:=20?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=81=AA=E3=81=A9=E3=82=92?= =?UTF-8?q?=E9=96=8B=E3=81=84=E3=81=9F=E6=99=82=E3=81=AB=E3=83=A1=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E7=94=BB=E9=9D=A2=E3=82=92=E9=BB=92=E3=81=8F=E8=A6=86?= =?UTF-8?q?=E3=81=86=E7=94=BB=E9=9D=A2=E3=81=AE=E9=80=8F=E6=98=8E=E5=BA=A6?= =?UTF-8?q?=E3=82=92=E4=B8=8B=E3=81=92=E3=81=9F=E3=80=82=20=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E7=90=86=E7=94=B1:=20=E3=81=9D=E3=81=AE=E4=B8=8A?= =?UTF-8?q?=E3=81=AB=E5=87=BA=E3=82=8B=E6=96=87=E5=AD=97=EF=BC=88The=20fun?= =?UTF-8?q?ctionality=20is=20temporarily=20disabled=20until=20the=20settin?= =?UTF-8?q?gs=20window=20is=20closed.=EF=BC=89=E3=81=8C=E3=80=81=E5=BE=8C?= =?UTF-8?q?=E3=82=8D=E3=81=AE=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88=E3=83=9C?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=B9=E3=81=AE=E6=96=87=E5=AD=97=E3=81=A8?= =?UTF-8?q?=E8=A2=AB=E3=81=A3=E3=81=A6=E8=A6=96=E8=AA=8D=E6=80=A7=E3=81=8C?= =?UTF-8?q?=E6=82=AA=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateWindowCover.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vrct_gui/_CreateWindowCover.py b/vrct_gui/_CreateWindowCover.py index 600619be..2b88a3d8 100644 --- a/vrct_gui/_CreateWindowCover.py +++ b/vrct_gui/_CreateWindowCover.py @@ -56,7 +56,7 @@ class _CreateWindowCover(CTkToplevel): self.width_new = self.attach_window.winfo_width() self.height_new = self.attach_window.winfo_height() self.geometry("{}x{}+{}+{}".format(self.width_new, self.height_new, self.x_pos, self.y_pos)) - fadeInAnimation(self, steps=5, interval=0.005, max_alpha=0.5) + fadeInAnimation(self, steps=5, interval=0.005, max_alpha=0.8) From f6414843cf7f369b5aed4e9223b396439d7ea2d0 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 5 Jan 2024 00:31:52 +0900 Subject: [PATCH 28/43] =?UTF-8?q?[Update]=20Main=20Window:=20=E3=82=A6?= =?UTF-8?q?=E3=82=A3=E3=83=B3=E3=83=89=E3=82=A6=E4=BD=8D=E7=BD=AE=E3=80=81?= =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=82=BA=E3=80=82UI=20Size=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E6=99=82=E3=80=81=E3=81=9D=E3=82=8C=E3=81=AB=E5=90=88=E3=82=8F?= =?UTF-8?q?=E3=81=9B=E3=81=A6=E4=BF=9D=E5=AD=98=E3=81=99=E3=82=8B=E5=80=A4?= =?UTF-8?q?=E3=82=82=E5=A4=89=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 18 +++++++++++++++--- utils.py | 5 ++++- view.py | 20 +++++++++++++++----- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/controller.py b/controller.py index ce31b75b..5b7e1478 100644 --- a/controller.py +++ b/controller.py @@ -4,14 +4,16 @@ from threading import Thread from config import config from model import model from view import view -from utils import getKeyByValue, isUniqueStrings +from utils import getKeyByValue, isUniqueStrings, strPctToInt import argparse # Common def callbackUpdateSoftware(): + setMainWindowGeometry() model.updateSoftware() def callbackRestartSoftware(): + setMainWindowGeometry() model.reStartSoftware() def callbackFilepathLogs(): @@ -23,7 +25,17 @@ def callbackFilepathConfigFile(): Popen(['explorer', config.LOCAL_PATH.replace('/', '\\')], shell=True) def callbackQuitVrct(): - main_window_geometry = view.getMainWindowGeometry() + setMainWindowGeometry() + +def setMainWindowGeometry(): + PRE_SCALING_INT = strPctToInt(view.getPreUiScaling()) + NEW_SCALING_INT = strPctToInt(config.UI_SCALING) + MULTIPLY_FLOAT = (NEW_SCALING_INT / PRE_SCALING_INT) + main_window_geometry = view.getMainWindowGeometry(return_int=True) + main_window_geometry["width"] = str(int(main_window_geometry["width"] * MULTIPLY_FLOAT)) + main_window_geometry["height"] = str(int(main_window_geometry["height"] * MULTIPLY_FLOAT)) + main_window_geometry["x_pos"] = str(main_window_geometry["x_pos"]) + main_window_geometry["y_pos"] = str(main_window_geometry["y_pos"]) config.MAIN_WINDOW_GEOMETRY = main_window_geometry def messageFormatter(format_type:str, translation, message): @@ -398,7 +410,7 @@ def callbackSetAppearance(value): def callbackSetUiScaling(value): print("callbackSetUiScaling", value) config.UI_SCALING = value - new_scaling_float = int(value.replace("%", "")) / 100 + new_scaling_float = strPctToInt(value) / 100 print("callbackSetUiScaling_new_scaling_float", new_scaling_float) view.showRestartButtonIfRequired() diff --git a/utils.py b/utils.py index 87b7d981..6a05a08d 100644 --- a/utils.py +++ b/utils.py @@ -30,9 +30,12 @@ def generatePercentageStringsList(start:int, end:int, step:int): strings.append(f"{percent}%") return strings -def intToPercentageStringsFormatter(value:int): +def intToPctStr(value:int): return f"{value}%" +def strPctToInt(value:str): + return int(value.replace("%", "")) + def isUniqueStrings(unique_strings:Union[str, list], input_string:str, require=False): import re if isinstance(unique_strings, str): diff --git a/view.py b/view.py index 2d41cf5f..3381917c 100644 --- a/view.py +++ b/view.py @@ -8,7 +8,7 @@ import i18n from customtkinter import StringVar, IntVar, BooleanVar, get_appearance_mode from vrct_gui.ui_managers import ColorThemeManager, UiScalingManager from vrct_gui import vrct_gui -from utils import callFunctionIfCallable, intToPercentageStringsFormatter +from utils import callFunctionIfCallable, intToPctStr from config import config @@ -183,7 +183,7 @@ class View(): VAR_CONFIG_WINDOW_COMPACT_MODE_LABEL=StringVar(value=i18n.t("config_window.compact_mode")), VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL=StringVar(value=i18n.t("config_window.restart_message")), - CALLBACK_SLIDER_TOOLTIP_PERCENTAGE_FORMATTER=intToPercentageStringsFormatter, + CALLBACK_SLIDER_TOOLTIP_PERCENTAGE_FORMATTER=intToPctStr, # Side Menu Labels @@ -796,14 +796,24 @@ class View(): webbrowser.open_new_tab(url) @staticmethod - def getMainWindowGeometry(): - result = { + def getMainWindowGeometry(return_int:bool=False): + if return_int is True: + return { + "width": vrct_gui.winfo_toplevel().winfo_width(), + "height": vrct_gui.winfo_toplevel().winfo_height(), + "x_pos": vrct_gui.winfo_toplevel().winfo_x(), + "y_pos": vrct_gui.winfo_toplevel().winfo_y(), + } + + return { "width": str(vrct_gui.winfo_toplevel().winfo_width()), "height": str(vrct_gui.winfo_toplevel().winfo_height()), "x_pos": str(vrct_gui.winfo_toplevel().winfo_x()), "y_pos": str(vrct_gui.winfo_toplevel().winfo_y()), } - return result + + def getPreUiScaling(self): + return self.restart_required_configs_pre_data.ui_scaling # Open Webpage Functions def openWebPage_Booth(self): From c2a37057f16be29f1e6df38713a41ca20a7132c5 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:40:11 +0900 Subject: [PATCH 29/43] =?UTF-8?q?[Update]=20Main=20Window:=20=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E5=85=A5=E5=8A=9B=E6=AC=84?= =?UTF-8?q?=E3=81=A7=E3=80=81Shift+Enter=E3=82=AD=E3=83=BC=E3=82=92?= =?UTF-8?q?=E6=8A=BC=E3=81=97=E3=81=9F=E9=9A=9B=E3=81=AB=E9=80=81=E4=BF=A1?= =?UTF-8?q?=E3=81=9B=E3=81=9A=E3=80=81=E3=81=9F=E3=81=A0=E6=94=B9=E8=A1=8C?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=82=20?= =?UTF-8?q?=E2=80=BBVRC=E4=B8=8A=E3=81=A7=E3=81=AF=E6=94=B9=E8=A1=8C?= =?UTF-8?q?=E3=81=AF=E5=89=8A=E9=99=A4=E3=81=95=E3=82=8C=E3=82=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 1 + 1 file changed, 1 insertion(+) diff --git a/view.py b/view.py index 3381917c..01375114 100644 --- a/view.py +++ b/view.py @@ -504,6 +504,7 @@ class View(): return "break" # For deleting the next line that will be inserted when the Enter key is pressed. entry_message_box = getattr(vrct_gui, "entry_message_box") + entry_message_box.bind("", lambda _e: None) # This is to prevent message sending on Shift + Enter key press and just add a new line. entry_message_box.bind("", adjustedMessageBoxReturnFunction) entry_message_box.bind("", main_window_registers.get("message_box_bind_Any_KeyPress")) From 90e631726c6519151ed3dd399f0121d5ec876d3e Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 6 Jan 2024 22:13:56 +0900 Subject: [PATCH 30/43] =?UTF-8?q?=F0=9F=91=8D[Update]=20Model=20:=20Update?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92tempfile=E3=82=92=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E3=81=99=E3=82=8B=E5=87=A6=E7=90=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/model.py b/model.py index bff713f4..5fbb5825 100644 --- a/model.py +++ b/model.py @@ -1,8 +1,8 @@ +import tempfile from zipfile import ZipFile from subprocess import Popen from os import makedirs as os_makedirs from os import path as os_path -from os import remove as os_remove from shutil import copyfile from datetime import datetime from logging import getLogger, FileHandler, Formatter, INFO @@ -12,6 +12,8 @@ from threading import Thread, Event from requests import get as requests_get import webbrowser +from tqdm import tqdm +from typing import Callable from flashtext import KeywordProcessor from models.translation.translation_translator import Translator from models.transcription.transcription_utils import getInputDevices, getDefaultOutputDevice @@ -265,7 +267,7 @@ class Model: return update_flag @staticmethod - def updateSoftware(restart:bool=True): + def updateSoftware(restart:bool=True, func=None): filename = 'VRCT.zip' program_name = 'VRCT.exe' folder_name = '_internal' @@ -277,14 +279,22 @@ class Model: res = requests_get(config.GITHUB_URL) assets = res.json()['assets'] url = [i["browser_download_url"] for i in assets if i["name"] == filename][0] - res = requests_get(url, stream=True) - os_makedirs(os_path.join(current_directory, tmp_directory_name), exist_ok=True) - with open(os_path.join(current_directory, tmp_directory_name, filename), 'wb') as file: - for chunk in res.iter_content(chunk_size=1024): - file.write(chunk) - with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf: - zf.extractall(os_path.join(current_directory, tmp_directory_name)) - os_remove(os_path.join(current_directory, tmp_directory_name, filename)) + with tempfile.TemporaryDirectory() as tmp_path: + res = requests_get(url, stream=True) + file_size = int(res.headers.get('content-length', 0)) + pbar = tqdm(total=file_size, unit="B", unit_scale=True) + total_chunk = 0 + with open(os_path.join(tmp_path, filename), 'wb') as file: + for chunk in res.iter_content(chunk_size=1024*5): + file.write(chunk) + pbar.update(len(chunk)) + if isinstance(func, Callable): + total_chunk += len(chunk) + func(total_chunk/file_size) + pbar.close() + + with ZipFile(os_path.join(tmp_path, filename)) as zf: + zf.extractall(os_path.join(current_directory, tmp_directory_name)) copyfile(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name)) command = [os_path.join(current_directory, batch_name), program_name, folder_name, tmp_directory_name, str(restart)] Popen(command, cwd=current_directory) From bed525297ec055f930f72f55dacd02f1f9f1a186 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 6 Jan 2024 22:15:42 +0900 Subject: [PATCH 31/43] =?UTF-8?q?=F0=9F=91=8D[Update]=20Config=20:=20versi?= =?UTF-8?q?on=202.0.1=20->=202.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index d5d57b4a..030ae2cb 100644 --- a/config.py +++ b/config.py @@ -649,7 +649,7 @@ class Config: def init_config(self): # Read Only - self._VERSION = "2.0.1" + self._VERSION = "2.0.2" self._ENABLE_SPEAKER2CHATBOX = False # Speaker2Chatbox self._LOCAL_PATH = os_path.dirname(sys.argv[0]) self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") From ad92e1b5f7c1e351fda18a7aad500e58d83d3220 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 6 Jan 2024 23:15:36 +0900 Subject: [PATCH 32/43] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model=20:=20Update?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=81=AE=E4=B8=8D=E8=A6=81=E3=81=AACommand?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/update.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batch/update.bat b/batch/update.bat index e0e83855..09bd4acb 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -16,5 +16,5 @@ rmdir /s /q %local_path%%folder_tmp% if %restart% == True ( START "" %local_path%%exe_name% ) -pause + del /f "%~dp0%~nx0" \ No newline at end of file From 5128fa590c4a8cc47bd3c87fa342b95462219eef Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 03:30:46 +0900 Subject: [PATCH 33/43] =?UTF-8?q?[Update]=20Main=20Window:=20=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E9=80=81=E4=BF=A1=E3=83=9C?= =?UTF-8?q?=E3=82=BF=E3=83=B3=E3=81=AE=E8=BF=BD=E5=8A=A0=E3=80=82=20?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E3=81=A7=E9=9D=9E=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=80=81=E8=A1=A8=E7=A4=BA=E3=80=81=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=97=E3=81=A4=E3=81=A4=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E5=85=A5=E5=8A=9B=E6=AC=84=E3=81=A7=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=B3=E3=82=BF=E3=83=BC=E3=82=AD=E3=83=BC=E9=80=81=E4=BF=A1?= =?UTF-8?q?=E3=82=92=E7=84=A1=E5=8A=B9=20=E3=82=92=E9=81=B8=E6=8A=9E?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit デフォルトが表示の理由: メッセージ入力欄のプレースホルダーが使えなくなり、初見でどこに入力すればいいのか分かりにくくなったので、横に送信ボタンが付くことにより、よくあるUIとなり、メッセージ入力欄っぽくなる。 その他要らないコードの削除や、corner radius指定し忘れなどの修正あり。 --- config.py | 12 +++ controller.py | 6 ++ img/send_message_icon_black.png | Bin 0 -> 1243 bytes img/send_message_icon_white.png | Bin 0 -> 1140 bytes locales/en.yml | 6 ++ locales/ja.yml | 6 ++ view.py | 39 ++++++++- vrct_gui/_changeMainWindowWidgetsStatus.py | 10 ++- .../_SettingBoxGenerator.py | 79 +++++++++++++++++- .../createSettingBox_Others.py | 14 ++++ .../main_window/createMainWindowWidgets.py | 2 +- .../widgets/create_entry_message_box.py | 65 +++++++++++++- .../main_window/widgets/create_textbox.py | 2 +- vrct_gui/ui_managers/Themes/_darkTheme.py | 12 +++ vrct_gui/ui_managers/Themes/_lightTheme.py | 12 +++ vrct_gui/ui_managers/UiScalingManager.py | 7 ++ 16 files changed, 258 insertions(+), 14 deletions(-) create mode 100644 img/send_message_icon_black.png create mode 100644 img/send_message_icon_white.png diff --git a/config.py b/config.py index d5d57b4a..70f316c8 100644 --- a/config.py +++ b/config.py @@ -531,6 +531,17 @@ class Config: self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property + @json_serializable('SEND_MESSAGE_BUTTON_TYPE') + def SEND_MESSAGE_BUTTON_TYPE(self): + return self._SEND_MESSAGE_BUTTON_TYPE + + @SEND_MESSAGE_BUTTON_TYPE.setter + def SEND_MESSAGE_BUTTON_TYPE(self, value): + if isinstance(value, str): + self._SEND_MESSAGE_BUTTON_TYPE = value + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property @json_serializable('ENABLE_NOTICE_XSOVERLAY') def ENABLE_NOTICE_XSOVERLAY(self): @@ -740,6 +751,7 @@ class Config: self._RECEIVED_MESSAGE_FORMAT_WITH_T = "[message]([translation])" self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False + self._SEND_MESSAGE_BUTTON_TYPE = "show" self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_SEND_MESSAGE_TO_VRC = True self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # Speaker2Chatbox diff --git a/controller.py b/controller.py index 5b7e1478..f81ec108 100644 --- a/controller.py +++ b/controller.py @@ -694,6 +694,11 @@ def callbackSetEnableSendOnlyTranslatedMessages(value): print("callbackSetEnableSendOnlyTranslatedMessages", value) config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = value +def callbackSetSendMessageButtonType(value): + print("callbackSetSendMessageButtonType", value) + config.SEND_MESSAGE_BUTTON_TYPE = value + view.changeMainWindowSendMessageButton(config.SEND_MESSAGE_BUTTON_TYPE) + def callbackSetEnableNoticeXsoverlay(value): print("callbackSetEnableNoticeXsoverlay", value) config.ENABLE_NOTICE_XSOVERLAY = value @@ -894,6 +899,7 @@ def createMainWindow(): # Others Tab "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, "callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages, + "callback_set_send_message_button_type": callbackSetSendMessageButtonType, "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, diff --git a/img/send_message_icon_black.png b/img/send_message_icon_black.png new file mode 100644 index 0000000000000000000000000000000000000000..e4240e563774654dbbe4d1c458b5063166b23512 GIT binary patch literal 1243 zcmV<11SI>3P)=o-`eUqab%xBv5uPq5%0z#Gn+>apptMCzybikkpZwOd@qP_ z@kjtvD;xj-5wjf~ovTd+s71Ibmak2Hk#7osP2m6lfVi`K8VcZq@O{xzF6_fJN_dfd zyrw|JwdjGe-0VgYss|#R}J96uA&jqmG<`bDNWNnnx-u>^BYxwXFED~ z>_b%m4o%L7LWuL}WbE(3;W3YV@n^l(Cw-1&89NNbf5k=i@_ouN)I5#|cNp5d% z-(u!7H8f$dSpE=zQv(PQ9}`i3CKbN}05E>}6Ut_@-!t<&wbV1)hoS&ZPEI1a;c~eK z6S3LsUT$k^E5pp^YHY?@G9GzU6u?R0i1?I%Gi;8UVVP`Bea*GWDMc zqR~t`@m1l00e|q4Qfk_ccmT+IJf0JU6SyQmVT6W8U(j{ETPbxK0D5=#ZUO*6#1$b# ze>xdkE4J~}rEH1^L|na|NuDZsyxM|8BV%39pKIOB{9;#E=Z$Mqlj^Ye(1(U$ zd`2 zfOvFforvBAfOUsT7PSv`0{{TXq~a@5${s{~Y`0b^`%qT^0DyEd_E1WB3K8$ysZ+{6 z)CIs72)$+gok~RiX=!owAmVZ@^~%|Yx&Ro4G4Bh6-Z$qGu}HSH)pHgRf2yJ6l9iL3 zTtY2|Vf;AY5006W(b=$e{P?jCh$vi5v2ymo9FEO_3j+Z*-8}5|dM{5+etuxc4fum2 zN~td`G_I_DH~{JtfH{;>V;dVAKMW0zwV3mB>BOuMq7MLa<*qOG^`W5v007KEzBU zWnrX~u?M@e;(}%f%gd*3078h5Q;Dc$FBFS}b6&5vkBDZi*avesJ_m>>IhRfZ>(Q8E z;ph`U#CvYHd%RKNod$R&gy@S!!a4h;nh?G~=%Z%b_dox>KOZR8Hnac$002ovPDHLk FV1mnBM+N`@ literal 0 HcmV?d00001 diff --git a/img/send_message_icon_white.png b/img/send_message_icon_white.png new file mode 100644 index 0000000000000000000000000000000000000000..cdead72b65e677015638305ee9294ce159a19271 GIT binary patch literal 1140 zcmV-)1dIELP)Oq%C}Ks_77Bs~H<4H+=@H@oZawEKJWe)IjjH}l^24e>vXT&{FXfEf;2NO!_zP6SgVKD7res8iuu zWa_^xvqL`v(GhQGs#uow(9q66^AWF$qL)c;3>`oW;Q#=V^8he30C9y!Vqqu%x)2Tk zo2ir?4iunE;k&WuI!7u40q9XU0D$De?(e<cGS*Cao* zlzKapNpBTP*X`}??JEF|by_HD9}WaCxB=ZFITQHqH2}yLmQ|%v`3k@@-4tu~0@nc; z_9~Z@;wdlVZ0_c?mQO_FM3*J&>_Z)Z;Vu6T$=3qky&6r1xzYzB@=EsuQg0vX07$Nh z;B!)L)(*~(c6pN@NcF1kIe#^XKPw_{_BJl{_Mxt&F_AAUAJ$r?068jx2>_1+PzO}M zOY(H!yPq{Sgt^jNB67Yr@jG818h7B90Q-T;4{EI^034N_$80nLw4@Yge9v8LBK~y| z`M5{%01%D`W8>_cJzUM9Ux@>u}uhDtWI4~YQ) zK;XMeBqssf>a|uY`;aI=4dRAUY8=2HJp#`XceD_*yuejZ! zU)%M+F90OZ?H(zcK&;mGiq(duw)UZ40KZw5HFwYjzUSOlJA1{ik#t-8&<}uhrPOq0 zY_zQq-*Yx>+j^SBWgwn?NF0FV%f9Et_ClGl^p", lambda _e: None) # This is to prevent message sending on Shift + Enter key press and just add a new line. entry_message_box.bind("", adjustedMessageBoxReturnFunction) entry_message_box.bind("", main_window_registers.get("message_box_bind_Any_KeyPress")) + self.view_variable.CALLBACK_CLICKED_SEND_MESSAGE_BUTTON = pressedSendMessageButtonFunction entry_message_box.bind("", main_window_registers.get("message_box_bind_FocusIn")) @@ -572,6 +586,7 @@ class View(): # Others Tab self.view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = config_window_registers.get("callback_set_enable_auto_clear_chatbox", None) self.view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = config_window_registers.get("callback_set_send_only_translated_messages", None) + self.view_variable.CALLBACK_SET_SEND_MESSAGE_BUTTON_TYPE = config_window_registers.get("callback_set_send_message_button_type", None) self.view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = config_window_registers.get("callback_set_enable_notice_xsoverlay", None) self.view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS = config_window_registers.get("callback_set_enable_auto_export_message_logs", None) @@ -1118,8 +1133,7 @@ class View(): def setMainWindowTextboxUiSize(custom_font_size_scale:float): vrct_gui.print_to_textbox.setTagsSettings(custom_font_size_scale=custom_font_size_scale) - @staticmethod - def setMainWindowMessageBoxRatio(message_box_ratio:int): + def setMainWindowMessageBoxRatio(self, message_box_ratio:int): if message_box_ratio < config.MESSAGE_BOX_RATIO_RANGE[0] or message_box_ratio > config.MESSAGE_BOX_RATIO_RANGE[1]: raise ValueError(f"Input must be between {config.MESSAGE_BOX_RATIO_RANGE[0]} and {config.MESSAGE_BOX_RATIO_RANGE[1]} (inclusive)") @@ -1127,10 +1141,27 @@ class View(): textbox_ratio = int((config.MESSAGE_BOX_RATIO_RANGE[1]+1) - message_box_ratio) message_box_row = int(textbox_ratio + 1) message_box_rowwpan = int((config.MESSAGE_BOX_RATIO_RANGE[1]+1) - textbox_ratio) - # print(textbox_ratio, message_box_row, message_box_rowwpan) vrct_gui.main_textbox_container.grid(row=1, rowspan=textbox_ratio, column=0, sticky="nsew") vrct_gui.main_entry_message_container.grid(row=message_box_row, rowspan=message_box_rowwpan, column=0, sticky="nsew") + new_send_message_button_width = int(self.settings.main.uism.SEND_MESSAGE_BUTTON_RATE_WIDTH * message_box_ratio) + + if new_send_message_button_width > self.settings.main.uism.SEND_MESSAGE_BUTTON_MAX_WIDTH: + new_send_message_button_width = self.settings.main.uism.SEND_MESSAGE_BUTTON_MAX_WIDTH + + if new_send_message_button_width < self.settings.main.uism.SEND_MESSAGE_BUTTON_MIN_WIDTH: + new_send_message_button_width = self.settings.main.uism.SEND_MESSAGE_BUTTON_MIN_WIDTH + + vrct_gui.main_send_message_button_container.grid_columnconfigure(0, weight=0, minsize=new_send_message_button_width) + + @staticmethod + def changeMainWindowSendMessageButton(status:str): + match (status): + case "hide": + vrct_gui.main_send_message_button_container.grid_remove() + case "show" | "show_and_disable_enter_key": + vrct_gui.main_send_message_button_container.grid() + # Function def _adjustUiSizeAndRestart(self): current_percentage = int(config.UI_SCALING.replace("%","")) diff --git a/vrct_gui/_changeMainWindowWidgetsStatus.py b/vrct_gui/_changeMainWindowWidgetsStatus.py index 75668102..86bbe0f6 100644 --- a/vrct_gui/_changeMainWindowWidgetsStatus.py +++ b/vrct_gui/_changeMainWindowWidgetsStatus.py @@ -3,7 +3,7 @@ hold_state_list=[] def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, target_names:list, to_hold_state:bool=False): global hold_state_list if target_names == "All": - target_names = ["translation_switch", "transcription_send_switch", "transcription_receive_switch", "foreground_switch", "quick_language_settings", "config_button", "minimize_sidebar_button", "entry_message_box"] + target_names = ["translation_switch", "transcription_send_switch", "transcription_receive_switch", "foreground_switch", "quick_language_settings", "config_button", "minimize_sidebar_button", "entry_message_box", "send_message_button"] for item in hold_state_list: @@ -141,13 +141,17 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta case "entry_message_box": if status == "disabled": - pass vrct_gui.entry_message_box.configure(state="disabled", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR) elif status == "normal": - pass vrct_gui.entry_message_box.configure(state="normal", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR) + case "send_message_button": + if status == "disabled": + vrct_gui.main_send_message_button__disabled.grid() + elif status == "normal": + vrct_gui.main_send_message_button__disabled.grid_remove() + case _: raise ValueError(f"No matching case for target_name: {target_name}") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index f73cb253..263204d3 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -2,10 +2,10 @@ from functools import partial from types import SimpleNamespace from typing import Union -from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar, CTkImage +from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar, CTkImage, CTkRadioButton from CTkToolTip import * -from vrct_gui.ui_utils import createButtonWithImage, getLatestWidth, createOptionMenuBox, getLatestHeight, bindButtonFunctionAndColor +from vrct_gui.ui_utils import createButtonWithImage, getLatestWidth, createOptionMenuBox, getLatestHeight, bindButtonFunctionAndColor, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressFunction from vrct_gui import vrct_gui from utils import isEven, callFunctionIfCallable @@ -251,6 +251,81 @@ class _SettingBoxGenerator(): + # 3 Options + def createSettingBoxRadioButtons( + self, + for_var_label_text, for_var_desc_text, + radio_button_attr_name, + variable, + command, + radiobutton_keys_values=dict, + ): + + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(radio_button_attr_name, for_var_label_text, for_var_desc_text) + + row=0 + for key, value in radiobutton_keys_values.items(): + radiobutton_wrapper = CTkFrame(setting_box_item_frame, corner_radius=6, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0, cursor="hand2") + radiobutton_wrapper.grid(row=row, column=0, sticky="ew") + row+=1 + + radiobutton_wrapper.grid_rowconfigure((0,2), weight=1) + setting_box_radio_button = CTkRadioButton( + radiobutton_wrapper, + textvariable=value, + font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__RADIO_BUTTON_FONT_SIZE, weight="normal"), + variable=variable, + value=key, + text_color=self.settings.ctm.SB__RADIOBUTTON_TEXT_COLOR, + fg_color=self.settings.ctm.SB__RADIOBUTTON_SELECTED_COLOR, + border_color=self.settings.ctm.SB__RADIOBUTTON_BORDER_COLOR, + hover=False + ) + setting_box_radio_button.grid(row=1, column=0, padx=10, pady=10, sticky="ew") + + if key == variable.get(): + setting_box_radio_button.select() + + setting_box_radio_button._canvas.unbind("") + setting_box_radio_button._text_label.unbind("") + setting_box_radio_button._text_label.grid(padx=(10,0)) + + + def buttonPressedFunction(radiobutton_wrapper, radiobutton_widget, _e): + radiobutton_wrapper.configure(fg_color=self.settings.ctm.SB__RADIOBUTTON_BG_CLICKED_COLOR) + + def buttonReleasedFunction(radiobutton_wrapper, radiobutton_widget, _e): + radiobutton_wrapper.configure(fg_color=self.settings.ctm.SB__RADIOBUTTON_BG_HOVERED_COLOR) + radiobutton_widget.select() + command() + + def enterFunction(radiobutton_wrapper, _e): + radiobutton_wrapper.configure(fg_color=self.settings.ctm.SB__RADIOBUTTON_BG_HOVERED_COLOR) + + def leaveFunction(radiobutton_wrapper, _e): + radiobutton_wrapper.configure(fg_color=self.settings.ctm.SB__BG_COLOR) + + + bindEnterAndLeaveFunction( + target_widgets=[radiobutton_wrapper, setting_box_radio_button, setting_box_radio_button._bg_canvas], + enterFunction=partial(enterFunction, radiobutton_wrapper), + leaveFunction=partial(leaveFunction, radiobutton_wrapper) + ) + + bindButtonPressFunction( + target_widgets=[radiobutton_wrapper, setting_box_radio_button, setting_box_radio_button._bg_canvas], + buttonPressedFunction=partial(buttonPressedFunction, radiobutton_wrapper, setting_box_radio_button) + ) + + bindButtonReleaseFunction( + target_widgets=[radiobutton_wrapper, setting_box_radio_button, setting_box_radio_button._bg_canvas], + buttonReleasedFunction=partial(buttonReleasedFunction, radiobutton_wrapper, setting_box_radio_button) + ) + + + return setting_box_frame + + def createSettingBoxAutoExportMessageLogs( self, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index 8a10fb6a..bacfa71f 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -5,6 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_variable): sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) createSettingBoxCheckbox = sbg.createSettingBoxCheckbox + createSettingBoxRadioButtons = sbg.createSettingBoxRadioButtons createSettingBoxAutoExportMessageLogs = sbg.createSettingBoxAutoExportMessageLogs @@ -14,6 +15,9 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v def checkbox_send_only_translated_messages_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES, checkbox_box_widget.get()) + def checkbox_send_message_button_type_callback(): + callFunctionIfCallable(view_variable.CALLBACK_SET_SEND_MESSAGE_BUTTON_TYPE, view_variable.VAR_SEND_MESSAGE_BUTTON_TYPE.get()) + def checkbox_notice_xsoverlay_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) @@ -48,6 +52,16 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v config_window.sb__send_only_translated_messages.grid(row=row) row+=1 + config_window.sb__send_message_button_type = createSettingBoxRadioButtons( + for_var_label_text=view_variable.VAR_LABEL_SEND_MESSAGE_BUTTON_TYPE, + for_var_desc_text=view_variable.VAR_DESC_SEND_MESSAGE_BUTTON_TYPE, + radio_button_attr_name="sb__radiobutton_send_message_button_type", + command=lambda: checkbox_send_message_button_type_callback(), + variable=view_variable.VAR_SEND_MESSAGE_BUTTON_TYPE, + radiobutton_keys_values=view_variable.KEYS_VALUES_SEND_MESSAGE_BUTTON_TYPE, + ) + config_window.sb__send_message_button_type.grid(row=row) + row+=1 config_window.sb__notice_xsoverlay = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY, diff --git a/vrct_gui/main_window/createMainWindowWidgets.py b/vrct_gui/main_window/createMainWindowWidgets.py index 16a402d7..c09f4bca 100644 --- a/vrct_gui/main_window/createMainWindowWidgets.py +++ b/vrct_gui/main_window/createMainWindowWidgets.py @@ -120,4 +120,4 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable): createTextbox(settings, vrct_gui, view_variable) - createEntryMessageBox(settings, vrct_gui) \ No newline at end of file + createEntryMessageBox(settings, vrct_gui, view_variable) \ No newline at end of file diff --git a/vrct_gui/main_window/widgets/create_entry_message_box.py b/vrct_gui/main_window/widgets/create_entry_message_box.py index 2be17e9c..f49664e5 100644 --- a/vrct_gui/main_window/widgets/create_entry_message_box.py +++ b/vrct_gui/main_window/widgets/create_entry_message_box.py @@ -1,7 +1,10 @@ -from customtkinter import CTkFont, CTkFrame, CTkTextbox +from customtkinter import CTkFont, CTkFrame, CTkTextbox, CTkLabel, CTkImage -def createEntryMessageBox(settings, main_window): - main_window.main_entry_message_container = CTkFrame(main_window.main_bg_container, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0) +from ...ui_utils import bindButtonFunctionAndColor +from utils import callFunctionIfCallable + +def createEntryMessageBox(settings, main_window, view_variable): + main_window.main_entry_message_container = CTkFrame(main_window.main_bg_container, corner_radius=settings.uism.TEXTBOX_ENTRY_CORNER_RADIUS, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0) main_window.main_entry_message_container.grid(row=2, column=0, sticky="nsew") @@ -9,6 +12,7 @@ def createEntryMessageBox(settings, main_window): main_window.main_entry_message_container.grid_rowconfigure(0, weight=1) main_window.entry_message_box = CTkTextbox( main_window.main_entry_message_container, + corner_radius=settings.uism.TEXTBOX_ENTRY_CORNER_RADIUS, border_color=settings.ctm.TEXTBOX_ENTRY_BORDER_COLOR, fg_color=settings.ctm.TEXTBOX_ENTRY_BG_COLOR, text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR, @@ -31,3 +35,58 @@ def createEntryMessageBox(settings, main_window): main_window.entry_message_box.bind("", messageBoxAnyKeyPress) + + main_window.main_send_message_button_container = CTkFrame(main_window.main_entry_message_container, corner_radius=settings.uism.SEND_MESSAGE_BUTTON_CORNER_RADIUS, fg_color=settings.ctm.SEND_MESSAGE_BUTTON_BG_COLOR, width=0, height=0) + main_window.main_send_message_button_container.grid(row=0, column=1, padx=(0, settings.uism.TEXTBOX_ENTRY_PADX), pady=settings.uism.TEXTBOX_ENTRY_PADY, sticky="nsew") + + main_window.main_send_message_button_container.grid_columnconfigure(0, weight=0, minsize=settings.uism.SEND_MESSAGE_BUTTON_MIN_WIDTH) + main_window.main_send_message_button_container.grid_rowconfigure(0, weight=1) + + + + + main_window.main_send_message_button = CTkFrame(main_window.main_send_message_button_container, corner_radius=0, fg_color=settings.ctm.SEND_MESSAGE_BUTTON_BG_COLOR, height=0, width=0) + main_window.main_send_message_button.grid(row=0, column=0, sticky="nsew") + main_window.main_send_message_button.configure(cursor="hand2") + + main_window.main_send_message_button.grid_columnconfigure((0,2), weight=1) + main_window.main_send_message_button.grid_rowconfigure((0,2), weight=1) + + main_window.main_send_message_button_image = CTkLabel( + main_window.main_send_message_button, + text=None, + height=0, + image=CTkImage((settings.image_file.SEND_MESSAGE_ICON),size=(settings.uism.SEND_MESSAGE_BUTTON_IMAGE_SIZE,settings.uism.SEND_MESSAGE_BUTTON_IMAGE_SIZE)), + ) + main_window.main_send_message_button_image.grid(row=1, column=1) + + + + bindButtonFunctionAndColor( + target_widgets=[main_window.main_send_message_button, main_window.main_send_message_button_image], + enter_color=settings.ctm.SEND_MESSAGE_BUTTON_BG_HOVERED_COLOR, + leave_color=settings.ctm.SEND_MESSAGE_BUTTON_BG_COLOR, + clicked_color=settings.ctm.SEND_MESSAGE_BUTTON_BG_CLICKED_COLOR, + buttonReleasedFunction=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_CLICKED_SEND_MESSAGE_BUTTON, _e), + ) + + + + + + + main_window.main_send_message_button__disabled = CTkFrame(main_window.main_send_message_button_container, corner_radius=0, fg_color=settings.ctm.SEND_MESSAGE_BUTTON_BG_COLOR, height=0, width=0) + main_window.main_send_message_button__disabled.grid(row=0, column=0, sticky="nsew") + + main_window.main_send_message_button__disabled.grid_columnconfigure((0,2), weight=1) + main_window.main_send_message_button__disabled.grid_rowconfigure((0,2), weight=1) + + main_window.main_send_message_button_image__disabled = CTkLabel( + main_window.main_send_message_button__disabled, + text=None, + height=0, + image=CTkImage((settings.image_file.SEND_MESSAGE_ICON_DISABLED),size=(settings.uism.SEND_MESSAGE_BUTTON_IMAGE_SIZE,settings.uism.SEND_MESSAGE_BUTTON_IMAGE_SIZE)), + ) + main_window.main_send_message_button_image__disabled.grid(row=1, column=1) + + main_window.main_send_message_button__disabled.grid_remove() \ No newline at end of file diff --git a/vrct_gui/main_window/widgets/create_textbox.py b/vrct_gui/main_window/widgets/create_textbox.py index 41203049..b3ed7446 100644 --- a/vrct_gui/main_window/widgets/create_textbox.py +++ b/vrct_gui/main_window/widgets/create_textbox.py @@ -59,7 +59,7 @@ def createTextbox(settings, main_window, view_variable): # Text box main_window.main_bg_container.grid_rowconfigure(1, weight=1) main_window.main_textbox_container = CTkFrame(main_window.main_bg_container, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0) - main_window.main_textbox_container.grid(row=1, column=0, sticky="nsew") + main_window.main_textbox_container.grid(row=1, column=0, columnspan=2, sticky="nsew") main_window.main_textbox_container.grid_columnconfigure(0,weight=1) main_window.main_textbox_container.grid_rowconfigure(0,weight=1) diff --git a/vrct_gui/ui_managers/Themes/_darkTheme.py b/vrct_gui/ui_managers/Themes/_darkTheme.py index 93c81365..fe3c1aa9 100644 --- a/vrct_gui/ui_managers/Themes/_darkTheme.py +++ b/vrct_gui/ui_managers/Themes/_darkTheme.py @@ -35,6 +35,10 @@ def _darkTheme(base_color): TEXTBOX_ENTRY_PLACEHOLDER_COLOR = base_color.DARK_500_COLOR, TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR = base_color.DARK_700_COLOR, + SEND_MESSAGE_BUTTON_BG_COLOR = base_color.DARK_850_COLOR, + SEND_MESSAGE_BUTTON_BG_HOVERED_COLOR = base_color.DARK_825_COLOR, + SEND_MESSAGE_BUTTON_BG_CLICKED_COLOR = base_color.DARK_900_COLOR, + # Sidebar SIDEBAR_BG_COLOR = base_color.DARK_850_COLOR, @@ -216,6 +220,12 @@ def _darkTheme(base_color): SB__CHECKBOX_CHECKED_COLOR = base_color.PRIMARY_700_COLOR, SB__CHECKBOX_CHECKMARK_COLOR = base_color.DARK_BASIC_TEXT_COLOR, + SB__RADIOBUTTON_TEXT_COLOR = base_color.DARK_300_COLOR, + SB__RADIOBUTTON_BORDER_COLOR = base_color.DARK_600_COLOR, + SB__RADIOBUTTON_SELECTED_COLOR = base_color.PRIMARY_400_COLOR, + SB__RADIOBUTTON_BG_HOVERED_COLOR = base_color.DARK_825_COLOR, + SB__RADIOBUTTON_BG_CLICKED_COLOR = base_color.DARK_900_COLOR, + SB__ENTRY_TEXT_COLOR = base_color.DARK_300_COLOR, SB__ENTRY_BG_COLOR = base_color.DARK_863_COLOR, SB__ENTRY_BORDER_COLOR = base_color.DARK_775_COLOR, @@ -301,6 +311,8 @@ def _darkTheme(base_color): ARROW_LEFT = getImageFileFromUiUtils("arrow_left_white.png"), ARROW_LEFT_DISABLED = getImageFileFromUiUtils("arrow_left_disabled.png"), + SEND_MESSAGE_ICON = getImageFileFromUiUtils("send_message_icon_white.png"), + SEND_MESSAGE_ICON_DISABLED = getImageFileFromUiUtils("send_message_icon_black.png"), REFRESH_UPDATE_ICON = getImageFileFromUiUtils("refresh_update_icon.png"), REFRESH_ICON = getImageFileFromUiUtils("refresh_icon.png"), HELP_ICON = getImageFileFromUiUtils("help_icon_white.png"), diff --git a/vrct_gui/ui_managers/Themes/_lightTheme.py b/vrct_gui/ui_managers/Themes/_lightTheme.py index 96c11238..0815e602 100644 --- a/vrct_gui/ui_managers/Themes/_lightTheme.py +++ b/vrct_gui/ui_managers/Themes/_lightTheme.py @@ -35,6 +35,10 @@ def _lightTheme(base_color): TEXTBOX_ENTRY_PLACEHOLDER_COLOR = base_color.LIGHT_600_COLOR, TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR = base_color.LIGHT_400_COLOR, + SEND_MESSAGE_BUTTON_BG_COLOR = base_color.LIGHT_300_COLOR, + SEND_MESSAGE_BUTTON_BG_HOVERED_COLOR = base_color.LIGHT_325_COLOR, + SEND_MESSAGE_BUTTON_BG_CLICKED_COLOR = base_color.LIGHT_350_COLOR, + # Sidebar SIDEBAR_BG_COLOR = base_color.LIGHT_250_COLOR, @@ -209,6 +213,12 @@ def _lightTheme(base_color): SB__CHECKBOX_CHECKED_COLOR = base_color.PRIMARY_250_COLOR, SB__CHECKBOX_CHECKMARK_COLOR = base_color.LIGHT_BASIC_TEXT_COLOR, + SB__RADIOBUTTON_TEXT_COLOR = base_color.LIGHT_900_COLOR, + SB__RADIOBUTTON_BORDER_COLOR = base_color.LIGHT_600_COLOR, + SB__RADIOBUTTON_SELECTED_COLOR = base_color.PRIMARY_400_COLOR, + SB__RADIOBUTTON_BG_HOVERED_COLOR = base_color.LIGHT_300_COLOR, + SB__RADIOBUTTON_BG_CLICKED_COLOR = base_color.LIGHT_325_COLOR, + SB__ENTRY_TEXT_COLOR = base_color.LIGHT_900_COLOR, SB__ENTRY_BG_COLOR = base_color.LIGHT_300_COLOR, SB__ENTRY_BORDER_COLOR = base_color.LIGHT_400_COLOR, @@ -295,6 +305,8 @@ def _lightTheme(base_color): ARROW_LEFT = getImageFileFromUiUtils("arrow_left_black.png"), ARROW_LEFT_DISABLED = getImageFileFromUiUtils("arrow_left_disabled.png"), + SEND_MESSAGE_ICON = getImageFileFromUiUtils("send_message_icon_black.png"), + SEND_MESSAGE_ICON_DISABLED = getImageFileFromUiUtils("send_message_icon_white.png"), REFRESH_UPDATE_ICON = getImageFileFromUiUtils("refresh_update_icon.png"), REFRESH_ICON = getImageFileFromUiUtils("refresh_icon.png"), HELP_ICON = getImageFileFromUiUtils("help_icon_black.png"), diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 85b1997f..0d9518e4 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -50,11 +50,18 @@ class UiScalingManager(): self.main.TEXTBOX_FONT_SIZE__MAIN_TEXT_FONT = self._calculateUiSize(16) self.main.TEXTBOX_ENTRY_FONT_SIZE = self._calculateUiSize(16) + self.main.TEXTBOX_ENTRY_CORNER_RADIUS = self._calculateUiSize(4) self.main.TEXTBOX_ENTRY_BORDER_SIZE = self._calculateUiSize(2, is_allowed_odd=True) self.main.TEXTBOX_ENTRY_HEIGHT = self._calculateUiSize(40) self.main.TEXTBOX_ENTRY_PADX = self.main.TEXTBOX_PADX self.main.TEXTBOX_ENTRY_PADY = self._calculateUiSize(10) + self.main.SEND_MESSAGE_BUTTON_CORNER_RADIUS = self.main.TEXTBOX_ENTRY_CORNER_RADIUS + self.main.SEND_MESSAGE_BUTTON_IMAGE_SIZE = self._calculateUiSize(20) + self.main.SEND_MESSAGE_BUTTON_MIN_WIDTH = self._calculateUiSize(40) + self.main.SEND_MESSAGE_BUTTON_RATE_WIDTH = self._calculateUiSize(6) + self.main.SEND_MESSAGE_BUTTON_MAX_WIDTH = self._calculateUiSize(100) + # Sidebar # Sidebar Features From 2d9228034d49289ed9b3ef751dda4fb18f814025 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 04:57:08 +0900 Subject: [PATCH 34/43] =?UTF-8?q?[bugfix]=20Config=20Window:=20Send=20Mess?= =?UTF-8?q?age=20Button.=20=E9=81=B8=E6=8A=9E=E9=A0=85=E7=9B=AE=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E6=99=82=EF=BC=88=E9=9D=9E=E8=A1=A8=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=EF=BC=89=E3=81=AB=E3=83=A1=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=AE=E3=82=AB=E3=83=90=E3=83=BC=E3=81=8C?= =?UTF-8?q?=E5=89=8D=E3=81=AB=E5=87=BA=E3=81=A6=E3=81=8F=E3=82=8B=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=80=82=20=E9=81=B8?= =?UTF-8?q?=E6=8A=9E=E6=99=82=E3=81=AB=E9=81=85=E5=BB=B6=E3=81=95=E3=81=9B?= =?UTF-8?q?=E3=81=A6Config=20Window=E3=81=AElift()=E3=82=92=E8=A1=8C?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=84=E3=82=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/view.py b/view.py index 1f6d75bb..eb0f2665 100644 --- a/view.py +++ b/view.py @@ -1159,8 +1159,10 @@ class View(): match (status): case "hide": vrct_gui.main_send_message_button_container.grid_remove() + vrct_gui.config_window.after(200, vrct_gui.config_window.lift) case "show" | "show_and_disable_enter_key": vrct_gui.main_send_message_button_container.grid() + vrct_gui.config_window.after(200, vrct_gui.config_window.lift) # Function def _adjustUiSizeAndRestart(self): From 827e92e6f37dd1354d7147c663b909836d89efd4 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 05:08:33 +0900 Subject: [PATCH 35/43] =?UTF-8?q?[Update]=20Main=20Window:=20=E9=80=81?= =?UTF-8?q?=E4=BF=A1=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E6=8A=BC=E3=81=97?= =?UTF-8?q?=E3=81=9F=E5=BE=8C=E3=80=81=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E5=85=A5=E5=8A=9B=E6=AC=84=E3=81=AB=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=BC=E3=82=AB=E3=82=B9=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 1 + 1 file changed, 1 insertion(+) diff --git a/view.py b/view.py index eb0f2665..18f8ba77 100644 --- a/view.py +++ b/view.py @@ -515,6 +515,7 @@ class View(): return "break" # For deleting the next line that will be inserted when the Enter key is pressed. def pressedSendMessageButtonFunction(_e): main_window_registers.get("message_box_bind_Return")() + vrct_gui.entry_message_box.focus() entry_message_box = getattr(vrct_gui, "entry_message_box") entry_message_box.bind("", lambda _e: None) # This is to prevent message sending on Shift + Enter key press and just add a new line. From 29def026fcf984328e637d8e70c14312e67228a7 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 05:49:17 +0900 Subject: [PATCH 36/43] =?UTF-8?q?[bugfix]=20Main=20Window:=20=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E5=85=A5=E5=8A=9B=E6=AC=84?= =?UTF-8?q?Disabled=E6=99=82=E3=81=A7=E3=82=82=E3=80=81=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=BC=E3=82=AB=E3=82=B9=E3=82=92=E5=BD=93=E3=81=A6=E3=81=A6?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=BF=E3=83=BC=E3=82=AD=E3=83=BC=E3=82=92?= =?UTF-8?q?=E6=8A=BC=E3=81=9B=E3=81=B0=E3=80=81=E9=80=81=E4=BF=A1=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E3=81=A6=E3=81=97=E3=81=BE=E3=81=A3=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 4 ++++ vrct_gui/_changeMainWindowWidgetsStatus.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/view.py b/view.py index 18f8ba77..9fc72a49 100644 --- a/view.py +++ b/view.py @@ -94,6 +94,8 @@ class View(): CALLBACK_WHEN_DETECT_WINDOW_OVERED_SIZE=self._showDisplayOverUiSizeConfirmationModal, + IS_ENTRY_MESSAGE_BOX_DISABLED=False, + # Confirmation Modal CALLBACK_HIDE_CONFIRMATION_MODAL=None, CALLBACK_ACCEPTED_CONFIRMATION_MODAL=None, @@ -510,6 +512,8 @@ class View(): def adjustedMessageBoxReturnFunction(_e): + if self.view_variable.IS_ENTRY_MESSAGE_BOX_DISABLED is True: + return if config.SEND_MESSAGE_BUTTON_TYPE != "show_and_disable_enter_key": main_window_registers.get("message_box_bind_Return")() return "break" # For deleting the next line that will be inserted when the Enter key is pressed. diff --git a/vrct_gui/_changeMainWindowWidgetsStatus.py b/vrct_gui/_changeMainWindowWidgetsStatus.py index 86bbe0f6..95fc38dc 100644 --- a/vrct_gui/_changeMainWindowWidgetsStatus.py +++ b/vrct_gui/_changeMainWindowWidgetsStatus.py @@ -142,8 +142,10 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta case "entry_message_box": if status == "disabled": vrct_gui.entry_message_box.configure(state="disabled", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR) + view_variable.IS_ENTRY_MESSAGE_BOX_DISABLED = True elif status == "normal": vrct_gui.entry_message_box.configure(state="normal", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR) + view_variable.IS_ENTRY_MESSAGE_BOX_DISABLED = False case "send_message_button": From 01cbb9c30b70c6516b834f85e09468964abdec47 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 06:19:25 +0900 Subject: [PATCH 37/43] =?UTF-8?q?[Update]=20config.ENABLE=5FSPEAKER2CHATBO?= =?UTF-8?q?X=20True=E6=99=82=E3=81=AB=E3=81=AF=E3=82=A2=E3=83=83=E3=83=97?= =?UTF-8?q?=E3=83=87=E3=83=BC=E3=83=88=E7=A2=BA=E8=AA=8D=E3=82=92=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=80=82Speaker2C?= =?UTF-8?q?hatbox=E6=A9=9F=E8=83=BD=E4=BD=BF=E7=94=A8=E8=80=85=E3=81=8C?= =?UTF-8?q?=E5=A4=9A=E3=81=8F=E3=81=AA=E3=81=A3=E3=81=A6=E3=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=81=8C=E5=A4=A7=E5=A4=89=E3=81=A8=E6=80=9D=E3=81=86?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E3=81=AF=E5=80=8B=E5=88=A5=E3=81=AB=E6=89=8B?= =?UTF-8?q?=E5=8B=95=E3=81=A7=E9=85=8D=E5=B8=83=E3=81=99=E3=82=8B=E6=96=B9?= =?UTF-8?q?=E9=87=9D=E3=80=82=20=E3=81=BE=E3=81=9F=E3=80=81Speaker2Chatbox?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=81=8CON=E3=81=AB=E3=81=AA=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=82=8B=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=81=AB=E3=81=AF=E3=80=81=E3=81=9D=E3=81=AE=E6=97=A8?= =?UTF-8?q?=E3=82=92=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E6=83=85=E5=A0=B1=E9=83=A8=E5=88=86?= =?UTF-8?q?=E3=81=AB=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 5 +++-- view.py | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/controller.py b/controller.py index f81ec108..565fc0fa 100644 --- a/controller.py +++ b/controller.py @@ -813,8 +813,9 @@ def createMainWindow(): model.addKeywords() # check Software Updated - if model.checkSoftwareUpdated() is True: - view.showUpdateAvailableButton() + if config.ENABLE_SPEAKER2CHATBOX is False: + if model.checkSoftwareUpdated() is True: + view.showUpdateAvailableButton() # init logger if config.ENABLE_LOGGER is True: diff --git a/view.py b/view.py index 9fc72a49..ef8bf6c2 100644 --- a/view.py +++ b/view.py @@ -30,6 +30,11 @@ class View(): ui_language=config.UI_LANGUAGE, ) + if config.ENABLE_SPEAKER2CHATBOX is False: + VERSION_TEXT=i18n.t("config_window.version", version=config.VERSION) + else: + VERSION_TEXT=i18n.t("config_window.version", version=config.VERSION) + " (Speaker2Chatbox)" + self.settings = SimpleNamespace() theme = get_appearance_mode() if config.APPEARANCE_THEME == "System" else config.APPEARANCE_THEME all_ctm = ColorThemeManager(theme) @@ -180,7 +185,7 @@ class View(): ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_appearance", CALLBACK_SELECTED_SETTING_BOX_TAB=None, VAR_ERROR_MESSAGE=StringVar(value=""), - VAR_VERSION=StringVar(value=i18n.t("config_window.version", version=config.VERSION)), + VAR_VERSION=StringVar(value=VERSION_TEXT), VAR_CONFIG_WINDOW_TITLE=StringVar(value=i18n.t("config_window.config_title")), VAR_CONFIG_WINDOW_COMPACT_MODE_LABEL=StringVar(value=i18n.t("config_window.compact_mode")), VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL=StringVar(value=i18n.t("config_window.restart_message")), From 65299a6e9428c38ef0d096c2f7967ffd221d243b Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 06:36:58 +0900 Subject: [PATCH 38/43] =?UTF-8?q?[Update]=20Add=20pyinstaller=20to=20requi?= =?UTF-8?q?rements.txt.=20=E9=96=8B=E7=99=BA=E7=92=B0=E5=A2=83=E3=81=AEpyi?= =?UTF-8?q?nstaller=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E9=81=95?= =?UTF-8?q?=E3=81=84=E3=81=AB=E3=82=88=E3=82=8A=E3=80=81=E3=83=93=E3=83=AB?= =?UTF-8?q?=E3=83=89=E6=99=82=E3=81=AE=E6=8C=99=E5=8B=95=E3=81=8C=E9=81=95?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=9F=E3=82=81=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E3=80=82=E5=9B=BA=E5=AE=9A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 42f4be2c..bff366c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,5 @@ deepl == 1.15.0 flashtext == 2.7 pyyaml == 6.0.1 python-i18n == 0.3.9 -CTkToolTip == 0.8 \ No newline at end of file +CTkToolTip == 0.8 +pyinstaller==6.2.0 \ No newline at end of file From bcb8d9c39480a1b04ef484f68e190f704a6464d4 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:43:08 +0900 Subject: [PATCH 39/43] =?UTF-8?q?[bugfix]=20=E3=83=AF=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF=E3=83=BC=E3=81=AB=E5=8D=98?= =?UTF-8?q?=E8=AA=9E=E8=BF=BD=E5=8A=A0=E5=BE=8C=E3=80=81EntryBox=E3=81=8C?= =?UTF-8?q?=E7=A9=BA=E3=81=AB=E3=81=AA=E3=82=89=E3=81=AA=E3=81=84=E3=83=90?= =?UTF-8?q?=E3=82=B0=E4=BF=AE=E6=AD=A3=E3=80=82=20idk=20why,=20but=20in=20?= =?UTF-8?q?CTkEntry=20and=20CTkTextbox,=20the=20first=20argument=20for=20t?= =?UTF-8?q?he=20delete=20function=20is=20different.=20Otherwise,=20it=20th?= =?UTF-8?q?rows=20an=20error=20and=20doesn't=20work.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/view.py b/view.py index ef8bf6c2..546ab972 100644 --- a/view.py +++ b/view.py @@ -852,8 +852,15 @@ class View(): # Widget Control # Common + + # Note: The difference between _clearEntryBox and _clearTextBox + # idk why, but in CTkEntry and CTkTextbox, the first argument for the delete function is different. Otherwise, it throws an error. @staticmethod def _clearEntryBox(entry_widget): + entry_widget.delete(0, "end") + + @staticmethod + def _clearTextBox(entry_widget): entry_widget.delete("1.0", "end") def clearErrorMessage(self): @@ -1508,7 +1515,7 @@ class View(): return vrct_gui.entry_message_box.get('1.0', "end-1c") def clearMessageBox(self): - self._clearEntryBox(vrct_gui.entry_message_box) + self._clearTextBox(vrct_gui.entry_message_box) From caf9f87db6c72fc77d285977e855649b9cae2318 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 08:17:44 +0900 Subject: [PATCH 40/43] [Update] Config Window: add corner radius to image buttons. --- .../setting_box_containers/_SettingBoxGenerator.py | 8 +++++++- vrct_gui/ui_managers/UiScalingManager.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index 263204d3..7d44a2bb 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -355,6 +355,7 @@ class _SettingBoxGenerator(): button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR, button_image_file=self.settings.image_file.FOLDER_OPEN_ICON, button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE, + corner_radius=self.settings.uism.SB__BUTTON_CORNER_RADIUS, button_ipadxy=self.settings.uism.SB__BUTTON_IPADXY, button_command=button_command, ) @@ -941,7 +942,8 @@ class _SettingBoxGenerator(): button_enter_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR, button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR, button_image_file=button_image, - button_image_size=self.settings.uism.SB__OPEN_CONFIG_FILE_BUTTON_ICON_SIZE, + button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE, + corner_radius=self.settings.uism.SB__BUTTON_CORNER_RADIUS, button_ipadxy=self.settings.uism.SB__OPEN_CONFIG_FILE_BUTTON_IPADXY, button_command=button_command, ) @@ -987,6 +989,7 @@ class _SettingBoxGenerator(): button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR, button_image_file=self.settings.image_file.ARROW_LEFT.rotate(270), button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE, + corner_radius=self.settings.uism.SB__BUTTON_CORNER_RADIUS, button_ipadxy=self.settings.uism.SB__BUTTON_IPADXY, button_command=open_command, ) @@ -1001,6 +1004,7 @@ class _SettingBoxGenerator(): button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR, button_image_file=self.settings.image_file.ARROW_LEFT.rotate(90), button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE, + corner_radius=self.settings.uism.SB__BUTTON_CORNER_RADIUS, button_ipadxy=self.settings.uism.SB__BUTTON_IPADXY, button_command=close_command, ) @@ -1216,6 +1220,7 @@ class _SettingBoxGenerator(): button_clicked_color=self.settings.ctm.SB__ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_CLICKED_BG_COLOR, button_image_file=self.settings.image_file.CANCEL_ICON, button_image_size=self.settings.uism.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_IMG_SIZE, + corner_radius=self.settings.uism.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_CORNER_RADIUS, button_ipadxy=self.settings.uism.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_IPADXY, button_command=lambda _e: pressedDeleteButtonCommand(_e, delete_button, redo_button), ) @@ -1228,6 +1233,7 @@ class _SettingBoxGenerator(): button_clicked_color=self.settings.ctm.SB__ADD_AND_DELETE_ABLE_LIST__VALUES_DELETED_BUTTON_CLICKED_BG_COLOR, button_image_file=self.settings.image_file.REDO_ICON, button_image_size=self.settings.uism.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_IMG_SIZE, + corner_radius=self.settings.uism.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_CORNER_RADIUS, button_ipadxy=self.settings.uism.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_IPADXY, button_command=lambda _e: pressedRedoButtonCommand(_e, delete_button, redo_button), ) diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 0d9518e4..2e02b1bf 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -307,6 +307,7 @@ class UiScalingManager(): self.config_window.ADD_AND_DELETE_ABLE_LIST__VALUES_TEXT_IPADX = (self._calculateUiSize(8), 0) self.config_window.ADD_AND_DELETE_ABLE_LIST__VALUES_TEXT_IPADY = self._calculateUiSize(6) self.config_window.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_IMG_SIZE = self._calculateUiSize(14) + self.config_window.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_CORNER_RADIUS = self._calculateUiSize(4) self.config_window.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_IPADXY = self._calculateUiSize(6) self.config_window.ADD_AND_DELETE_ABLE_LIST__VALUES_ACTION_BUTTON_PADX = (self._calculateUiSize(6), self._calculateUiSize(8)) @@ -333,9 +334,9 @@ class UiScalingManager(): self.config_window.SB__BUTTON_IPADXY = self._calculateUiSize(16) self.config_window.SB__BUTTON_ICON_SIZE = self._calculateUiSize(24) + self.config_window.SB__BUTTON_CORNER_RADIUS = self.config_window.BUTTONS_CORNER_RADIUS self.config_window.SB__OPEN_CONFIG_FILE_BUTTON_IPADXY = self._calculateUiSize(10) - self.config_window.SB__OPEN_CONFIG_FILE_BUTTON_ICON_SIZE = self._calculateUiSize(20) def _calculateUiSize(self, default_size, is_allowed_odd:bool=False, is_zero_allowed:bool=False): From 24f7823f4496754f61f6517f764aed0d24e14afb Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 08:19:40 +0900 Subject: [PATCH 41/43] =?UTF-8?q?[bugfix]=20Word=20Filter:=20=E5=8D=98?= =?UTF-8?q?=E8=AA=9E=E5=89=8A=E9=99=A4=E6=99=82=E3=80=81=E5=8D=B3=E5=BA=A7?= =?UTF-8?q?=E3=81=AB=E8=A8=AD=E5=AE=9A=E3=81=8C=E5=8F=8D=E6=98=A0=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controller.py b/controller.py index 565fc0fa..42f17be6 100644 --- a/controller.py +++ b/controller.py @@ -593,6 +593,8 @@ def callbackDeleteMicWordFilter(value): new_input_mic_word_filter_list.remove(str(value)) config.INPUT_MIC_WORD_FILTER = new_input_mic_word_filter_list view.setLatestConfigVariable("MicMicWordFilter") + model.resetKeywordProcessor() + model.addKeywords() except Exception: print("There was no the target word in config.INPUT_MIC_WORD_FILTER") From 38a8a17b105da26e4a7ffb3913275a88183f4402 Mon Sep 17 00:00:00 2001 From: Soumt Date: Sun, 7 Jan 2024 16:47:56 +0900 Subject: [PATCH 42/43] [Update] Locales : Add some Korean strings --- locales/ko.yml | 237 ++++++++++++++++++++++++++++++------------------- 1 file changed, 147 insertions(+), 90 deletions(-) diff --git a/locales/ko.yml b/locales/ko.yml index 4beda7f2..5b0083bf 100644 --- a/locales/ko.yml +++ b/locales/ko.yml @@ -1,188 +1,245 @@ main_window: translation: 번역 - transcription_send: 마이크 -> 챗박스 - transcription_receive: 스피커 -> 로그 + transcription_send: 음성인식 (마이크) + transcription_receive: 음성인식 (스피커) foreground: 항상 위로 - # language_settings: Language Settings - # your_language: Your Language - # both_direction_desc: Translate Each Other - # target_language: Target Language + language_settings: 언어 설정 + your_language: 당신의 언어 + both_direction_desc: 양방향으로 번역 + swap_button_label: 언어 교체 + target_language: 상대방의 언어 textbox_tab_all: 전체 textbox_tab_sent: 전송 textbox_tab_received: 수신 textbox_tab_system: 시스템 - # textbox_system_message: - # enabled_translation: Translation feature is turned on. - # disabled_translation: Translation feature is turned off. - # enabled_voice2chatbox: Transcription from the microphone has started. - # disabled_voice2chatbox: Transcription from the microphone has been stopped. - # enabled_speaker2log: Transcription from the speaker has started. - # disabled_speaker2log: Transcription from the speaker has been stopped. - # enabled_foreground: The screen is fixed in the foreground. - # disabled_foreground: The foreground fixation has been released. + textbox_system_message: + enabled_translation: 번역 기능을 시작합니다. + disabled_translation: 번역 기능이 중지되었습니다. + enabled_voice2chatbox: 마이크에서의 음성인식을 시작합니다. + disabled_voice2chatbox: 마이크에서의 음성인식이 중지되었습니다. + enabled_speaker2log: 스피커에서의 음성인식을 시작합니다. + disabled_speaker2log: 스피커에서의 음성인식이 중지되었습니다. + enabled_foreground: 화면을 항상 위로 고정합니다. + disabled_foreground: 화면 고정이 해제되었습니다. - # auth_key_success: Auth key update completed. - # auth_key_error: Auth Key is incorrect or Usage limit reached. + auth_key_success: 인증키 갱신이 완료되었습니다. + auth_key_error: 인증 키가 잘못되었거나 API 사용 제한이 상한선에 도달했습니다. - # no_mic_device_detected_error: No mic device detected. - # no_speaker_device_detected_error: No speaker device detected. - # translation_engine_limit_error: It has automatically disabled the translation feature. Access has been temporarily restricted due to an excessive number of requests to the translation engine. Please wait for a while, restart VRCT, and try again. + no_mic_device_detected_error: 마이크 디바이스를 찾지 못했습니다. + no_speaker_device_detected_error: 스피커 디바이스를 찾지 못했습니다. + translation_engine_limit_error: 번역 기능이 자동으로 중지되었습니다. 번역 엔진에 대한 요청이 너무 많아 일시적으로 사용이 제한되고 있습니다. 잠시 기다렸다가 VRCT를 재부팅하고 다시 시도해 보세요. - # detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter. + detected_by_word_filter: 단어 필터에 등록된 단어 %{detected_message}(이)가 감지되어 전송하지 않았습니다. - # selected_your_language: "\"Your Language\" has set to %{your_language}." - # selected_target_language: "\"Target Language\" has set to %{target_language}." - # switched_language_preset_tab: Switched to Language Preset Tab No.%{tab_no}." - # latest_language_setting: "Currently, \"Your Language\" is set to %{your_language}, and \"Target Language\" is set to %{target_language}." + selected_your_language: "'당신의 언어'가 %{your_language}(으)로 설정되었습니다." + selected_target_language: "'상대방의 언어'가 %{target_language}(으)로 설정되었습니다." + switched_language_preset_tab: 언어 프리셋 번호 %{tab_no}로 전환되었습니다. + latest_language_setting: "현재 '당신의 언어'는 %{your_language}, '상대방의 언어'는 %{target_language}(으)로 설정되어 있습니다." - # opened_web_page_booth: Opened Booth page in your web browser. - # opened_web_page_vrct_documents: "Opened VRCT Documents page in your web browser.\nFor any issues, requests, or inquiries, please feel free to contact us through the links at the bottom of the documents page, the \"Contact Form,\" or via X (formerly Twitter)!" + opened_web_page_booth: 브라우저에서 Booth 페이지를 열었습니다. + opened_web_page_vrct_documents: "웹 브라우저에서 VRCT 문서 페이지가 열렸습니다.\n문제, 요청 또는 문의 사항이 있는 경우 문서 페이지 하단의 링크, '문의 양식' 또는 X(구 트위터)를 통해 언제든지 문의해 주세요!" - # update_available: New version is here! + update_available: 새로운 버전이 나왔습니다! - # cover_message: The functionality is temporarily disabled until the settings window is closed. + cover_message: 설정 화면이 닫힐 때까지 일시적으로 기능을 정지하고 있습니다. - # confirmation_message: - # update_software: "Download new version and restart automatically.\nIt'll take a while. Do it now?" - # deny_update_software: Do it later - # accept_update_software: Update and Restart - # updating: Now updating... + confirmation_message: + update_software: "새 버전을 다운로드하고 재부팅합니다. \n 조금 시간이 걸릴 수 있습니다. 지금 시작할까요?" + deny_update_software: 나중에 하기 + accept_update_software: 업데이트 및 재부팅 + updating: 업데이트 중... - # detected_over_ui_size: "Current UI Size: %{current_ui_size}\nVRCT's window size may be larger than your display size.\n* Depending on your display size, you may need to adjust it multiple times." - # deny_adjust_ui_size: "Keep it at this size" - # accept_adjust_ui_size: "Set it smaller and restart" + detected_over_ui_size: "현재 UI 크기: %{current_ui_size}\nVRCT의 창 크기가 사용자의 디스플레이 크기보다 클 수 있습니다. \n* 디스플레이 크기에 따라 여러 번 재설정해야 할 수도 있습니다." + deny_adjust_ui_size: "지금 상태를 유지" + accept_adjust_ui_size: "작게 줄이고 재부팅" - # translation_engine_limit_error: "It has automatically disabled the translation feature.\nAccess has been temporarily restricted\ndue to an excessive number of requests to the translation engine.\nPlease wait for a while, restart VRCT, and try again." - # accept_translation_engine_limit_error: Accept and close + translation_engine_limit_error: "번역 기능이 자동으로 중지되었습니다. \n번역 엔진에 대한 요청이 너무 많아 \n일시적으로 사용이 제한되었습니다. \n잠시 기다렸다가 VRCT를 재부팅한 후 다시 시도해 보십시오." + accept_translation_engine_limit_error: 확인하고 닫기 -# selectable_language_window: -# title_your_language: Select Your Language -# title_target_language: Select Target Language -# go_back_button: Go Back +selectable_language_window: + title_your_language: 당신의 언어 + title_target_language: 상대방의 언어 + go_back_button: 돌아가기 config_window: - # config_title: Settings - # compact_mode: Compact Mode - # version: version %{version} - # restart_message: Apply changes with a restart. - # common_error_message: - # invalid_value: Invalid value. + config_title: 설정 + compact_mode: 컴팩트 모드 + version: 버전 %{version} + restart_message: 재부팅하여 변경 사항을 적용합니다. + common_error_message: + invalid_value: 유효하지 않은 값입니다. side_menu_labels: - # appearance: Appearance + appearance: 모양 translation: 번역 transcription: 음성인식 transcription_mic: 마이크 transcription_speaker: 스피커 others: 기타 - # advanced_settings: Advanced Settings + others_send_message_formats: 메시지 형식 (전송) + others_received_message_formats: 메시지 형식 (수신) + others_speaker2chatbox: 스피커->챗박스 + advanced_settings: 고급 설정 transparency: label: 투명도 - # desc: Change the main window's transparency. + desc: 메인 화면의 투명도를 변경합니다. appearance_theme: label: 테마 - # desc: Change the color theme. Currently, only the Dark theme is supported. The Light theme is under development. + desc: 색상 테마를 변경합니다. ui_size: label: UI 크기 + textbox_ui_size: + label: 텍스트 박스 글자 크기 + desc: 로그에 표시되는 글자 크기의 배율을 UI 크기에 따라 변경합니다. + + message_box_ratio: + label: 메시지 입력란 크기 + desc: "메시지 입력란의 크기를 변경합니다. 텍스트 박스와의 비율로 설정되어 있습니다. \n* 정확한 계산은 하지 않았습니다." + font_family: label: 폰트 ui_language: label: UI 언어 / UI Language + to_restore_main_window_geometry: + label: 메인 화면 위치 기억 + desc: 시작 시 이전 화면의 위치와 크기를 복원합니다. + deepl_auth_key: label: DeepL 인증키 mic_host: - label: 마이크 호스트/Driver + label: 마이크 호스트/드라이버 mic_device: label: 마이크 장치 mic_dynamic_energy_threshold: - label_for_automatic: "음성 입력 최소 볼륨 (Current Setting: Automatic)" - # desc_for_automatic: "Automatically determine microphone input sensitivity." - label_for_manual: "음성 입력 최소 볼륨 (Current Setting: Manual)" - # desc_for_manual: "Manually determine the microphone input sensitivity using the slider. Press the microphone icon to input your voice and adjust the sensitivity while monitoring the volume." - # error_message: You can set it with a value between 0 to %{max}. + label_for_automatic: "음성 입력 최소 볼륨 (현재 설정: 자동)" + desc_for_automatic: "마이크의 입력 감도를 자동으로 조절합니다." + label_for_manual: "음성 입력 최소 볼륨 (현재 설정: 수동)" + desc_for_manual: "슬라이더를 움직여 입력 감도를 수동으로 조절합니다. 마이크 아이콘을 누르면 실제 음성의 볼륨을 확인하며 감도를 조절할 수 있습니다." + error_message: 0에서 %{max}까지의 숫자로만 설정할 수 있습니다. mic_record_timeout: label: 최대 무음 시간 - # desc: Detects silence and, when the specified number of seconds has passed, considers the mic input to have ended. (Second(s)) - # error_message: It cannot be greater than '%{mic_phrase_timeout_label}' with a value of 0 or more. + desc: 무음을 감지하고 설정된 시간(초)만큼의 시간이 지나면 음성 입력이 종료된 것으로 판단합니다. + error_message: 0 이상에서 '%{mic_phrase_timeout_label}'보다 클 수 없습니다. mic_phrase_timeout: label: 최대 인식 시간 - # desc: Transcription processing is performed at intervals of the specified number of seconds. - # error_message: It cannot be set lower than '%{mic_record_timeout_label}' with a value of 0 or more. + desc: 설정된 초 단위로 음성인식 처리가 이루어집니다. + error_message: 0 이상에서 '%{mic_record_timeout_label}'보다 작을 수 없습니다. mic_max_phrase: label: 최대 입력 절(phrases) 수 - # desc: It is the lower limit for the number of transcribed words, and only when this number is exceeded will the transcription results be displayed logs and send to VRChat. - # error_message: You can set a number equal to or greater than 0. + desc: 인식된 단어 수의 하한값으로, 이 수치를 초과하는 경우에만 결과를 VRChat으로 전송하고 로그에 표시합니다. + error_message: 0 이상의 숫자만 설정할 수 있습니다. mic_word_filter: label: 단어 필터 - # desc: "It will not send the sentence if the word(s) included in the set list of words.\nHow to set: e.g. AAA,BBB,CCC" + desc: "등록된 단어가 감지되면 해당 문장은 전송되지 않습니다. \n ',' 쉼표로 구분하면 여러 단어를 추가할 수 있습니다. \n* 중복된 단어는 등록되지 않습니다." + add_button_label: 추가 + count_desc: "현재 등록되어 있는 단어 수: %{count}" speaker_dynamic_energy_threshold: - label_for_automatic: "음성 입력 최소 볼륨 (Current Setting: Automatic)" - # desc_for_automatic: "Automatically determine speaker input sensitivity." - label_for_manual: "음성 입력 최소 볼륨 (Current Setting: Manual)" - # desc_for_manual: "Manually determine the speaker input sensitivity using the slider. Press the headphones icon to listen to the audio and adjust the sensitivity while monitoring the volume." - # error_message: You can set it with a value between 0 to %{max}. - # no_device_error_message: No speaker device detected. + label_for_automatic: "음성 입력 최소 볼륨 (현재 설정: 자동)" + desc_for_automatic: "스피커의 입력 감도를 자동으로 조절합니다." + label_for_manual: "음성 입력 최소 볼륨 (현재 설정: 수동)" + desc_for_manual: "슬라이더를 움직여 입력 감도를 수동으로 조절합니다. 헤드폰 아이콘을 누르면 실제 음성의 볼륨을 확인하며 감도를 조절할 수 있습니다." + error_message: 0에서 %{max}까지의 숫자로만 설정할 수 있습니다. + no_device_error_message: 스피커 디바이스를 찾지 못했습니다. speaker_record_timeout: label: 최대 무음 시간 - # desc: Detects silence and, when the specified number of seconds has passed, considers the speaker input to have ended. (Second(s)) - # error_message: It cannot be greater than '%{speaker_phrase_timeout_label}' with a value of 0 or more. + desc: 무음을 감지하고 설정된 시간(초)만큼의 시간이 지나면 음성 입력이 종료된 것으로 판단합니다. + error_message: 0 이상에서 '%{speaker_phrase_timeout_label}'보다 클 수 없습니다. speaker_phrase_timeout: label: 최대 인식 시간 - # desc: Transcription processing is performed at intervals of the specified number of seconds. - # error_message: It cannot be set lower than '%{speaker_record_timeout_label}' with a value of 0 or more. + desc: 설정된 초 단위로 음성인식 처리가 이루어집니다. + error_message: 0 이상에서 '%{speaker_record_timeout_label}'보다 작을 수 없습니다. speaker_max_phrase: label: 최대 입력 절(phrases) 수 - # desc: It is the lower limit for the number of transcribed words, and only when this number is exceeded will the transcription results be displayed logs. - # error_message: You can set a number equal to or greater than 0. + desc: 식된 단어 수의 하한값으로, 이 수치를 초과하는 경우에만 결과를 로그에 표시합니다. + error_message: 0 이상의 숫자만 설정할 수 있습니다. auto_clear_the_message_box: label: 챗박스 자동 삭제 - # notice_xsoverlay: - # label: Notification XSOverlay (VR Only) - # desc: Notify received messages by using XSOverlay's notification feature. + send_only_translated_messages: + label: 번역된 메시지만 전송 - # auto_export_message_logs: - # label: Auto Export Message Logs - # desc: Automatically export the conversation messages as a text file. + send_message_button_type: + label: 메시지 전송 버튼 + hide: 숨김 (Enter 키를 사용하여 전송) + show: 표시 + show_and_disable_enter_key: 표시 (Enter 키 전송 비활성화) + + notice_xsoverlay: + label: XSOverlay에서 알림 수신 기능 활성화 (VR 전용) + desc: 수신된 메시지를 XSOverlay의 기능을 통해 알림으로 받아볼 수 있습니다. + + auto_export_message_logs: + label: 대화 로그 자동 저장 + desc: logs 폴더에 텍스트 파일로 로그가 저장됩니다. + + send_message_to_vrc: + label: VRChat에 메시지 전송 + desc: "VRChat에 메시지를 보내지 않고 사용할 수 있는 방법이 있지만 지원되지 않습니다. VRChat에 메시지를 보내려면 이 기능을 활성화하세요." + + + send_message_format: + label: 메시지 형식 + desc: "메시지가 실제로 보이는 형식을 변경합니다. \n[message]가 메시지로 대체됩니다." + example_text: 이것은 예문입니다. 폰트, 줄바꿈 등 실제 표시와 다를 수 있습니다. + error_message: "[message]라는 문자는 사용할 수 없습니다." send_message_format_with_t: - label: 전송 형식 - # desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message.\nIt will be used in Notification XSOverlay too." + label: 메시지 형식 (번역 포함) + desc: "메시지가 실제로 보이는 형식을 변경합니다. \n[message]는 메시지로, [translation]은 번역된 메시지로 대체됩니다.\nXSOverlay의 알림에서도 사용됩니다." example_text: 예문입니다. 글꼴, 줄 바꿈 등이 실제 표시와 다를 수 있습니다. + error_message: "[message]와 [translation]이라는 문자는 사용할 수 없습니다." - # send_message_to_vrc: - # label: Send Message To VRChat - # desc: There is a way to use it without sending messages to VRChat, but it is not supported. Enable this feature when you intend to send a message to VRChat. + received_message_format: + label: 메시지 형식 + desc: "메시지가 실제로 보이는 형식을 변경합니다. \n[message]가 메시지로 대체됩니다." + example_text: 이것은 예문입니다. 폰트, 줄바꿈 등 실제 표시와 다를 수 있습니다. + error_message: "[message]라는 문자는 사용할 수 없습니다." + received_message_format_with_t: + label: 메시지 형식 (번역 포함) + desc: "메시지가 실제로 보이는 형식을 변경합니다. \n[message]는 메시지로, [translation]은 번역된 메시지로 대체됩니다.\nXSOverlay의 알림에서도 사용됩니다." + example_text: 이것은 예문입니다. 폰트, 줄바꿈 등 실제 표시와 다를 수 있습니다. + error_message: "[message]와 [translation]이라는 문자는 사용할 수 없습니다." + + # Speaker2Chatbox + send_received_message_to_vrc: + label: 수신된 메시지를 VRChat으로 전송 + desc: 스피커의 소리로 받은 메시지를 VRChat의 챗박스로 보냅니다. 이 기능은 정말 필요한 사용자를 위한 기능입니다. 개발자에게 문의하시기 바랍니다. + # Speaker2Chatbox + + osc_ip_address: label: OSC IP 주소 osc_port: - label: OSC 포트 \ No newline at end of file + label: OSC 포트 + + open_config_filepath: + label: 설정 파일 열기 \ No newline at end of file From 7a4c4b8f76d24d127315b91e1ca365a30e9045f3 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 7 Jan 2024 20:53:29 +0900 Subject: [PATCH 43/43] [Update] Remove the 'Speaker2Chatbox' section (I'm sorry and thank you, rera-san). Adjust the wording for selectable UI language. Add comments to the section 'Speaker2Chatbox' in en.yml. --- config.py | 2 +- locales/en.yml | 1 + locales/ko.yml | 6 ------ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index 05208471..4a5e355d 100644 --- a/config.py +++ b/config.py @@ -677,7 +677,7 @@ class Config: self._SELECTABLE_UI_LANGUAGES_DICT = { "en": "English", "ja": "日本語", - "ko": "한국어(일부 지원)" + "ko": "한국어" # If you want to add a new language and key, please append it here. } self._MAX_MIC_ENERGY_THRESHOLD = 2000 diff --git a/locales/en.yml b/locales/en.yml index 75161011..2cad19ef 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -228,6 +228,7 @@ config_window: example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. error_message: "The characters '[message]' and '[translation]' cannot be used." + # Note: Speaker2Chatbox localization is fine only in English. Do not translate it into other languages. # Speaker2Chatbox send_received_message_to_vrc: label: Send Received Message To VRChat diff --git a/locales/ko.yml b/locales/ko.yml index 5b0083bf..692abd2c 100644 --- a/locales/ko.yml +++ b/locales/ko.yml @@ -228,13 +228,7 @@ config_window: example_text: 이것은 예문입니다. 폰트, 줄바꿈 등 실제 표시와 다를 수 있습니다. error_message: "[message]와 [translation]이라는 문자는 사용할 수 없습니다." - # Speaker2Chatbox - send_received_message_to_vrc: - label: 수신된 메시지를 VRChat으로 전송 - desc: 스피커의 소리로 받은 메시지를 VRChat의 챗박스로 보냅니다. 이 기능은 정말 필요한 사용자를 위한 기능입니다. 개발자에게 문의하시기 바랍니다. - # Speaker2Chatbox - osc_ip_address: label: OSC IP 주소