[Update] Main Window: メッセージ送信ボタンの追加。

設定項目で非表示、表示、表示しつつメッセージ入力欄でのエンターキー送信を無効 を選択可能に。

デフォルトが表示の理由: メッセージ入力欄のプレースホルダーが使えなくなり、初見でどこに入力すればいいのか分かりにくくなったので、横に送信ボタンが付くことにより、よくあるUIとなり、メッセージ入力欄っぽくなる。

その他要らないコードの削除や、corner radius指定し忘れなどの修正あり。
This commit is contained in:
Sakamoto Shiina
2024-01-07 03:30:46 +09:00
parent a5eb0a874f
commit 5128fa590c
16 changed files with 258 additions and 14 deletions

View File

@@ -531,6 +531,17 @@ class Config:
self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = value self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, 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 @property
@json_serializable('ENABLE_NOTICE_XSOVERLAY') @json_serializable('ENABLE_NOTICE_XSOVERLAY')
def ENABLE_NOTICE_XSOVERLAY(self): def ENABLE_NOTICE_XSOVERLAY(self):
@@ -740,6 +751,7 @@ class Config:
self._RECEIVED_MESSAGE_FORMAT_WITH_T = "[message]([translation])" self._RECEIVED_MESSAGE_FORMAT_WITH_T = "[message]([translation])"
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True
self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False
self._SEND_MESSAGE_BUTTON_TYPE = "show"
self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_NOTICE_XSOVERLAY = False
self._ENABLE_SEND_MESSAGE_TO_VRC = True 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

View File

@@ -694,6 +694,11 @@ def callbackSetEnableSendOnlyTranslatedMessages(value):
print("callbackSetEnableSendOnlyTranslatedMessages", value) print("callbackSetEnableSendOnlyTranslatedMessages", value)
config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = 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): def callbackSetEnableNoticeXsoverlay(value):
print("callbackSetEnableNoticeXsoverlay", value) print("callbackSetEnableNoticeXsoverlay", value)
config.ENABLE_NOTICE_XSOVERLAY = value config.ENABLE_NOTICE_XSOVERLAY = value
@@ -894,6 +899,7 @@ def createMainWindow():
# Others Tab # Others Tab
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
"callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages, "callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages,
"callback_set_send_message_button_type": callbackSetSendMessageButtonType,
"callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay,
"callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs,
"callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -185,6 +185,12 @@ config_window:
send_only_translated_messages: send_only_translated_messages:
label: 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: notice_xsoverlay:
label: Notification XSOverlay (VR Only) label: Notification XSOverlay (VR Only)
desc: Notify received messages by using XSOverlay's notification feature. desc: Notify received messages by using XSOverlay's notification feature.

View File

@@ -182,6 +182,12 @@ config_window:
send_only_translated_messages: send_only_translated_messages:
label: 翻訳後のメッセージのみ送信する label: 翻訳後のメッセージのみ送信する
send_message_button_type:
label: メッセージ送信ボタン
hide: 非表示 (エンターキーを使って送信)
show: 表示
show_and_disable_enter_key: 表示し、エンターキーでの送信を無効
notice_xsoverlay: notice_xsoverlay:
label: XSOverlayでの通知受け取り機能を有効 (VR限定) label: XSOverlayでの通知受け取り機能を有効 (VR限定)
desc: 文字起こし受信されたメッセージをXSOverlayの機能を使って通知として受け取れます。 desc: 文字起こし受信されたメッセージをXSOverlayの機能を使って通知として受け取れます。

39
view.py
View File

@@ -357,6 +357,16 @@ class View():
CALLBACK_SET_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_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_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")), VAR_DESC_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.desc")),
CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=None, CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=None,
@@ -500,13 +510,17 @@ class View():
def adjustedMessageBoxReturnFunction(_e): 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. 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 = getattr(vrct_gui, "entry_message_box")
entry_message_box.bind("<Shift-Return>", lambda _e: None) # This is to prevent message sending on Shift + Enter key press and just add a new line. entry_message_box.bind("<Shift-Return>", lambda _e: None) # This is to prevent message sending on Shift + Enter key press and just add a new line.
entry_message_box.bind("<Return>", adjustedMessageBoxReturnFunction) entry_message_box.bind("<Return>", adjustedMessageBoxReturnFunction)
entry_message_box.bind("<Any-KeyPress>", main_window_registers.get("message_box_bind_Any_KeyPress")) entry_message_box.bind("<Any-KeyPress>", main_window_registers.get("message_box_bind_Any_KeyPress"))
self.view_variable.CALLBACK_CLICKED_SEND_MESSAGE_BUTTON = pressedSendMessageButtonFunction
entry_message_box.bind("<FocusIn>", main_window_registers.get("message_box_bind_FocusIn")) entry_message_box.bind("<FocusIn>", main_window_registers.get("message_box_bind_FocusIn"))
@@ -572,6 +586,7 @@ class View():
# Others Tab # 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_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_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_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_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): def setMainWindowTextboxUiSize(custom_font_size_scale:float):
vrct_gui.print_to_textbox.setTagsSettings(custom_font_size_scale=custom_font_size_scale) vrct_gui.print_to_textbox.setTagsSettings(custom_font_size_scale=custom_font_size_scale)
@staticmethod def setMainWindowMessageBoxRatio(self, message_box_ratio:int):
def setMainWindowMessageBoxRatio(message_box_ratio:int):
if message_box_ratio < config.MESSAGE_BOX_RATIO_RANGE[0] or message_box_ratio > config.MESSAGE_BOX_RATIO_RANGE[1]: 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)") 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) textbox_ratio = int((config.MESSAGE_BOX_RATIO_RANGE[1]+1) - message_box_ratio)
message_box_row = int(textbox_ratio + 1) message_box_row = int(textbox_ratio + 1)
message_box_rowwpan = int((config.MESSAGE_BOX_RATIO_RANGE[1]+1) - 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_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") 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 # Function
def _adjustUiSizeAndRestart(self): def _adjustUiSizeAndRestart(self):
current_percentage = int(config.UI_SCALING.replace("%","")) current_percentage = int(config.UI_SCALING.replace("%",""))

View File

@@ -3,7 +3,7 @@ hold_state_list=[]
def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, target_names:list, to_hold_state:bool=False): def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, target_names:list, to_hold_state:bool=False):
global hold_state_list global hold_state_list
if target_names == "All": 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: for item in hold_state_list:
@@ -141,13 +141,17 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
case "entry_message_box": case "entry_message_box":
if status == "disabled": if status == "disabled":
pass
vrct_gui.entry_message_box.configure(state="disabled", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR) vrct_gui.entry_message_box.configure(state="disabled", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR)
elif status == "normal": elif status == "normal":
pass
vrct_gui.entry_message_box.configure(state="normal", text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR) 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 _: case _:
raise ValueError(f"No matching case for target_name: {target_name}") raise ValueError(f"No matching case for target_name: {target_name}")

View File

@@ -2,10 +2,10 @@ from functools import partial
from types import SimpleNamespace from types import SimpleNamespace
from typing import Union 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 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 vrct_gui import vrct_gui
from utils import isEven, callFunctionIfCallable 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("<Button-1>")
setting_box_radio_button._text_label.unbind("<Button-1>")
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( def createSettingBoxAutoExportMessageLogs(
self, self,

View File

@@ -5,6 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_variable): def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_variable):
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
createSettingBoxRadioButtons = sbg.createSettingBoxRadioButtons
createSettingBoxAutoExportMessageLogs = sbg.createSettingBoxAutoExportMessageLogs 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): def checkbox_send_only_translated_messages_callback(checkbox_box_widget):
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES, checkbox_box_widget.get()) 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): def checkbox_notice_xsoverlay_callback(checkbox_box_widget):
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) 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) config_window.sb__send_only_translated_messages.grid(row=row)
row+=1 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( config_window.sb__notice_xsoverlay = createSettingBoxCheckbox(
for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY, for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY,

View File

@@ -120,4 +120,4 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
createTextbox(settings, vrct_gui, view_variable) createTextbox(settings, vrct_gui, view_variable)
createEntryMessageBox(settings, vrct_gui) createEntryMessageBox(settings, vrct_gui, view_variable)

View File

@@ -1,7 +1,10 @@
from customtkinter import CTkFont, CTkFrame, CTkTextbox from customtkinter import CTkFont, CTkFrame, CTkTextbox, CTkLabel, CTkImage
def createEntryMessageBox(settings, main_window): from ...ui_utils import bindButtonFunctionAndColor
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 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") 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.main_entry_message_container.grid_rowconfigure(0, weight=1)
main_window.entry_message_box = CTkTextbox( main_window.entry_message_box = CTkTextbox(
main_window.main_entry_message_container, main_window.main_entry_message_container,
corner_radius=settings.uism.TEXTBOX_ENTRY_CORNER_RADIUS,
border_color=settings.ctm.TEXTBOX_ENTRY_BORDER_COLOR, border_color=settings.ctm.TEXTBOX_ENTRY_BORDER_COLOR,
fg_color=settings.ctm.TEXTBOX_ENTRY_BG_COLOR, fg_color=settings.ctm.TEXTBOX_ENTRY_BG_COLOR,
text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR, text_color=settings.ctm.TEXTBOX_ENTRY_TEXT_COLOR,
@@ -31,3 +35,58 @@ def createEntryMessageBox(settings, main_window):
main_window.entry_message_box.bind("<Any-KeyPress>", messageBoxAnyKeyPress) main_window.entry_message_box.bind("<Any-KeyPress>", 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()

View File

@@ -59,7 +59,7 @@ def createTextbox(settings, main_window, view_variable):
# Text box # Text box
main_window.main_bg_container.grid_rowconfigure(1, weight=1) 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 = 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_columnconfigure(0,weight=1)
main_window.main_textbox_container.grid_rowconfigure(0,weight=1) main_window.main_textbox_container.grid_rowconfigure(0,weight=1)

View File

@@ -35,6 +35,10 @@ def _darkTheme(base_color):
TEXTBOX_ENTRY_PLACEHOLDER_COLOR = base_color.DARK_500_COLOR, TEXTBOX_ENTRY_PLACEHOLDER_COLOR = base_color.DARK_500_COLOR,
TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR = base_color.DARK_700_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
SIDEBAR_BG_COLOR = base_color.DARK_850_COLOR, 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_CHECKED_COLOR = base_color.PRIMARY_700_COLOR,
SB__CHECKBOX_CHECKMARK_COLOR = base_color.DARK_BASIC_TEXT_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_TEXT_COLOR = base_color.DARK_300_COLOR,
SB__ENTRY_BG_COLOR = base_color.DARK_863_COLOR, SB__ENTRY_BG_COLOR = base_color.DARK_863_COLOR,
SB__ENTRY_BORDER_COLOR = base_color.DARK_775_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 = getImageFileFromUiUtils("arrow_left_white.png"),
ARROW_LEFT_DISABLED = getImageFileFromUiUtils("arrow_left_disabled.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_UPDATE_ICON = getImageFileFromUiUtils("refresh_update_icon.png"),
REFRESH_ICON = getImageFileFromUiUtils("refresh_icon.png"), REFRESH_ICON = getImageFileFromUiUtils("refresh_icon.png"),
HELP_ICON = getImageFileFromUiUtils("help_icon_white.png"), HELP_ICON = getImageFileFromUiUtils("help_icon_white.png"),

View File

@@ -35,6 +35,10 @@ def _lightTheme(base_color):
TEXTBOX_ENTRY_PLACEHOLDER_COLOR = base_color.LIGHT_600_COLOR, TEXTBOX_ENTRY_PLACEHOLDER_COLOR = base_color.LIGHT_600_COLOR,
TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR = base_color.LIGHT_400_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
SIDEBAR_BG_COLOR = base_color.LIGHT_250_COLOR, 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_CHECKED_COLOR = base_color.PRIMARY_250_COLOR,
SB__CHECKBOX_CHECKMARK_COLOR = base_color.LIGHT_BASIC_TEXT_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_TEXT_COLOR = base_color.LIGHT_900_COLOR,
SB__ENTRY_BG_COLOR = base_color.LIGHT_300_COLOR, SB__ENTRY_BG_COLOR = base_color.LIGHT_300_COLOR,
SB__ENTRY_BORDER_COLOR = base_color.LIGHT_400_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 = getImageFileFromUiUtils("arrow_left_black.png"),
ARROW_LEFT_DISABLED = getImageFileFromUiUtils("arrow_left_disabled.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_UPDATE_ICON = getImageFileFromUiUtils("refresh_update_icon.png"),
REFRESH_ICON = getImageFileFromUiUtils("refresh_icon.png"), REFRESH_ICON = getImageFileFromUiUtils("refresh_icon.png"),
HELP_ICON = getImageFileFromUiUtils("help_icon_black.png"), HELP_ICON = getImageFileFromUiUtils("help_icon_black.png"),

View File

@@ -50,11 +50,18 @@ class UiScalingManager():
self.main.TEXTBOX_FONT_SIZE__MAIN_TEXT_FONT = self._calculateUiSize(16) self.main.TEXTBOX_FONT_SIZE__MAIN_TEXT_FONT = self._calculateUiSize(16)
self.main.TEXTBOX_ENTRY_FONT_SIZE = 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_BORDER_SIZE = self._calculateUiSize(2, is_allowed_odd=True)
self.main.TEXTBOX_ENTRY_HEIGHT = self._calculateUiSize(40) self.main.TEXTBOX_ENTRY_HEIGHT = self._calculateUiSize(40)
self.main.TEXTBOX_ENTRY_PADX = self.main.TEXTBOX_PADX self.main.TEXTBOX_ENTRY_PADX = self.main.TEXTBOX_PADX
self.main.TEXTBOX_ENTRY_PADY = self._calculateUiSize(10) 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
# Sidebar Features # Sidebar Features