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 00000000..e4240e56 Binary files /dev/null and b/img/send_message_icon_black.png differ diff --git a/img/send_message_icon_white.png b/img/send_message_icon_white.png new file mode 100644 index 00000000..cdead72b Binary files /dev/null and b/img/send_message_icon_white.png differ diff --git a/locales/en.yml b/locales/en.yml index e90f49a0..75161011 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -185,6 +185,12 @@ config_window: send_only_translated_messages: label: Send Only Translated Messages + send_message_button_type: + label: Send Message Button + hide: Hide (Use enter key to send) + show: Show + show_and_disable_enter_key: Show and disable to send when pressed enter key + 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 73337446..eb937747 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -182,6 +182,12 @@ config_window: send_only_translated_messages: label: 翻訳後のメッセージのみ送信する + send_message_button_type: + label: メッセージ送信ボタン + hide: 非表示 (エンターキーを使って送信) + show: 表示 + show_and_disable_enter_key: 表示し、エンターキーでの送信を無効 + notice_xsoverlay: label: XSOverlayでの通知受け取り機能を有効 (VR限定) desc: 文字起こし(受信)されたメッセージをXSOverlayの機能を使って通知として受け取れます。 diff --git a/view.py b/view.py index 01375114..1f6d75bb 100644 --- a/view.py +++ b/view.py @@ -357,6 +357,16 @@ class View(): CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=None, VAR_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=BooleanVar(value=config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES), + VAR_LABEL_SEND_MESSAGE_BUTTON_TYPE=StringVar(value=i18n.t("config_window.send_message_button_type.label")), + VAR_DESC_SEND_MESSAGE_BUTTON_TYPE=None, + CALLBACK_SET_SEND_MESSAGE_BUTTON_TYPE=None, + VAR_SEND_MESSAGE_BUTTON_TYPE=StringVar(value=config.SEND_MESSAGE_BUTTON_TYPE), + KEYS_VALUES_SEND_MESSAGE_BUTTON_TYPE={ + "hide": StringVar(value=i18n.t("config_window.send_message_button_type.hide")), + "show": StringVar(value=i18n.t("config_window.send_message_button_type.show")), + "show_and_disable_enter_key": StringVar(value=i18n.t("config_window.send_message_button_type.show_and_disable_enter_key")), + }, + 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, @@ -500,13 +510,17 @@ class View(): def adjustedMessageBoxReturnFunction(_e): - main_window_registers.get("message_box_bind_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. + def pressedSendMessageButtonFunction(_e): + main_window_registers.get("message_box_bind_Return")() 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")) + 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