[Refactor] 変数名変更。

This commit is contained in:
Sakamoto Shiina
2023-10-14 08:10:57 +09:00
parent 27eb498793
commit 6968f81366
8 changed files with 51 additions and 45 deletions

View File

@@ -16,8 +16,7 @@ main_window:
update_available: New version is here!
modal_message:
opened_config_window: The functionality is temporarily disabled until the settings window is closed.
cover_message: The functionality is temporarily disabled until the settings window is closed.
selectable_language_window:
title_your_language: Select Your Language

View File

@@ -16,8 +16,7 @@ main_window:
update_available: 新しいバージョンが出ました!
modal_message:
opened_config_window: 設定画面が閉じられるまで、一時的に機能を停止しています。
cover_message: 設定画面が閉じられるまで、一時的に機能を停止しています。
selectable_language_window:

20
view.py
View File

@@ -54,9 +54,15 @@ class View():
**common_args
)
self.settings.modal_window = SimpleNamespace(
ctm=all_ctm.modal_window,
uism=all_uism.modal_window,
self.settings.main_window_cover = SimpleNamespace(
ctm=all_ctm.main_window_cover,
uism=all_uism.main_window_cover,
**common_args
)
self.settings.error_message_window = SimpleNamespace(
ctm=all_ctm.error_message_window,
uism=all_uism.error_message_window,
**common_args
)
@@ -123,8 +129,8 @@ class View():
VAR_UPDATE_AVAILABLE=StringVar(value=i18n.t("main_window.update_available")),
# Modal Window For Main Window
VAR_LABEL_MODAL_MESSAGE_FOR__MAIN_WINDOW=StringVar(value=i18n.t("main_window.modal_message.opened_config_window")),
# Main Window Cover
VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE=StringVar(value=i18n.t("main_window.cover_message")),
# Selectable Language Window
VAR_TITLE_LABEL_SELECTABLE_LANGUAGE=StringVar(value=""),
@@ -558,12 +564,12 @@ class View():
@staticmethod
def _openTheCoverOfMainWindow():
vrct_gui.modal_window.show()
vrct_gui.main_window_cover.show()
vrct_gui.config_window.lift()
@staticmethod
def _closeTheCoverOfMainWindow():
vrct_gui.modal_window.withdraw()
vrct_gui.main_window_cover.withdraw()
def enableMainWindowSidebarCompactMode(self):
self.view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = True

View File

@@ -58,12 +58,12 @@ class _CreateErrorWindow(CTkToplevel):
self.grid_rowconfigure(0,weight=1)
self.grid_columnconfigure(0,weight=1)
self.modal_container = CTkFrame(self, corner_radius=0, fg_color=self.message_bg_color, width=0, height=0)
self.modal_container.grid(row=0, column=0, sticky="nsew")
self.error_message_container = CTkFrame(self, corner_radius=0, fg_color=self.message_bg_color, width=0, height=0)
self.error_message_container.grid(row=0, column=0, sticky="nsew")
self.modal_container_label_wrapper = CTkLabel(
self.modal_container,
self.error_message_container_label_wrapper = CTkLabel(
self.error_message_container,
# text=message,
textvariable=self._view_variable.VAR_ERROR_MESSAGE,
height=0,
@@ -73,7 +73,7 @@ class _CreateErrorWindow(CTkToplevel):
justify="left",
text_color=self.message_text_color,
)
self.modal_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew")
self.error_message_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew")
@@ -90,20 +90,20 @@ class _CreateErrorWindow(CTkToplevel):
self.hide = False
label_width = getLatestWidth(self.modal_container_label_wrapper)
label_height = getLatestHeight(self.modal_container_label_wrapper)
label_width = getLatestWidth(self.error_message_container_label_wrapper)
label_height = getLatestHeight(self.error_message_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))
self.error_message_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)
self.error_message_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))
self.error_message_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)
self.error_message_container_label_wrapper.grid(pady=self.message_ipady)
for i in range(0,101,20):

View File

@@ -2,7 +2,7 @@ from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from .ui_utils import fadeInAnimation
class _CreateModalWindow(CTkToplevel):
class _CreateWindowCover(CTkToplevel):
def __init__(self, attach_window, settings, view_variable):
super().__init__()
self.withdraw()
@@ -35,20 +35,20 @@ class _CreateModalWindow(CTkToplevel):
self.grid_rowconfigure(0,weight=1)
self.grid_columnconfigure(0,weight=1)
self.modal_container = CTkFrame(self, corner_radius=0, fg_color="black", width=0, height=0)
self.modal_container.grid(row=0, column=0, sticky="nsew")
self.cover_container = CTkFrame(self, corner_radius=0, fg_color="black", width=0, height=0)
self.cover_container.grid(row=0, column=0, sticky="nsew")
self.modal_container_label_wrapper = CTkLabel(
self.modal_container,
textvariable=self._view_variable.VAR_LABEL_MODAL_MESSAGE_FOR__MAIN_WINDOW,
self.cover_container_label_wrapper = CTkLabel(
self.cover_container,
textvariable=self._view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.TEXT_COLOR,
)
self.modal_container_label_wrapper.place(relx=0.5, rely=0.5, anchor="center")
self.cover_container_label_wrapper.place(relx=0.5, rely=0.5, anchor="center")
def show(self):

View File

@@ -5,7 +5,8 @@ class ColorThemeManager():
self.main = SimpleNamespace()
self.config_window = SimpleNamespace()
self.selectable_language_window = SimpleNamespace()
self.modal_window = SimpleNamespace()
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
# old one. But leave it here for now.
# self.PRIMARY_100_COLOR = "#c4eac1"
@@ -212,7 +213,7 @@ class ColorThemeManager():
# Modal Window (Main Window)
self.modal_window.TEXT_COLOR = self.LIGHT_100_COLOR
self.main_window_cover.TEXT_COLOR = self.LIGHT_100_COLOR
# Common

View File

@@ -8,7 +8,8 @@ class UiScalingManager():
self.main = SimpleNamespace()
self.config_window = SimpleNamespace()
self.selectable_language_window = SimpleNamespace()
self.modal_window = SimpleNamespace()
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
self._calculatedUiSizes()
@@ -138,7 +139,7 @@ class UiScalingManager():
self.selectable_language_window.VALUES_TEXT_IPADY = self._calculateUiSize(8)
self.modal_window.TEXT_FONT_SIZE = self._calculateUiSize(20)
self.main_window_cover.TEXT_FONT_SIZE = self._calculateUiSize(20)
# Config Window
self.config_window.DEFAULT_WIDTH = self._calculateUiSize(1080)

View File

@@ -2,7 +2,7 @@ from customtkinter import CTk, CTkImage
from ._CreateSelectableLanguagesWindow import _CreateSelectableLanguagesWindow
from ._CreateModalWindow import _CreateModalWindow
from ._CreateWindowCover import _CreateWindowCover
from ._CreateErrorWindow import _CreateErrorWindow
from ._CreateDropdownMenuWindow import _CreateDropdownMenuWindow
from ._changeMainWindowWidgetsStatus import _changeMainWindowWidgetsStatus
@@ -36,9 +36,9 @@ class VRCT_GUI(CTk):
self.window_state = self.new_window_state
if self.window_state == "iconic":
self.modal_window.withdraw()
self.main_window_cover.withdraw()
elif self.window_state == "normal":
self.modal_window.show()
self.main_window_cover.show()
@@ -93,14 +93,14 @@ class VRCT_GUI(CTk):
view_variable=self._view_variable
)
self.modal_window = _CreateModalWindow(
self.main_window_cover = _CreateWindowCover(
attach_window=self,
settings=self.settings.modal_window,
settings=self.settings.main_window_cover,
view_variable=self._view_variable
)
self.error_message_window = _CreateErrorWindow(
settings=self.settings.modal_window,
settings=self.settings.error_message_window,
view_variable=self._view_variable,
wrapper_widget=self.config_window.main_bg_container,
@@ -130,14 +130,14 @@ class VRCT_GUI(CTk):
callFunctionIfCallable(self._view_variable.CALLBACK_OPEN_CONFIG_WINDOW)
self._adjustToMainWindowGeometry()
self.modal_window.show()
self.main_window_cover.show()
self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID = self.bind("<Configure>", self._adjustToMainWindowGeometry, "+")
self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = self.bind("<Unmap>", self.detectMainWindowState, "+")
self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = self.bind("<Map>", self.detectMainWindowState, "+")
self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.modal_window.bind("<FocusIn>", lambda _e: self.config_window.lift(), "+")
self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.main_window_cover.bind("<FocusIn>", lambda _e: self.config_window.lift(), "+")
self.config_window.attributes("-alpha", 0)
self.config_window.deiconify()
@@ -153,11 +153,11 @@ class VRCT_GUI(CTk):
self.config_window.withdraw()
self.modal_window.withdraw()
self.main_window_cover.withdraw()
self.unbind("<Configure>", self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID)
self.unbind("<Unmap>", self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID)
self.unbind("<Map>", self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID)
self.modal_window.unbind("<FocusIn>", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID)
self.main_window_cover.unbind("<FocusIn>", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID)
self.adjusted_event=None
@@ -263,9 +263,9 @@ class VRCT_GUI(CTk):
y_pos = self.winfo_rooty()
width_new = makeEven(self.winfo_width())
height_new = makeEven(self.winfo_height())
self.modal_window.geometry("{}x{}+{}+{}".format(width_new, height_new, x_pos, y_pos))
self.main_window_cover.geometry("{}x{}+{}+{}".format(width_new, height_new, x_pos, y_pos))
self.modal_window.lift()
self.main_window_cover.lift()
if self.adjusted_event == str(e):
self.after(150, lambda: self.config_window.lift())
elif self.adjusted_event is None: