Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-10-20 06:25:52 +09:00
17 changed files with 467 additions and 305 deletions

View File

@@ -29,6 +29,7 @@ main_window:
no_mic_device_detected_error: No mic device detected.
no_speaker_device_detected_error: No speaker device detected.
translation_engine_limit_error: It has automatically disabled the translation feature. Access has been temporarily restricted due to an excessive number of requests to the translation engine. Please wait for a while, restart VRCT, and try again.
detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter.
@@ -55,6 +56,10 @@ main_window:
accept_adjust_ui_size: "Set it smaller and restart"
translation_engine_limit_error: "It has automatically disabled the translation feature.\nAccess has been temporarily restricted\ndue to an excessive number of requests to the translation engine.\nPlease wait for a while, restart VRCT, and try again."
accept_translation_engine_limit_error: Accept and close
selectable_language_window:
title_your_language: Select Your Language
title_target_language: Select Target Language

View File

@@ -29,6 +29,7 @@ main_window:
no_mic_device_detected_error: マイクデバイスが検出されませんでした。
no_speaker_device_detected_error: スピーカーデバイスが検出されませんでした。
translation_engine_limit_error: 翻訳機能を自動的に停止しました。翻訳エンジンへのリクエストが多すぎるため、一時的にアクセスが制限されています。しばらく待ってから、VRCTの再起動をしてもう一度試してみてください。
detected_by_word_filter: ワードフィルターに登録されている単語 %{detected_message} が検出されたため送信しませんでした。
@@ -55,6 +56,9 @@ main_window:
accept_adjust_ui_size: 小さく設定して再起動
translation_engine_limit_error: "翻訳機能を自動的に停止しました。\n翻訳エンジンへのリクエストが多すぎるため\n一時的にアクセスが制限されています。\nしばらく待ってから、VRCTの再起動をしてもう一度試してみてください。"
accept_translation_engine_limit_error: 了承して閉じる
selectable_language_window:
title_your_language: あなたの言語

94
view.py
View File

@@ -74,9 +74,9 @@ class View():
**common_args
)
self.settings.update_confirmation_modal = SimpleNamespace(
ctm=all_ctm.update_confirmation_modal,
uism=all_uism.update_confirmation_modal,
self.settings.confirmation_modal = SimpleNamespace(
ctm=all_ctm.confirmation_modal,
uism=all_uism.confirmation_modal,
**common_args
)
@@ -569,23 +569,6 @@ class View():
vrct_gui.attributes("-topmost", False)
def _showDisplayOverUiSizeConfirmationModal(self):
self.foregroundOffIfForegroundEnabled()
self.view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE.set("")
vrct_gui.main_window_cover.show()
self.view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL=self._hideConfirmationModal
self.view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL=self._adjustUiSizeAndRestart
self.view_variable.CALLBACK_DENIED_CONFIRMATION_MODAL=self._hideConfirmationModal
self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.detected_over_ui_size", current_ui_size=config.UI_SCALING))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_DENY_BUTTON.set(i18n.t("main_window.confirmation_message.deny_adjust_ui_size"))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON.set(i18n.t("main_window.confirmation_message.accept_adjust_ui_size"))
vrct_gui.update_confirmation_modal.show(hide_title_bar=False, close_when_focusout=False)
def _adjustUiSizeAndRestart(self):
current_percentage = int(config.UI_SCALING.replace("%",""))
target_percentage = current_percentage - 20
@@ -601,7 +584,21 @@ class View():
def _showDisplayOverUiSizeConfirmationModal(self):
self.foregroundOffIfForegroundEnabled()
self.view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE.set("")
vrct_gui.main_window_cover.show()
self.view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL=self._hideConfirmationModal
self.view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL=self._adjustUiSizeAndRestart
self.view_variable.CALLBACK_DENIED_CONFIRMATION_MODAL=self._hideConfirmationModal
self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.detected_over_ui_size", current_ui_size=config.UI_SCALING))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_DENY_BUTTON.set(i18n.t("main_window.confirmation_message.deny_adjust_ui_size"))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON.set(i18n.t("main_window.confirmation_message.accept_adjust_ui_size"))
vrct_gui.confirmation_modal.show(hide_title_bar=False, close_when_focusout=False)
@@ -618,10 +615,55 @@ class View():
self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.update_software"))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_DENY_BUTTON.set(i18n.t("main_window.confirmation_message.deny_update_software"))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON.set(i18n.t("main_window.confirmation_message.accept_update_software"))
vrct_gui.update_confirmation_modal.show()
vrct_gui.confirmation_modal.show()
def showTheLimitOfTranslationEngineConfirmationModal(self):
self.foregroundOffIfForegroundEnabled()
self.view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE.set("")
vrct_gui.main_window_cover.show()
self.view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL=self._hideInformationModal
self.view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL=self._hideInformationModal
# self.view_variable.CALLBACK_DENIED_CONFIRMATION_MODAL=self._hideConfirmationModal
self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.translation_engine_limit_error"))
# self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_DENY_BUTTON.set(i18n.t("main_window.confirmation_message.deny_update_software"))
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON.set(i18n.t("main_window.confirmation_message.accept_translation_engine_limit_error"))
vrct_gui.information_modal.show(hide_title_bar=False, close_when_focusout=False)
def translationEngineLimitErrorProcess(self):
# turn off translation switch.
vrct_gui.translation_switch_box.deselect()
vrct_gui.translation_frame.markToggleManually(False)
# disable translation feature.
vrct_gui._changeMainWindowWidgetsStatus("disabled", ["translation_switch"], to_hold_state=True)
# print system message that mention to stopped translation feature.
view.printToTextbox_TranslationEngineLimitError()
view.showTheLimitOfTranslationEngineConfirmationModal()
def _hideInformationModal(self):
vrct_gui.information_modal.hide()
vrct_gui.main_window_cover.hide()
self.foregroundOnIfForegroundEnabled()
def _hideConfirmationModal(self):
vrct_gui.update_confirmation_modal.hide()
vrct_gui.confirmation_modal.hide()
vrct_gui.main_window_cover.hide()
self.foregroundOnIfForegroundEnabled()
@@ -630,9 +672,9 @@ class View():
def _startUpdateSoftware(self):
self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.updating"))
vrct_gui.update_confirmation_modal.hide_buttons()
vrct_gui.confirmation_modal.hide_buttons()
vrct_gui.update()
vrct_gui.update_confirmation_modal.update()
vrct_gui.confirmation_modal.update()
callFunctionIfCallable(self.view_variable.CALLBACK_UPDATE_SOFTWARE)
@@ -715,6 +757,10 @@ class View():
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.no_speaker_device_detected_error"))
def printToTextbox_TranslationEngineLimitError(self):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.translation_engine_limit_error"))
# def printToTextbox_OSCError(self): [Deprecated]
# self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin. or turn off the \"Send Message To VRChat\" setting")

View File

@@ -5,10 +5,14 @@ from .ui_utils import fadeInAnimation, setGeometryToCenterOfTheWidget, bindButto
from utils import callFunctionIfCallable
class _CreateConfirmationModal(CTkToplevel):
def __init__(self, attach_window, settings, view_variable):
def __init__(self, attach_window, settings, view_variable, modal_type=None):
super().__init__()
self.withdraw()
self.attach_window = attach_window
self.settings = settings
self._view_variable = view_variable
self.title("")
self.overrideredirect(True)
@@ -17,12 +21,7 @@ class _CreateConfirmationModal(CTkToplevel):
self.BIND_FOCUS_OUT_FUNC_ID=None
self.attach_window = attach_window
self.settings = settings
self._view_variable = view_variable
# self.configure(fg_color="#ff7f50")
self.configure(fg_color=self.settings.ctm.FAKE_BORDER_COLOR)
self.protocol("WM_DELETE_WINDOW", lambda: callFunctionIfCallable(self._view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL))
@@ -70,85 +69,131 @@ class _CreateConfirmationModal(CTkToplevel):
self.modal_buttons_wrapper.grid(row=1, column=0, sticky="ew")
self.modal_buttons_wrapper.grid_columnconfigure(1, weight=1, minsize=self.settings.uism.BUTTONS_BETWEEN_PADDING)
self.modal_buttons_wrapper.grid_columnconfigure((0,2), weight=0, uniform="button_wrapper")
if modal_type == "information":
# self.modal_buttons_wrapper.grid_columnconfigure(1, weight=1, minsize=self.settings.uism.BUTTONS_BETWEEN_PADDING)
self.modal_buttons_wrapper.grid_columnconfigure((0,2), weight=1)
self.accept_button = CTkFrame(self.modal_buttons_wrapper, corner_radius=self.settings.uism.BUTTONS_CORNER_RADIUS, fg_color=self.settings.ctm.ACCEPT_BUTTON_BG_COLOR, cursor="hand2")
self.accept_button.grid(row=0, column=1, sticky="ew")
self.accept_button.grid_columnconfigure(0, weight=1)
self.accept_button_label_wrapper = CTkFrame(self.accept_button, corner_radius=0, fg_color=self.settings.ctm.ACCEPT_BUTTON_BG_COLOR)
self.accept_button_label_wrapper.grid(row=0, column=0, padx=self.settings.uism.BUTTONS_IPADX, pady=self.settings.uism.BUTTONS_IPADY, sticky="ew")
self.deny_button = CTkFrame(self.modal_buttons_wrapper, corner_radius=self.settings.uism.BUTTONS_CORNER_RADIUS, fg_color=self.settings.ctm.DENY_BUTTON_BG_COLOR, cursor="hand2")
self.deny_button.grid(row=0, column=0, sticky="ew")
self.deny_button.grid_columnconfigure(0, weight=1)
self.deny_button_label_wrapper = CTkFrame(self.deny_button, corner_radius=0, fg_color=self.settings.ctm.DENY_BUTTON_BG_COLOR)
self.deny_button_label_wrapper.grid(row=0, column=0, padx=self.settings.uism.BUTTONS_IPADX, pady=self.settings.uism.BUTTONS_IPADY, sticky="ew")
self.deny_button_label_wrapper.grid_columnconfigure((0,2), weight=1)
self.deny_button_label_wrapper.grid_columnconfigure(0, weight=1)
self.deny_button_label = CTkLabel(
self.deny_button_label_wrapper,
textvariable=self._view_variable.VAR_LABEL_CONFIRMATION_MODAL_DENY_BUTTON,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.CONFIRMATION_BUTTONS_TEXT_COLOR,
)
self.deny_button_label.grid(row=0, column=1)
bindButtonFunctionAndColor(
target_widgets=[
self.deny_button,
self.deny_button_label_wrapper,
self.deny_button_label,
],
enter_color=settings.ctm.DENY_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.DENY_BUTTON_BG_COLOR,
clicked_color=settings.ctm.DENY_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda _e: callFunctionIfCallable(self._view_variable.CALLBACK_DENIED_CONFIRMATION_MODAL),
)
self.accept_button = CTkFrame(self.modal_buttons_wrapper, corner_radius=self.settings.uism.BUTTONS_CORNER_RADIUS, fg_color=self.settings.ctm.ACCEPT_BUTTON_BG_COLOR, cursor="hand2")
self.accept_button.grid(row=0, column=2, sticky="ew")
self.accept_button.grid_columnconfigure(0, weight=1)
self.accept_button_label_wrapper = CTkFrame(self.accept_button, corner_radius=0, fg_color=self.settings.ctm.ACCEPT_BUTTON_BG_COLOR)
self.accept_button_label_wrapper.grid(row=0, column=0, padx=self.settings.uism.BUTTONS_IPADX, pady=self.settings.uism.BUTTONS_IPADY, sticky="ew")
self.accept_button_label_wrapper.grid_columnconfigure((0,2), weight=1)
self.accept_button_label = CTkLabel(
self.accept_button_label_wrapper,
textvariable=self._view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.CONFIRMATION_BUTTONS_TEXT_COLOR,
)
self.accept_button_label.grid(row=0, column=1)
bindButtonFunctionAndColor(
target_widgets=[
self.accept_button,
self.accept_button_label_wrapper.grid_columnconfigure((0,2), weight=1)
self.accept_button_label = CTkLabel(
self.accept_button_label_wrapper,
self.accept_button_label,
],
enter_color=settings.ctm.ACCEPT_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.ACCEPT_BUTTON_BG_COLOR,
clicked_color=settings.ctm.ACCEPT_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda _e: callFunctionIfCallable(self._view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL),
)
textvariable=self._view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.CONFIRMATION_BUTTONS_TEXT_COLOR,
)
self.accept_button_label.grid(row=0, column=1)
bindButtonFunctionAndColor(
target_widgets=[
self.accept_button,
self.accept_button_label_wrapper,
self.accept_button_label,
],
enter_color=settings.ctm.ACCEPT_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.ACCEPT_BUTTON_BG_COLOR,
clicked_color=settings.ctm.ACCEPT_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda _e: callFunctionIfCallable(self._view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL),
)
else:
self.modal_buttons_wrapper.grid_columnconfigure(1, weight=1, minsize=self.settings.uism.BUTTONS_BETWEEN_PADDING)
self.modal_buttons_wrapper.grid_columnconfigure((0,2), weight=0, uniform="button_wrapper")
self.deny_button = CTkFrame(self.modal_buttons_wrapper, corner_radius=self.settings.uism.BUTTONS_CORNER_RADIUS, fg_color=self.settings.ctm.DENY_BUTTON_BG_COLOR, cursor="hand2")
self.deny_button.grid(row=0, column=0, sticky="ew")
self.deny_button.grid_columnconfigure(0, weight=1)
self.deny_button_label_wrapper = CTkFrame(self.deny_button, corner_radius=0, fg_color=self.settings.ctm.DENY_BUTTON_BG_COLOR)
self.deny_button_label_wrapper.grid(row=0, column=0, padx=self.settings.uism.BUTTONS_IPADX, pady=self.settings.uism.BUTTONS_IPADY, sticky="ew")
self.deny_button_label_wrapper.grid_columnconfigure((0,2), weight=1)
self.deny_button_label_wrapper.grid_columnconfigure(0, weight=1)
self.deny_button_label = CTkLabel(
self.deny_button_label_wrapper,
textvariable=self._view_variable.VAR_LABEL_CONFIRMATION_MODAL_DENY_BUTTON,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.CONFIRMATION_BUTTONS_TEXT_COLOR,
)
self.deny_button_label.grid(row=0, column=1)
bindButtonFunctionAndColor(
target_widgets=[
self.deny_button,
self.deny_button_label_wrapper,
self.deny_button_label,
],
enter_color=settings.ctm.DENY_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.DENY_BUTTON_BG_COLOR,
clicked_color=settings.ctm.DENY_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda _e: callFunctionIfCallable(self._view_variable.CALLBACK_DENIED_CONFIRMATION_MODAL),
)
self.accept_button = CTkFrame(self.modal_buttons_wrapper, corner_radius=self.settings.uism.BUTTONS_CORNER_RADIUS, fg_color=self.settings.ctm.ACCEPT_BUTTON_BG_COLOR, cursor="hand2")
self.accept_button.grid(row=0, column=2, sticky="ew")
self.accept_button.grid_columnconfigure(0, weight=1)
self.accept_button_label_wrapper = CTkFrame(self.accept_button, corner_radius=0, fg_color=self.settings.ctm.ACCEPT_BUTTON_BG_COLOR)
self.accept_button_label_wrapper.grid(row=0, column=0, padx=self.settings.uism.BUTTONS_IPADX, pady=self.settings.uism.BUTTONS_IPADY, sticky="ew")
self.accept_button_label_wrapper.grid_columnconfigure((0,2), weight=1)
self.accept_button_label = CTkLabel(
self.accept_button_label_wrapper,
textvariable=self._view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.CONFIRMATION_BUTTONS_TEXT_COLOR,
)
self.accept_button_label.grid(row=0, column=1)
bindButtonFunctionAndColor(
target_widgets=[
self.accept_button,
self.accept_button_label_wrapper,
self.accept_button_label,
],
enter_color=settings.ctm.ACCEPT_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.ACCEPT_BUTTON_BG_COLOR,
clicked_color=settings.ctm.ACCEPT_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda _e: callFunctionIfCallable(self._view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL),
)
def hide_buttons(self):
@@ -156,6 +201,8 @@ class _CreateConfirmationModal(CTkToplevel):
def show(self, hide_title_bar:bool=True, close_when_focusout:bool=True):
self.modal_buttons_wrapper.grid()
if hide_title_bar is False:
self.overrideredirect(False)
else:

View File

@@ -36,16 +36,6 @@ class _CreateDropdownMenuWindow(CTkToplevel):
self.withdraw()
self.hide = True
self.title("")
self.overrideredirect(True)
self.wm_attributes("-alpha", 0)
self.wm_attributes("-toolwindow", True)
self.configure(fg_color="#ff7f50")
self.resizable(width=False, height=False)
self.window_additional_y_pos=window_additional_y_pos
self.window_border_width=window_border_width
self.scrollbar_ipadx=scrollbar_ipadx
@@ -89,6 +79,16 @@ class _CreateDropdownMenuWindow(CTkToplevel):
self.init_max_display_length = 8
self.max_display_length = self.init_max_display_length
self.title("")
self.overrideredirect(True)
self.wm_attributes("-alpha", 0)
self.wm_attributes("-toolwindow", True)
self.configure(fg_color=self.window_bg_color)
self.resizable(width=False, height=False)
def updateDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values):
self.dropdown_menu_widgets[dropdown_menu_widget_id].widget.destroy()

View File

@@ -24,14 +24,6 @@ class _CreateErrorWindow(CTkToplevel):
self.withdraw()
self.hide = True
self.title("")
self.overrideredirect(True)
self.wm_attributes("-alpha", 0)
self.wm_attributes("-toolwindow", True)
self.configure(fg_color="#fff")
self.settings = settings
self.attach_widget = None
self._view_variable = view_variable
@@ -53,6 +45,15 @@ class _CreateErrorWindow(CTkToplevel):
self.x_pos = None
self.y_pos = None
self.title("")
self.overrideredirect(True)
self.wm_attributes("-alpha", 0)
self.wm_attributes("-toolwindow", True)
self.configure(fg_color=self.message_bg_color)
self.grid_rowconfigure(0,weight=1)

View File

@@ -10,28 +10,23 @@ class _CreateSelectableLanguagesWindow(CTkToplevel):
super().__init__()
self.withdraw()
self.title("_CreateSelectableLanguagesWindow")
self.overrideredirect(True)
self.attach = vrct_gui.main_bg_container
self.vrct_gui = vrct_gui
self.configure(fg_color="#ff7f50")
self.protocol("WM_DELETE_WINDOW", vrct_gui._closeSelectableLanguagesWindow)
self.settings = settings
self._view_variable = view_variable
self.is_created = False
self.selectable_language_window_type = None
self.title("_CreateSelectableLanguagesWindow")
self.overrideredirect(True)
self.configure(fg_color=self.settings.ctm.TOP_BG_COLOR)
self.protocol("WM_DELETE_WINDOW", vrct_gui._closeSelectableLanguagesWindow)
self.bind("<FocusOut>", self.focusOutFunction)
self.is_created = False
self.selectable_language_window_type = None
def createContainer(self, selectable_language_window_type):
self.selectable_language_window_type = selectable_language_window_type

View File

@@ -1,26 +1,26 @@
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from .ui_utils import fadeInAnimation
from utils import makeEven
class _CreateWindowCover(CTkToplevel):
def __init__(self, attach_window, settings, view_variable):
super().__init__()
self.withdraw()
self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID=None
self.BIND_FOCUS_IN_FUNC_ID=None
self.attach_window = attach_window
self.settings = settings
self._view_variable = view_variable
self.title("")
self.overrideredirect(True)
self.wm_attributes("-toolwindow", True)
self.attach_window = attach_window
self.configure(fg_color="#ff7f50")
self.configure(fg_color="black")
self.protocol("WM_DELETE_WINDOW", lambda: self.withdraw())
self.settings = settings
self._view_variable = view_variable
self.grid_rowconfigure(0,weight=1)
self.grid_columnconfigure(0,weight=1)
@@ -40,7 +40,14 @@ class _CreateWindowCover(CTkToplevel):
self.cover_container_label_wrapper.place(relx=0.5, rely=0.5, anchor="center")
def show(self):
def show(self, bind_focusin=None):
self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID = self.attach_window.bind("<Configure>", self._adjustToMainWindowGeometry, "+")
if bind_focusin is not None:
self.BIND_FOCUS_IN_FUNC_ID = self.bind("<FocusIn>", lambda _e: bind_focusin(), "+")
else:
self.BIND_FOCUS_IN_FUNC_ID = None
self.attributes("-alpha", 0)
self.deiconify()
self.attach_window.update_idletasks()
@@ -52,5 +59,22 @@ class _CreateWindowCover(CTkToplevel):
fadeInAnimation(self, steps=5, interval=0.005, max_alpha=0.5)
def hide(self):
self.attach_window.unbind("<Configure>", self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID)
if self.BIND_FOCUS_IN_FUNC_ID is not None:
self.unbind("<FocusIn>", self.BIND_FOCUS_IN_FUNC_ID)
self.withdraw()
def _adjustToMainWindowGeometry(self, e=None):
self.attach_window.update_idletasks()
x_pos = self.attach_window.winfo_rootx()
y_pos = self.attach_window.winfo_rooty()
width_new = makeEven(self.attach_window.winfo_width())
height_new = makeEven(self.attach_window.winfo_height())
self.geometry("{}x{}+{}+{}".format(width_new, height_new, x_pos, y_pos))
self.lift()

View File

@@ -1,10 +1,14 @@
from customtkinter import CTkImage
def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, target_names):
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"]
for item in hold_state_list:
if item in target_names:
target_names.remove(item)
def update_switch_status(
@@ -146,5 +150,9 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
raise ValueError(f"No matching case for target_name: {target_name}")
if to_hold_state is True:
for item in target_names:
if item not in hold_state_list:
hold_state_list.append(item)
vrct_gui.update()

View File

@@ -19,7 +19,7 @@ class ConfigWindow(CTkToplevel):
self.geometry(f"{self.settings.uism.DEFAULT_WIDTH}x{self.settings.uism.DEFAULT_HEIGHT}")
self.configure(fg_color="#ff7f50")
self.configure(fg_color=self.settings.ctm.MAIN_BG_COLOR)
self.protocol("WM_DELETE_WINDOW", self._view_variable.CALLBACK_CLICKED_CLOSE_CONFIG_WINDOW_BUTTON)

View File

@@ -56,9 +56,11 @@ def _createSettingBoxCompactModeButton(parent_widget, config_window, settings, v
onvalue=True,
offvalue=False,
command=switchConfigWindowCompactMode,
# fg_color="",
fg_color=settings.ctm.COMPACT_MODE_SWITCH_BOX_BG_COLOR,
# bg_color="red",
progress_color=settings.ctm.COMPACT_MODE_SWITCH_BOX_ACTIVE_BG_COLOR,
button_color=settings.ctm.COMPACT_MODE_SWITCH_BOX_BUTTON_COLOR,
button_hover_color=settings.ctm.COMPACT_MODE_SWITCH_BOX_BUTTON_HOVERED_COLOR,
)
config_window.setting_box_compact_mode_switch_box.grid(row=0, column=0)

View File

@@ -177,6 +177,8 @@ class _SettingBoxGenerator():
fg_color=self.settings.ctm.SB__SWITCH_BOX_BG_COLOR,
# bg_color="red",
progress_color=self.settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR,
button_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_COLOR,
button_hover_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_HOVERED_COLOR,
)
setattr(self.config_window, switch_attr_name, switch_widget)
@@ -249,6 +251,8 @@ class _SettingBoxGenerator():
from_=slider_range[0],
to=slider_range[1],
number_of_steps=slider_number_of_steps,
fg_color=self.settings.ctm.SB__SLIDER_BG_COLOR,
progress_color=self.settings.ctm.SB__SLIDER_PROGRESS_BG_COLOR,
button_color=self.settings.ctm.SB__SLIDER_BUTTON_COLOR,
button_hover_color=self.settings.ctm.SB__SLIDER_BUTTON_HOVERED_COLOR,
command=command,
@@ -302,6 +306,9 @@ class _SettingBoxGenerator():
setting_box_item_frame.grid_columnconfigure(1, weight=1)
entry_widget = CTkEntry(
setting_box_item_frame,
text_color=self.settings.ctm.SB__ENTRY_TEXT_COLOR,
fg_color=self.settings.ctm.SB__ENTRY_BG_COLOR,
border_color=self.settings.ctm.SB__ENTRY_BORDER_COLOR,
width=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH,
height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT,
textvariable=entry_variable,
@@ -348,6 +355,8 @@ class _SettingBoxGenerator():
setting_box_item_frame,
height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_HEIGHT,
corner_radius=0,
fg_color=self.settings.ctm.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_BG_COLOR,
progress_color=self.settings.ctm.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_BG_COLOR,
)
setattr(self.config_window, progressbar_attr_name, progressbar_widget)
progressbar_widget.grid(row=1, column=1, padx=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_PADX, sticky="ew")
@@ -400,6 +409,9 @@ class _SettingBoxGenerator():
entry_widget = CTkEntry(
setting_box_item_frame,
text_color=self.settings.ctm.SB__ENTRY_TEXT_COLOR,
fg_color=self.settings.ctm.SB__ENTRY_BG_COLOR,
border_color=self.settings.ctm.SB__ENTRY_BORDER_COLOR,
width=entry_width,
height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT,
textvariable=entry_textvariable,

View File

@@ -19,7 +19,7 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
vrct_gui.grid_rowconfigure(0, weight=1)
# vrct_gui.grid_columnconfigure(0, weight=1, minsize=settings.uism.MAIN_AREA_MIN_WIDTH)
vrct_gui.configure(fg_color="#ff7f50")
vrct_gui.configure(fg_color=settings.ctm.MAIN_BG_COLOR)
vrct_gui.toplevel_wrapper = CTkFrame(vrct_gui, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0)
vrct_gui.toplevel_wrapper.grid(row=0, column=0, sticky="nsew")

View File

@@ -1,3 +1,5 @@
from functools import partial
from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkSwitch, CTkImage
from ....ui_utils import openImageKeepAspectRatio, retag, getLatestHeight, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressAndReleaseFunction
@@ -6,29 +8,29 @@ from utils import callFunctionIfCallable
def createSidebarFeatures(settings, main_window, view_variable):
def toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, mark):
mark.place(relx=0.85) if is_turned_on else mark.place(relx=-1)
def toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, mark_widget):
mark_widget.place(relx=0.85) if is_turned_on else mark_widget.place(relx=-1)
def toggleTranslationFeature():
is_turned_on = main_window.translation_switch_box.get()
callFunctionIfCallable(view_variable.CALLBACK_TOGGLE_TRANSLATION, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.translation_selected_mark)
main_window.translation_frame.markToggleManually(is_turned_on=is_turned_on)
def toggleTranscriptionSendFeature():
is_turned_on = main_window.transcription_send_switch_box.get()
callFunctionIfCallable(view_variable.CALLBACK_TOGGLE_TRANSCRIPTION_SEND, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.transcription_send_selected_mark)
main_window.transcription_send_frame.markToggleManually(is_turned_on=is_turned_on)
def toggleTranscriptionReceiveFeature():
is_turned_on = main_window.transcription_receive_switch_box.get()
callFunctionIfCallable(view_variable.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.transcription_receive_selected_mark)
main_window.transcription_receive_frame.markToggleManually(is_turned_on=is_turned_on)
def toggleForegroundFeature():
is_turned_on = main_window.foreground_switch_box.get()
callFunctionIfCallable(view_variable.CALLBACK_TOGGLE_FOREGROUND, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.foreground_selected_mark)
main_window.foreground_frame.markToggleManually(is_turned_on=is_turned_on)
@@ -213,6 +215,8 @@ def createSidebarFeatures(settings, main_window, view_variable):
fg_color=settings.ctm.SF__SWITCH_BOX_BG_COLOR,
bg_color=settings.ctm.SF__BG_COLOR,
progress_color=settings.ctm.SF__SWITCH_BOX_ACTIVE_BG_COLOR,
button_color=settings.ctm.SF__SWITCH_BOX_BUTTON_COLOR,
# button_hover_color=settings.ctm.SF__SWITCH_BOX_BUTTON_HOVERED_COLOR,
)
setattr(main_window, switch_box_attr_name, switch_box_widget)
@@ -277,4 +281,7 @@ def createSidebarFeatures(settings, main_window, view_variable):
bindButtonPressAndReleaseFunction([compact_mode_icon_widget, frame_widget, compact_mode_frame_widget, label_widget, selected_mark_widget, switch_box_widget._canvas, switch_box_widget._bg_canvas], buttonPressFunction, buttonReleasedFunction)
callback = partial(toggleSidebarFeatureSelectedMarkIfTurnedOn, mark_widget=selected_mark_widget)
frame_widget.markToggleManually = callback
row+=1

View File

@@ -7,7 +7,7 @@ class ColorThemeManager():
self.selectable_language_window = SimpleNamespace()
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
self.update_confirmation_modal = SimpleNamespace()
self.confirmation_modal = SimpleNamespace()
# old one. But leave it here for now.
# self.PRIMARY_100_COLOR = "#c4eac1"
@@ -40,6 +40,7 @@ class ColorThemeManager():
self.DARK_100_COLOR = "#f5f7fb"
self.DARK_200_COLOR = "#f1f2f6"
self.DARK_300_COLOR = "#e9eaee"
self.DARK_350_COLOR = "#d8d9dd"
self.DARK_400_COLOR = "#c7c8cc"
self.DARK_450_COLOR = "#b8b9bd"
self.DARK_500_COLOR = "#a9aaae"
@@ -52,6 +53,7 @@ class ColorThemeManager():
self.DARK_800_COLOR = "#4b4c4f"
self.DARK_825_COLOR = "#434447"
self.DARK_850_COLOR = "#3a3b3e"
self.DARK_863_COLOR = "#36373a"
self.DARK_875_COLOR = "#323336"
self.DARK_888_COLOR = "#2e2f32"
self.DARK_900_COLOR = "#292a2d"
@@ -140,6 +142,10 @@ class ColorThemeManager():
self.main.SF__SWITCH_BOX_ACTIVE_CLICKED_BG_COLOR = self.PRIMARY_700_COLOR
self.main.SF__SWITCH_BOX_DISABLE_BG_COLOR = self.PRIMARY_800_COLOR
self.main.SF__SWITCH_BOX_BUTTON_COLOR = self.DARK_400_COLOR
# It's not working because It overrode internally.
self.main.SF__SWITCH_BOX_BUTTON_HOVERED_COLOR = self.DARK_350_COLOR
self.main.SF__SELECTED_MARK_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
self.main.SF__SELECTED_MARK_ACTIVE_HOVERED_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_HOVERED_BG_COLOR
self.main.SF__SELECTED_MARK_ACTIVE_CLICKED_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_CLICKED_BG_COLOR
@@ -218,17 +224,17 @@ class ColorThemeManager():
self.main_window_cover.TEXT_COLOR = self.LIGHT_100_COLOR
self.update_confirmation_modal.MESSAGE_TEXT_COLOR = self.LIGHT_100_COLOR
self.update_confirmation_modal.FAKE_BORDER_COLOR = self.DARK_600_COLOR
self.update_confirmation_modal.BG_COLOR = self.DARK_800_COLOR
self.update_confirmation_modal.CONFIRMATION_BUTTONS_TEXT_COLOR = self.LIGHT_100_COLOR
self.confirmation_modal.MESSAGE_TEXT_COLOR = self.LIGHT_100_COLOR
self.confirmation_modal.FAKE_BORDER_COLOR = self.DARK_600_COLOR
self.confirmation_modal.BG_COLOR = self.DARK_800_COLOR
self.confirmation_modal.CONFIRMATION_BUTTONS_TEXT_COLOR = self.LIGHT_100_COLOR
self.update_confirmation_modal.ACCEPT_BUTTON_BG_COLOR = self.PRIMARY_600_COLOR
self.update_confirmation_modal.ACCEPT_BUTTON_HOVERED_BG_COLOR = self.PRIMARY_450_COLOR
self.update_confirmation_modal.ACCEPT_BUTTON_CLICKED_BG_COLOR = self.PRIMARY_750_COLOR
self.update_confirmation_modal.DENY_BUTTON_BG_COLOR = self.DARK_750_COLOR
self.update_confirmation_modal.DENY_BUTTON_HOVERED_BG_COLOR = self.DARK_700_COLOR
self.update_confirmation_modal.DENY_BUTTON_CLICKED_BG_COLOR = self.DARK_825_COLOR
self.confirmation_modal.ACCEPT_BUTTON_BG_COLOR = self.PRIMARY_600_COLOR
self.confirmation_modal.ACCEPT_BUTTON_HOVERED_BG_COLOR = self.PRIMARY_450_COLOR
self.confirmation_modal.ACCEPT_BUTTON_CLICKED_BG_COLOR = self.PRIMARY_750_COLOR
self.confirmation_modal.DENY_BUTTON_BG_COLOR = self.DARK_750_COLOR
self.confirmation_modal.DENY_BUTTON_HOVERED_BG_COLOR = self.DARK_700_COLOR
self.confirmation_modal.DENY_BUTTON_CLICKED_BG_COLOR = self.DARK_825_COLOR
# Common
@@ -249,8 +255,10 @@ class ColorThemeManager():
# Compact Mode
self.config_window.COMPACT_MODE_SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
self.config_window.COMPACT_MODE_SWITCH_BOX_BG_COLOR = self.DARK_775_COLOR
self.config_window.COMPACT_MODE_SWITCH_BOX_ACTIVE_BG_COLOR = self.PRIMARY_500_COLOR
self.config_window.COMPACT_MODE_SWITCH_BOX_BUTTON_COLOR = self.DARK_350_COLOR
self.config_window.COMPACT_MODE_SWITCH_BOX_BUTTON_HOVERED_COLOR = self.DARK_300_COLOR
# Main
self.config_window.MAIN_BG_COLOR = self.DARK_950_COLOR
@@ -270,17 +278,29 @@ class ColorThemeManager():
self.config_window.SB__DROPDOWN_MENU_HOVERED_BG_COLOR = self.DARK_800_COLOR
self.config_window.SB__DROPDOWN_MENU_CLICKED_BG_COLOR = self.DARK_900_COLOR
self.config_window.SB__SLIDER_BG_COLOR = self.DARK_700_COLOR
self.config_window.SB__SLIDER_PROGRESS_BG_COLOR = self.DARK_500_COLOR
self.config_window.SB__SLIDER_BUTTON_COLOR = self.DARK_700_COLOR
self.config_window.SB__SLIDER_BUTTON_HOVERED_COLOR = self.DARK_600_COLOR
self.config_window.SB__SWITCH_BOX_BG_COLOR = self.main.SF__SWITCH_BOX_BG_COLOR
self.config_window.SB__SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
self.config_window.SB__SWITCH_BOX_BG_COLOR = self.DARK_800_COLOR
self.config_window.SB__SWITCH_BOX_ACTIVE_BG_COLOR = self.PRIMARY_500_COLOR
self.config_window.SB__SWITCH_BOX_BUTTON_COLOR = self.DARK_400_COLOR
self.config_window.SB__SWITCH_BOX_BUTTON_HOVERED_COLOR = self.DARK_350_COLOR
self.config_window.SB__CHECKBOX_BORDER_COLOR = self.DARK_500_COLOR
self.config_window.SB__CHECKBOX_BORDER_COLOR = self.DARK_600_COLOR
self.config_window.SB__CHECKBOX_HOVER_COLOR = self.DARK_800_COLOR
self.config_window.SB__CHECKBOX_CHECKED_COLOR = self.PRIMARY_700_COLOR
self.config_window.SB__CHECKBOX_CHECKMARK_COLOR = self.config_window.BASIC_TEXT_COLOR
self.config_window.SB__ENTRY_TEXT_COLOR = self.DARK_300_COLOR
self.config_window.SB__ENTRY_BG_COLOR = self.DARK_863_COLOR
self.config_window.SB__ENTRY_BORDER_COLOR = self.DARK_775_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_BG_COLOR = self.DARK_800_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_PROGRESS_BG_COLOR = self.PRIMARY_400_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_COLOR = self.PRIMARY_600_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_HOVERED_COLOR = self.PRIMARY_400_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR = self.DARK_800_COLOR
@@ -322,144 +342,144 @@ class ColorThemeManager():
def _createLightModeColor(self):
# Common
self.main.BASIC_TEXT_COLOR = self.DARK_1000_COLOR
self.main.LABELS_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
# def _createLightModeColor(self):
# # Common
# self.main.BASIC_TEXT_COLOR = self.DARK_1000_COLOR
# self.main.LABELS_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
# Main
self.main.MAIN_BG_COLOR = self.LIGHT_300_COLOR
# # Main
# self.main.MAIN_BG_COLOR = self.LIGHT_300_COLOR
self.main.TEXTBOX_BG_COLOR = self.LIGHT_200_COLOR
self.main.TEXTBOX_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
self.main.TEXTBOX_TAB_BG_PASSIVE_COLOR = self.LIGHT_350_COLOR
self.main.TEXTBOX_TAB_BG_ACTIVE_COLOR = self.main.TEXTBOX_BG_COLOR
self.main.TEXTBOX_TAB_BG_HOVERED_COLOR = self.LIGHT_300_COLOR
self.main.TEXTBOX_TAB_BG_CLICKED_COLOR = self.LIGHT_350_COLOR
self.main.TEXTBOX_TAB_TEXT_ACTIVE_COLOR = self.main.BASIC_TEXT_COLOR
self.main.TEXTBOX_TAB_TEXT_PASSIVE_COLOR = self.LIGHT_600_COLOR
# self.main.TEXTBOX_BG_COLOR = self.LIGHT_200_COLOR
# self.main.TEXTBOX_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
# self.main.TEXTBOX_TAB_BG_PASSIVE_COLOR = self.LIGHT_350_COLOR
# self.main.TEXTBOX_TAB_BG_ACTIVE_COLOR = self.main.TEXTBOX_BG_COLOR
# self.main.TEXTBOX_TAB_BG_HOVERED_COLOR = self.LIGHT_300_COLOR
# self.main.TEXTBOX_TAB_BG_CLICKED_COLOR = self.LIGHT_350_COLOR
# self.main.TEXTBOX_TAB_TEXT_ACTIVE_COLOR = self.main.BASIC_TEXT_COLOR
# self.main.TEXTBOX_TAB_TEXT_PASSIVE_COLOR = self.LIGHT_600_COLOR
self.main.TEXTBOX_ENTRY_TEXT_COLOR = self.LIGHT_800_COLOR
self.main.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR = self.LIGHT_500_COLOR
self.main.TEXTBOX_ENTRY_BG_COLOR = self.LIGHT_325_COLOR
self.main.TEXTBOX_ENTRY_BORDER_COLOR = self.LIGHT_400_COLOR
self.main.TEXTBOX_ENTRY_PLACEHOLDER_COLOR = self.LIGHT_600_COLOR
self.main.TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR = self.LIGHT_700_COLOR
# self.main.TEXTBOX_ENTRY_TEXT_COLOR = self.LIGHT_800_COLOR
# self.main.TEXTBOX_ENTRY_TEXT_DISABLED_COLOR = self.LIGHT_500_COLOR
# self.main.TEXTBOX_ENTRY_BG_COLOR = self.LIGHT_325_COLOR
# self.main.TEXTBOX_ENTRY_BORDER_COLOR = self.LIGHT_400_COLOR
# self.main.TEXTBOX_ENTRY_PLACEHOLDER_COLOR = self.LIGHT_600_COLOR
# self.main.TEXTBOX_ENTRY_PLACEHOLDER_DISABLED_COLOR = self.LIGHT_700_COLOR
# Sidebar
self.main.SIDEBAR_BG_COLOR = self.LIGHT_350_COLOR
# # Sidebar
# self.main.SIDEBAR_BG_COLOR = self.LIGHT_350_COLOR
# Sidebar Features
self.main.SF__BG_COLOR = self.LIGHT_375_COLOR
self.main.SF__HOVERED_BG_COLOR = self.LIGHT_300_COLOR
self.main.SF__CLICKED_BG_COLOR = self.LIGHT_200_COLOR
self.main.SF__TEXT_DISABLED_COLOR = self.LIGHT_500_COLOR
# # Sidebar Features
# self.main.SF__BG_COLOR = self.LIGHT_375_COLOR
# self.main.SF__HOVERED_BG_COLOR = self.LIGHT_300_COLOR
# self.main.SF__CLICKED_BG_COLOR = self.LIGHT_200_COLOR
# self.main.SF__TEXT_DISABLED_COLOR = self.LIGHT_500_COLOR
self.main.SF__SWITCH_BOX_BG_COLOR = self.LIGHT_300_COLOR
self.main.SF__SWITCH_BOX_HOVERED_BG_COLOR = self.LIGHT_450_COLOR
self.main.SF__SWITCH_BOX_CLICKED_BG_COLOR = self.LIGHT_350_COLOR
self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR = self.PRIMARY_650_COLOR
self.main.SF__SWITCH_BOX_ACTIVE_HOVERED_BG_COLOR = self.PRIMARY_500_COLOR
self.main.SF__SWITCH_BOX_ACTIVE_CLICKED_BG_COLOR = self.PRIMARY_700_COLOR
self.main.SF__SWITCH_BOX_DISABLE_BG_COLOR = self.PRIMARY_900_COLOR
# self.main.SF__SWITCH_BOX_BG_COLOR = self.LIGHT_300_COLOR
# self.main.SF__SWITCH_BOX_HOVERED_BG_COLOR = self.LIGHT_450_COLOR
# self.main.SF__SWITCH_BOX_CLICKED_BG_COLOR = self.LIGHT_350_COLOR
# self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR = self.PRIMARY_650_COLOR
# self.main.SF__SWITCH_BOX_ACTIVE_HOVERED_BG_COLOR = self.PRIMARY_500_COLOR
# self.main.SF__SWITCH_BOX_ACTIVE_CLICKED_BG_COLOR = self.PRIMARY_700_COLOR
# self.main.SF__SWITCH_BOX_DISABLE_BG_COLOR = self.PRIMARY_900_COLOR
self.main.SF__SELECTED_MARK_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
self.main.SF__SELECTED_MARK_ACTIVE_HOVERED_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_HOVERED_BG_COLOR
self.main.SF__SELECTED_MARK_ACTIVE_CLICKED_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_CLICKED_BG_COLOR
self.main.SF__SELECTED_MARK_DISABLE_BG_COLOR = self.main.SF__SWITCH_BOX_DISABLE_BG_COLOR
# self.main.SF__SELECTED_MARK_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
# self.main.SF__SELECTED_MARK_ACTIVE_HOVERED_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_HOVERED_BG_COLOR
# self.main.SF__SELECTED_MARK_ACTIVE_CLICKED_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_CLICKED_BG_COLOR
# self.main.SF__SELECTED_MARK_DISABLE_BG_COLOR = self.main.SF__SWITCH_BOX_DISABLE_BG_COLOR
# Sidebar quick settings
self.main.SLS__TITLE_TEXT_COLOR = self.LIGHT_800_COLOR
# # Sidebar quick settings
# self.main.SLS__TITLE_TEXT_COLOR = self.LIGHT_800_COLOR
self.main.SLS__BG_COLOR = self.LIGHT_300_COLOR
# self.main.SLS__BG_COLOR = self.LIGHT_300_COLOR
self.main.SLS__PRESETS_TAB_BG_HOVERED_COLOR = self.LIGHT_350_COLOR
self.main.SLS__PRESETS_TAB_BG_CLICKED_COLOR = self.LIGHT_800_COLOR
self.main.SLS__PRESETS_TAB_BG_PASSIVE_COLOR = self.main.SIDEBAR_BG_COLOR
self.main.SLS__PRESETS_TAB_BG_ACTIVE_COLOR = self.main.SLS__BG_COLOR
self.main.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE = self.LIGHT_600_COLOR
self.main.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
# self.main.SLS__PRESETS_TAB_BG_HOVERED_COLOR = self.LIGHT_350_COLOR
# self.main.SLS__PRESETS_TAB_BG_CLICKED_COLOR = self.LIGHT_800_COLOR
# self.main.SLS__PRESETS_TAB_BG_PASSIVE_COLOR = self.main.SIDEBAR_BG_COLOR
# self.main.SLS__PRESETS_TAB_BG_ACTIVE_COLOR = self.main.SLS__BG_COLOR
# self.main.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE = self.LIGHT_600_COLOR
# self.main.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
self.main.SLS__BOX_BG_COLOR = self.LIGHT_350_COLOR
self.main.SLS__BOX_SECTION_TITLE_TEXT_COLOR = self.LIGHT_800_COLOR
self.main.SLS__BOX_ARROWS_TEXT_COLOR = self.LIGHT_700_COLOR
# self.main.SLS__BOX_BG_COLOR = self.LIGHT_350_COLOR
# self.main.SLS__BOX_SECTION_TITLE_TEXT_COLOR = self.LIGHT_800_COLOR
# self.main.SLS__BOX_ARROWS_TEXT_COLOR = self.LIGHT_700_COLOR
self.main.SLS__OPTIONMENU_BG_COLOR = self.LIGHT_500_COLOR
# self.main.SLS__OPTIONMENU_BG_COLOR = self.LIGHT_500_COLOR
self.main.CONFIG_BUTTON_BG_COLOR = self.main.SIDEBAR_BG_COLOR
self.main.CONFIG_BUTTON_HOVERED_BG_COLOR = self.LIGHT_800_COLOR
self.main.CONFIG_BUTTON_CLICKED_BG_COLOR = self.LIGHT_900_COLOR
# self.main.CONFIG_BUTTON_DISABLE_COLOR = self.LIGHT_900_COLOR
# self.main.CONFIG_BUTTON_BG_COLOR = self.main.SIDEBAR_BG_COLOR
# self.main.CONFIG_BUTTON_HOVERED_BG_COLOR = self.LIGHT_800_COLOR
# self.main.CONFIG_BUTTON_CLICKED_BG_COLOR = self.LIGHT_900_COLOR
# # self.main.CONFIG_BUTTON_DISABLE_COLOR = self.LIGHT_900_COLOR
self.main.MINIMIZE_SIDEBAR_BUTTON_BG_COLOR = self.main.SIDEBAR_BG_COLOR
self.main.MINIMIZE_SIDEBAR_BUTTON_HOVERED_BG_COLOR = self.LIGHT_800_COLOR
self.main.MINIMIZE_SIDEBAR_BUTTON_CLICKED_BG_COLOR = self.LIGHT_900_COLOR
# self.main.MINIMIZE_SIDEBAR_BUTTON_DISABLE_COLOR = self.LIGHT_900_COLOR
# self.main.MINIMIZE_SIDEBAR_BUTTON_BG_COLOR = self.main.SIDEBAR_BG_COLOR
# self.main.MINIMIZE_SIDEBAR_BUTTON_HOVERED_BG_COLOR = self.LIGHT_800_COLOR
# self.main.MINIMIZE_SIDEBAR_BUTTON_CLICKED_BG_COLOR = self.LIGHT_900_COLOR
# # self.main.MINIMIZE_SIDEBAR_BUTTON_DISABLE_COLOR = self.LIGHT_900_COLOR
self.main.HELP_AND_INFO_BUTTON_BG_COLOR = self.main.MAIN_BG_COLOR
self.main.HELP_AND_INFO_BUTTON_HOVERED_BG_COLOR = self.LIGHT_350_COLOR
self.main.HELP_AND_INFO_BUTTON_CLICKED_BG_COLOR = self.LIGHT_450_COLOR
# self.main.HELP_AND_INFO_BUTTON_DISABLE_COLOR = self.LIGHT_900_COLOR
# self.main.HELP_AND_INFO_BUTTON_BG_COLOR = self.main.MAIN_BG_COLOR
# self.main.HELP_AND_INFO_BUTTON_HOVERED_BG_COLOR = self.LIGHT_350_COLOR
# self.main.HELP_AND_INFO_BUTTON_CLICKED_BG_COLOR = self.LIGHT_450_COLOR
# # self.main.HELP_AND_INFO_BUTTON_DISABLE_COLOR = self.LIGHT_900_COLOR
# Common
self.config_window.BASIC_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
self.config_window.LABELS_TEXT_COLOR = self.config_window.BASIC_TEXT_COLOR
self.config_window.LABELS_DESC_TEXT_COLOR = self.DARK_500_COLOR
# # Common
# self.config_window.BASIC_TEXT_COLOR = self.main.BASIC_TEXT_COLOR
# self.config_window.LABELS_TEXT_COLOR = self.config_window.BASIC_TEXT_COLOR
# self.config_window.LABELS_DESC_TEXT_COLOR = self.DARK_500_COLOR
# Top bar
self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR
# # Top bar
# self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR
# Main
self.config_window.MAIN_BG_COLOR = self.DARK_950_COLOR
# # Main
# self.config_window.MAIN_BG_COLOR = self.DARK_950_COLOR
# This is for fake border color
self.config_window.SB__WRAPPER_BG_COLOR = self.DARK_750_COLOR
# # This is for fake border color
# self.config_window.SB__WRAPPER_BG_COLOR = self.DARK_750_COLOR
self.config_window.SB__BG_COLOR = self.DARK_888_COLOR
# self.config_window.SB__BG_COLOR = self.DARK_888_COLOR
self.config_window.SB__OPTIONMENU_BG_COLOR = self.DARK_925_COLOR
self.config_window.SB__OPTIONMENU_HOVERED_BG_COLOR = self.DARK_875_COLOR
# self.config_window.SB__OPTIONMENU_BG_COLOR = self.DARK_925_COLOR
# self.config_window.SB__OPTIONMENU_HOVERED_BG_COLOR = self.DARK_875_COLOR
self.config_window.SB__SLIDER_BUTTON_COLOR = self.DARK_700_COLOR
self.config_window.SB__SLIDER_BUTTON_HOVERED_COLOR = self.DARK_600_COLOR
# self.config_window.SB__SLIDER_BUTTON_COLOR = self.DARK_700_COLOR
# self.config_window.SB__SLIDER_BUTTON_HOVERED_COLOR = self.DARK_600_COLOR
self.config_window.SB__SWITCH_BOX_BG_COLOR = self.main.SF__SWITCH_BOX_BG_COLOR
self.config_window.SB__SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
# self.config_window.SB__SWITCH_BOX_BG_COLOR = self.main.SF__SWITCH_BOX_BG_COLOR
# self.config_window.SB__SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
self.config_window.SB__CHECKBOX_BORDER_COLOR = self.DARK_500_COLOR
self.config_window.SB__CHECKBOX_HOVER_COLOR = self.DARK_800_COLOR
self.config_window.SB__CHECKBOX_CHECKED_COLOR = self.PRIMARY_700_COLOR
self.config_window.SB__CHECKBOX_CHECKMARK_COLOR = self.config_window.BASIC_TEXT_COLOR
# self.config_window.SB__CHECKBOX_BORDER_COLOR = self.DARK_500_COLOR
# self.config_window.SB__CHECKBOX_HOVER_COLOR = self.DARK_800_COLOR
# self.config_window.SB__CHECKBOX_CHECKED_COLOR = self.PRIMARY_700_COLOR
# self.config_window.SB__CHECKBOX_CHECKMARK_COLOR = self.config_window.BASIC_TEXT_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_COLOR = self.PRIMARY_700_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_HOVERED_COLOR = self.PRIMARY_500_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR = self.DARK_800_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_COLOR = self.PRIMARY_700_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_HOVERED_COLOR = self.PRIMARY_500_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR = self.DARK_800_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR = self.DARK_800_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_HOVERED_COLOR = self.DARK_700_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_CLICKED_COLOR = self.DARK_900_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR = self.DARK_850_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR = self.DARK_800_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_HOVERED_COLOR = self.DARK_700_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_CLICKED_COLOR = self.DARK_900_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR = self.DARK_850_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_COLOR = self.PRIMARY_700_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_HOVERED_COLOR = self.PRIMARY_600_COLOR
self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_CLICKED_COLOR = self.PRIMARY_900_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_DISABLED_COLOR = self.PRIMARY_900_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_COLOR = self.PRIMARY_700_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_HOVERED_COLOR = self.PRIMARY_600_COLOR
# self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_CLICKED_COLOR = self.PRIMARY_900_COLOR
# # self.config_window.SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_DISABLED_COLOR = self.PRIMARY_900_COLOR
# Side menu
self.config_window.SIDE_MENU_BG_COLOR = self.config_window.MAIN_BG_COLOR
# # Side menu
# self.config_window.SIDE_MENU_BG_COLOR = self.config_window.MAIN_BG_COLOR
self.config_window.SIDE_MENU_LABELS_BG_COLOR = self.config_window.SIDE_MENU_BG_COLOR
self.config_window.SIDE_MENU_LABELS_BG_FOR_FAKE_BORDER_COLOR = self.config_window.SIDE_MENU_BG_COLOR
self.config_window.SIDE_MENU_LABELS_HOVERED_BG_COLOR = self.DARK_850_COLOR
self.config_window.SIDE_MENU_LABELS_CLICKED_BG_COLOR = self.PRIMARY_900_COLOR
self.config_window.SIDE_MENU_LABELS_SELECTED_TEXT_COLOR = self.PRIMARY_300_COLOR
# self.config_window.SIDE_MENU_LABELS_BG_COLOR = self.config_window.SIDE_MENU_BG_COLOR
# self.config_window.SIDE_MENU_LABELS_BG_FOR_FAKE_BORDER_COLOR = self.config_window.SIDE_MENU_BG_COLOR
# self.config_window.SIDE_MENU_LABELS_HOVERED_BG_COLOR = self.DARK_850_COLOR
# self.config_window.SIDE_MENU_LABELS_CLICKED_BG_COLOR = self.PRIMARY_900_COLOR
# self.config_window.SIDE_MENU_LABELS_SELECTED_TEXT_COLOR = self.PRIMARY_300_COLOR
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

View File

@@ -10,7 +10,7 @@ class UiScalingManager():
self.selectable_language_window = SimpleNamespace()
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
self.update_confirmation_modal = SimpleNamespace()
self.confirmation_modal = SimpleNamespace()
self._calculatedUiSizes()
@@ -144,15 +144,15 @@ class UiScalingManager():
self.main_window_cover.TEXT_FONT_SIZE = self._calculateUiSize(20)
self.update_confirmation_modal.FAKE_BORDER_SIZE = self._calculateUiSize(1, is_allowed_odd=True)
self.update_confirmation_modal.CONTENTS_WRAPPER = self._calculateUiSize(20)
self.update_confirmation_modal.MARGIN_BETWEEN_MESSAGE_AND_BUTTONS = self._calculateUiSize(40)
self.update_confirmation_modal.MESSAGE_FONT_SIZE = self._calculateUiSize(20)
self.update_confirmation_modal.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE = self._calculateUiSize(18)
self.update_confirmation_modal.BUTTONS_BETWEEN_PADDING = self._calculateUiSize(100)
self.update_confirmation_modal.BUTTONS_CORNER_RADIUS = self._calculateUiSize(6)
self.update_confirmation_modal.BUTTONS_IPADX = self._calculateUiSize(10)
self.update_confirmation_modal.BUTTONS_IPADY = self._calculateUiSize(6)
self.confirmation_modal.FAKE_BORDER_SIZE = self._calculateUiSize(1, is_allowed_odd=True)
self.confirmation_modal.CONTENTS_WRAPPER = self._calculateUiSize(20)
self.confirmation_modal.MARGIN_BETWEEN_MESSAGE_AND_BUTTONS = self._calculateUiSize(40)
self.confirmation_modal.MESSAGE_FONT_SIZE = self._calculateUiSize(20)
self.confirmation_modal.CONFIRMATION_BUTTONS_TEXT_FONT_SIZE = self._calculateUiSize(18)
self.confirmation_modal.BUTTONS_BETWEEN_PADDING = self._calculateUiSize(100)
self.confirmation_modal.BUTTONS_CORNER_RADIUS = self._calculateUiSize(6)
self.confirmation_modal.BUTTONS_IPADX = self._calculateUiSize(10)
self.confirmation_modal.BUTTONS_IPADY = self._calculateUiSize(6)
# Config Window

View File

@@ -14,15 +14,13 @@ from .main_window import createMainWindowWidgets
from .config_window import ConfigWindow
from .ui_utils import setDefaultActiveTab, setGeometryToCenterOfScreen, fadeInAnimation
from utils import callFunctionIfCallable, makeEven
from utils import callFunctionIfCallable
class VRCT_GUI(CTk):
def __init__(self):
super().__init__()
self.withdraw()
self.is_config_window_already_opened_once=False
self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID=None
self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID=None
self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = None
self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = None
@@ -104,7 +102,7 @@ class VRCT_GUI(CTk):
)
self.main_window_cover = _CreateWindowCover(
attach_window=self.toplevel_wrapper,
attach_window=self,
settings=self.settings.main_window_cover,
view_variable=self._view_variable
)
@@ -122,12 +120,19 @@ class VRCT_GUI(CTk):
message_text_color=self.settings.config_window.ctm.SB__ERROR_MESSAGE_TEXT_COLOR,
)
self.update_confirmation_modal = _CreateConfirmationModal(
self.confirmation_modal = _CreateConfirmationModal(
attach_window=self.toplevel_wrapper,
settings=self.settings.update_confirmation_modal,
settings=self.settings.confirmation_modal,
view_variable=self._view_variable
)
self.information_modal = _CreateConfirmationModal(
attach_window=self.toplevel_wrapper,
settings=self.settings.confirmation_modal,
view_variable=self._view_variable,
modal_type="information"
)
# self.update()
# self.geometry("{}x{}".format(self.winfo_width(), self.winfo_height()))
@@ -143,14 +148,11 @@ class VRCT_GUI(CTk):
def _openConfigWindow(self):
self.main_window_cover.show()
self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID = self.bind("<Configure>", self._adjustToMainWindowGeometry, "+")
self.main_window_cover.show(bind_focusin=self.config_window.lift)
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.main_window_cover.bind("<FocusIn>", lambda _e: self.config_window.lift(), "+")
self.config_window.attributes("-alpha", 0)
self.config_window.deiconify()
@@ -165,10 +167,8 @@ class VRCT_GUI(CTk):
self.config_window.withdraw()
self.main_window_cover.hide()
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.main_window_cover.unbind("<FocusIn>", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID)
self.adjusted_event=None
@@ -219,13 +219,14 @@ class VRCT_GUI(CTk):
def _changeMainWindowWidgetsStatus(self, status, target_names):
def _changeMainWindowWidgetsStatus(self, status, target_names, to_hold_state:bool=False):
_changeMainWindowWidgetsStatus(
vrct_gui=self,
settings=self.settings.main,
view_variable=self._view_variable,
status=status,
target_names=target_names,
to_hold_state=to_hold_state,
)
def _changeConfigWindowWidgetsStatus(self, status, target_names):
@@ -268,16 +269,6 @@ class VRCT_GUI(CTk):
self.minimize_sidebar_button_container__for_closing.grid()
def _adjustToMainWindowGeometry(self, e=None):
self.update_idletasks()
x_pos = self.winfo_rootx()
y_pos = self.winfo_rooty()
width_new = makeEven(self.winfo_width())
height_new = makeEven(self.winfo_height())
self.main_window_cover.geometry("{}x{}+{}+{}".format(width_new, height_new, x_pos, y_pos))
self.main_window_cover.lift()
def _showErrorMessage(self, target_widget):
self.error_message_window.show(target_widget=target_widget)