[Update] Main Window: Message Box. メッセージ入力欄のサイズを変更できるように。厳密な計算はしてません。
【見た目への影響大】デフォルトのチャット入力欄を少し大きくしました。(もちろん変更できる) テキストボックスとの比率としているので、Windowサイズを変更すると、それに合わせて可変します。 CTkEntryからCTkTextboxに変更しました。プレースホルダーの使用が厳しくなったので廃止しました。最小にしても、入力中の位置が中央にならないなど、デザインが若干崩れましたが許容しました。
This commit is contained in:
@@ -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 _:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user