[Update] Config Window: Error Message Window. UI Size変更対応。色指定を変数化。
[bugfix] Config Window: Error Message Window. Fix 1px bugs.
This commit is contained in:
4
utils.py
4
utils.py
@@ -17,5 +17,7 @@ def callFunctionIfCallable(function, *args):
|
|||||||
def isEven(number):
|
def isEven(number):
|
||||||
return number % 2 == 0
|
return number % 2 == 0
|
||||||
|
|
||||||
def makeEven(number):
|
def makeEven(number, minus:bool=False):
|
||||||
|
if minus is True:
|
||||||
|
return number if isEven(number) else number - 1
|
||||||
return number if isEven(number) else number + 1
|
return number if isEven(number) else number + 1
|
||||||
@@ -1,8 +1,25 @@
|
|||||||
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
|
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
from .ui_utils import getLatestWidth, getLatestHeight
|
||||||
|
from utils import isEven
|
||||||
|
|
||||||
|
|
||||||
class _CreateErrorWindow(CTkToplevel):
|
class _CreateErrorWindow(CTkToplevel):
|
||||||
def __init__(self, settings, view_variable, wrapper_widget):
|
def __init__(
|
||||||
|
self,
|
||||||
|
settings,
|
||||||
|
view_variable,
|
||||||
|
wrapper_widget,
|
||||||
|
|
||||||
|
message_ipadx,
|
||||||
|
message_ipady,
|
||||||
|
message_font_size,
|
||||||
|
|
||||||
|
message_bg_color,
|
||||||
|
message_text_color,
|
||||||
|
):
|
||||||
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.withdraw()
|
self.withdraw()
|
||||||
self.hide = True
|
self.hide = True
|
||||||
@@ -21,6 +38,13 @@ class _CreateErrorWindow(CTkToplevel):
|
|||||||
self.wrapper_widget = wrapper_widget
|
self.wrapper_widget = wrapper_widget
|
||||||
|
|
||||||
|
|
||||||
|
self.message_ipadx = message_ipadx
|
||||||
|
self.message_ipady = message_ipady
|
||||||
|
self.message_font_size = message_font_size
|
||||||
|
|
||||||
|
self.message_bg_color = message_bg_color
|
||||||
|
self.message_text_color = message_text_color
|
||||||
|
|
||||||
|
|
||||||
self.attach_widget_width = None
|
self.attach_widget_width = None
|
||||||
self.attach_widget_height = None
|
self.attach_widget_height = None
|
||||||
@@ -34,8 +58,7 @@ class _CreateErrorWindow(CTkToplevel):
|
|||||||
self.rowconfigure(0,weight=1)
|
self.rowconfigure(0,weight=1)
|
||||||
self.columnconfigure(0,weight=1)
|
self.columnconfigure(0,weight=1)
|
||||||
|
|
||||||
# The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade).
|
self.modal_container = CTkFrame(self, corner_radius=0, fg_color=self.message_bg_color, width=0, height=0)
|
||||||
self.modal_container = CTkFrame(self, corner_radius=0, fg_color="#bb4448", width=0, height=0)
|
|
||||||
self.modal_container.grid(row=0, column=0, sticky="nsew")
|
self.modal_container.grid(row=0, column=0, sticky="nsew")
|
||||||
|
|
||||||
|
|
||||||
@@ -45,11 +68,13 @@ class _CreateErrorWindow(CTkToplevel):
|
|||||||
textvariable=self._view_variable.VAR_ERROR_MESSAGE,
|
textvariable=self._view_variable.VAR_ERROR_MESSAGE,
|
||||||
height=0,
|
height=0,
|
||||||
corner_radius=0,
|
corner_radius=0,
|
||||||
font=CTkFont(family=self.settings.FONT_FAMILY, size=12, weight="normal"),
|
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.message_font_size, weight="normal"),
|
||||||
anchor="w",
|
anchor="w",
|
||||||
text_color="white",
|
justify="left",
|
||||||
|
text_color=self.message_text_color,
|
||||||
)
|
)
|
||||||
self.modal_container_label_wrapper.grid(row=0, column=0, padx=10, pady=6, sticky="nsew")
|
self.modal_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +90,21 @@ class _CreateErrorWindow(CTkToplevel):
|
|||||||
|
|
||||||
self.hide = False
|
self.hide = False
|
||||||
|
|
||||||
|
label_width = getLatestWidth(self.modal_container_label_wrapper)
|
||||||
|
label_height = getLatestHeight(self.modal_container_label_wrapper)
|
||||||
|
|
||||||
|
# for fixing 1px bug
|
||||||
|
if isEven(label_width) is False:
|
||||||
|
self.modal_container_label_wrapper.grid(padx=(self.message_ipadx[0], self.message_ipadx[1]-1))
|
||||||
|
else:
|
||||||
|
self.modal_container_label_wrapper.grid(padx=self.message_ipadx)
|
||||||
|
|
||||||
|
# for fixing 1px bug
|
||||||
|
if isEven(label_height) is False:
|
||||||
|
self.modal_container_label_wrapper.grid(pady=(self.message_ipady[0], self.message_ipady[1]-1))
|
||||||
|
else:
|
||||||
|
self.modal_container_label_wrapper.grid(pady=self.message_ipady)
|
||||||
|
|
||||||
|
|
||||||
for i in range(0,101,20):
|
for i in range(0,101,20):
|
||||||
if not self.winfo_exists():
|
if not self.winfo_exists():
|
||||||
|
|||||||
@@ -281,6 +281,12 @@ class ColorThemeManager():
|
|||||||
self.config_window.SIDE_MENU_SELECTED_MARK_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
|
self.config_window.SIDE_MENU_SELECTED_MARK_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
|
||||||
|
|
||||||
|
|
||||||
|
# Error Message Window for Config Window
|
||||||
|
# The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade).
|
||||||
|
self.config_window.SB__ERROR_MESSAGE_BG_COLOR = "#bb4448"
|
||||||
|
self.config_window.SB__ERROR_MESSAGE_TEXT_COLOR = "#fff"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,10 @@ class UiScalingManager():
|
|||||||
self.config_window.SB__DESC_TOP_PADY = self._calculateUiSize(2)
|
self.config_window.SB__DESC_TOP_PADY = self._calculateUiSize(2)
|
||||||
|
|
||||||
|
|
||||||
|
self.config_window.SB__ERROR_MESSAGE_IPADX = (self._calculateUiSize(10), self._calculateUiSize(10))
|
||||||
|
self.config_window.SB__ERROR_MESSAGE_IPADY = (self._calculateUiSize(6), self._calculateUiSize(6))
|
||||||
|
self.config_window.SB__ERROR_MESSAGE_FONT_SIZE = self._calculateUiSize(12)
|
||||||
|
|
||||||
|
|
||||||
self.config_window.SB__SELECTOR_FONT_SIZE = self._calculateUiSize(14)
|
self.config_window.SB__SELECTOR_FONT_SIZE = self._calculateUiSize(14)
|
||||||
self.config_window.SB__RADIO_BUTTON_FONT_SIZE = self.config_window.SB__SELECTOR_FONT_SIZE
|
self.config_window.SB__RADIO_BUTTON_FONT_SIZE = self.config_window.SB__SELECTOR_FONT_SIZE
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class VRCT_GUI(CTk):
|
|||||||
self.dropdown_menu_window = _CreateDropdownMenuWindow(
|
self.dropdown_menu_window = _CreateDropdownMenuWindow(
|
||||||
settings=self.settings.config_window,
|
settings=self.settings.config_window,
|
||||||
view_variable=self._view_variable,
|
view_variable=self._view_variable,
|
||||||
|
|
||||||
window_additional_y_pos=self.settings.config_window.uism.SB__DROPDOWN_MENU_WINDOW_ADDITIONAL_Y_POS,
|
window_additional_y_pos=self.settings.config_window.uism.SB__DROPDOWN_MENU_WINDOW_ADDITIONAL_Y_POS,
|
||||||
window_border_width=self.settings.config_window.uism.SB__DROPDOWN_MENU_WINDOW_BORDER_WIDTH,
|
window_border_width=self.settings.config_window.uism.SB__DROPDOWN_MENU_WINDOW_BORDER_WIDTH,
|
||||||
scrollbar_ipadx=self.settings.config_window.uism.SB__DROPDOWN_MENU_SCROLLBAR_IPADX,
|
scrollbar_ipadx=self.settings.config_window.uism.SB__DROPDOWN_MENU_SCROLLBAR_IPADX,
|
||||||
@@ -75,6 +76,14 @@ class VRCT_GUI(CTk):
|
|||||||
settings=self.settings.modal_window,
|
settings=self.settings.modal_window,
|
||||||
view_variable=self._view_variable,
|
view_variable=self._view_variable,
|
||||||
wrapper_widget=self.config_window.main_bg_container,
|
wrapper_widget=self.config_window.main_bg_container,
|
||||||
|
|
||||||
|
message_ipadx=self.settings.config_window.uism.SB__ERROR_MESSAGE_IPADX,
|
||||||
|
message_ipady=self.settings.config_window.uism.SB__ERROR_MESSAGE_IPADY,
|
||||||
|
message_font_size=self.settings.config_window.uism.SB__ERROR_MESSAGE_FONT_SIZE,
|
||||||
|
|
||||||
|
message_bg_color=self.settings.config_window.ctm.SB__ERROR_MESSAGE_BG_COLOR,
|
||||||
|
message_text_color=self.settings.config_window.ctm.SB__ERROR_MESSAGE_TEXT_COLOR,
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user