[Update] add Information Modal. This is for displaying when reached translation limit that 429 too many requests.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
94
view.py
@@ -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._hideConfirmationModal
|
||||
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(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")
|
||||
|
||||
|
||||
@@ -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,10 +21,6 @@ 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)
|
||||
@@ -70,85 +70,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 +202,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:
|
||||
|
||||
@@ -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()
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -279,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
|
||||
@@ -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"
|
||||
@@ -224,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -122,12 +122,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()))
|
||||
@@ -219,13 +226,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):
|
||||
|
||||
Reference in New Issue
Block a user