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] =?UTF-8?q?[Update]=20Main=20Window:=20=E3=83=A1=E3=83=83?= =?UTF-8?q?=E3=82=BB=E3=83=BC=E3=82=B8=E9=80=81=E4=BF=A1=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E8=BF=BD=E5=8A=A0=E3=80=82=20=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E9=A0=85=E7=9B=AE=E3=81=A7=E9=9D=9E=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=80=81=E8=A1=A8=E7=A4=BA=E3=80=81=E8=A1=A8=E7=A4=BA=E3=81=97?= =?UTF-8?q?=E3=81=A4=E3=81=A4=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E5=85=A5=E5=8A=9B=E6=AC=84=E3=81=A7=E3=81=AE=E3=82=A8=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=83=BC=E3=82=AD=E3=83=BC=E9=80=81=E4=BF=A1=E3=82=92?= =?UTF-8?q?=E7=84=A1=E5=8A=B9=20=E3=82=92=E9=81=B8=E6=8A=9E=E5=8F=AF?= =?UTF-8?q?=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