From 6968f81366e8d6334b3a4dbd9667e9a831d6cc19 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 08:10:57 +0900 Subject: [PATCH 1/9] =?UTF-8?q?[Refactor]=20=E5=A4=89=E6=95=B0=E5=90=8D?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 3 +-- locales/ja.yml | 3 +-- view.py | 20 ++++++++++------ vrct_gui/_CreateErrorWindow.py | 22 ++++++++--------- ...teModalWindow.py => _CreateWindowCover.py} | 14 +++++------ vrct_gui/ui_managers/ColorThemeManager.py | 5 ++-- vrct_gui/ui_managers/UiScalingManager.py | 5 ++-- vrct_gui/vrct_gui.py | 24 +++++++++---------- 8 files changed, 51 insertions(+), 45 deletions(-) rename vrct_gui/{_CreateModalWindow.py => _CreateWindowCover.py} (79%) diff --git a/locales/en.yml b/locales/en.yml index 0bdcc10c..3fef05fe 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -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 diff --git a/locales/ja.yml b/locales/ja.yml index c0133468..f6bb107e 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -16,8 +16,7 @@ main_window: update_available: 新しいバージョンが出ました! - modal_message: - opened_config_window: 設定画面が閉じられるまで、一時的に機能を停止しています。 + cover_message: 設定画面が閉じられるまで、一時的に機能を停止しています。 selectable_language_window: diff --git a/view.py b/view.py index 58b60f97..7ec6110c 100644 --- a/view.py +++ b/view.py @@ -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 diff --git a/vrct_gui/_CreateErrorWindow.py b/vrct_gui/_CreateErrorWindow.py index f92e47f6..5a2cbd7d 100644 --- a/vrct_gui/_CreateErrorWindow.py +++ b/vrct_gui/_CreateErrorWindow.py @@ -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): diff --git a/vrct_gui/_CreateModalWindow.py b/vrct_gui/_CreateWindowCover.py similarity index 79% rename from vrct_gui/_CreateModalWindow.py rename to vrct_gui/_CreateWindowCover.py index f7a656b1..bab5382e 100644 --- a/vrct_gui/_CreateModalWindow.py +++ b/vrct_gui/_CreateWindowCover.py @@ -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): diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index 5af8f120..bdded267 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -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 diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 73560339..6e359211 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -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) diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index 38335495..6971f7bb 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -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("", self._adjustToMainWindowGeometry, "+") self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = self.bind("", self.detectMainWindowState, "+") self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = self.bind("", self.detectMainWindowState, "+") - self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.modal_window.bind("", lambda _e: self.config_window.lift(), "+") + self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.main_window_cover.bind("", 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("", self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID) self.unbind("", self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID) self.unbind("", self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID) - self.modal_window.unbind("", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID) + self.main_window_cover.unbind("", 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: From 31ea7ebf8ababee3130d571a0b751e7c6e2560d9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 08:33:54 +0900 Subject: [PATCH 2/9] =?UTF-8?q?[Refactor]=20view=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E3=81=AE=E5=BC=95=E6=95=B0=E7=B3=BB=E3=81=AE=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=87=E3=83=B3=E3=83=88=E8=AA=BF=E6=95=B4=20=E2=80=BB?= =?UTF-8?q?=E3=81=A0=E3=81=84=E3=81=B6=E6=84=9F=E8=A6=9A=E7=9A=84=E3=81=AA?= =?UTF-8?q?=E7=8B=AC=E8=87=AA=E3=83=AB=E3=83=BC=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateDropdownMenuWindow.py | 38 +++++++------- vrct_gui/_CreateErrorWindow.py | 18 +++---- vrct_gui/_changeMainWindowWidgetsStatus.py | 11 +++- vrct_gui/_printToTextbox.py | 10 +++- .../_SettingBoxGenerator.py | 52 ++++++++++++++++--- 5 files changed, 94 insertions(+), 35 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index a4f880b0..340beb99 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -9,26 +9,28 @@ from functools import partial from utils import isEven, makeEven class _CreateDropdownMenuWindow(CTkToplevel): - def __init__(self, - settings, - view_variable, + def __init__( + self, + settings, + view_variable, - window_additional_y_pos, - window_border_width, - scrollbar_ipadx, - scrollbar_width, - value_ipadx, - value_ipady, - value_pady, - value_font_size, + window_additional_y_pos, + window_border_width, + scrollbar_ipadx, + scrollbar_width, + value_ipadx, + value_ipady, + value_pady, + value_font_size, + + window_bg_color, + window_border_color, + values_bg_color, + values_hovered_bg_color, + values_clicked_bg_color, + values_text_color, + ): - window_bg_color, - window_border_color, - values_bg_color, - values_hovered_bg_color, - values_clicked_bg_color, - values_text_color, - ): super().__init__() self.withdraw() self.hide = True diff --git a/vrct_gui/_CreateErrorWindow.py b/vrct_gui/_CreateErrorWindow.py index 5a2cbd7d..f6091453 100644 --- a/vrct_gui/_CreateErrorWindow.py +++ b/vrct_gui/_CreateErrorWindow.py @@ -7,17 +7,17 @@ from utils import isEven class _CreateErrorWindow(CTkToplevel): def __init__( - self, - settings, - view_variable, - wrapper_widget, + self, + settings, + view_variable, + wrapper_widget, - message_ipadx, - message_ipady, - message_font_size, + message_ipadx, + message_ipady, + message_font_size, - message_bg_color, - message_text_color, + message_bg_color, + message_text_color, ): super().__init__() diff --git a/vrct_gui/_changeMainWindowWidgetsStatus.py b/vrct_gui/_changeMainWindowWidgetsStatus.py index e785d810..0f2f7af2 100644 --- a/vrct_gui/_changeMainWindowWidgetsStatus.py +++ b/vrct_gui/_changeMainWindowWidgetsStatus.py @@ -9,7 +9,16 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta - def update_switch_status(widget_frame, widget_label, widget_switch_box, widget_selected_mark, widget_compact_mode_icon, icon_name, disabled_icon_name): + def update_switch_status( + widget_frame, + widget_label, + widget_switch_box, + widget_selected_mark, + widget_compact_mode_icon, + icon_name, + disabled_icon_name, + ): + if status == "disabled": widget_frame.configure(cursor="") widget_label.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR) diff --git a/vrct_gui/_printToTextbox.py b/vrct_gui/_printToTextbox.py index e99ab1c4..943b047d 100644 --- a/vrct_gui/_printToTextbox.py +++ b/vrct_gui/_printToTextbox.py @@ -1,7 +1,15 @@ from datetime import datetime from customtkinter import CTkFont -def _printToTextbox(vrct_gui, settings, target_type, original_message=None, translated_message=None, tags=None, disable_print_to_textbox_all:bool=False): +def _printToTextbox(vrct_gui, + settings, + target_type, + original_message=None, + translated_message=None, + tags=None, + disable_print_to_textbox_all:bool=False, + ): + now_raw_data = datetime.now() # now = now_raw_data.strftime("%H:%M:%S") now_hm = now_raw_data.strftime("%H:%M") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index db613ad7..e5f7ecd7 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -91,7 +91,16 @@ class _SettingBoxGenerator(): - def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, dropdown_menu_width=None, variable=None, dropdown_menu_values=None): + def createSettingBoxDropdownMenu( + self, + for_var_label_text, for_var_desc_text, + optionmenu_attr_name, + command, + dropdown_menu_width=None, + dropdown_menu_values=None, + variable=None, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(optionmenu_attr_name, for_var_label_text, for_var_desc_text) def adjustedCommand(value): @@ -143,7 +152,13 @@ class _SettingBoxGenerator(): - def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, variable, command): + def createSettingBoxSwitch(self, + for_var_label_text, for_var_desc_text, + switch_attr_name, + variable, + command, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text) switch_widget = CTkSwitch( @@ -171,7 +186,13 @@ class _SettingBoxGenerator(): - def createSettingBoxCheckbox(self, for_var_label_text, for_var_desc_text, checkbox_attr_name, variable, command): + def createSettingBoxCheckbox(self, + for_var_label_text, for_var_desc_text, + checkbox_attr_name, + command, + variable, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(checkbox_attr_name, for_var_label_text, for_var_desc_text) checkbox_widget = CTkCheckBox( @@ -205,7 +226,19 @@ class _SettingBoxGenerator(): - def createSettingBoxSlider(self, for_var_label_text, for_var_desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None, slider_bind__ButtonPress=None, slider_bind__ButtonRelease=None): + def createSettingBoxSlider( + self, + for_var_label_text, for_var_desc_text, + slider_attr_name, + slider_range, + command, + variable, + slider_number_of_steps: Union[int, + None] = None, + slider_bind__ButtonPress=None, + slider_bind__ButtonRelease=None + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(slider_attr_name, for_var_label_text, for_var_desc_text) @@ -258,7 +291,6 @@ class _SettingBoxGenerator(): slider_number_of_steps: Union[int, None] = None, ): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name) def adjusted_command__for_entry_bind__Any_KeyRelease(e): @@ -352,7 +384,15 @@ class _SettingBoxGenerator(): - def createSettingBoxEntry(self, for_var_label_text, for_var_desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable, entry_bind__FocusOut=None): + def createSettingBoxEntry(self, + for_var_label_text, for_var_desc_text, + entry_attr_name, + entry_width, + entry_textvariable, + entry_bind__Any_KeyRelease, + entry_bind__FocusOut=None, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(entry_attr_name, for_var_label_text, for_var_desc_text) def adjusted_command__for_entry_bind__Any_KeyRelease(e): From fb67930ed140852c7a3d3dda8c6982e4faa8fda0 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 08:58:01 +0900 Subject: [PATCH 3/9] [Refactor] Remove the code that is no longe in use. --- view.py | 1 - vrct_gui/_CreateDropdownMenuWindow.py | 3 +-- vrct_gui/_CreateSelectableLanguagesWindow.py | 1 - vrct_gui/_CreateWindowCover.py | 1 - vrct_gui/_changeMainWindowWidgetsStatus.py | 6 ++---- vrct_gui/config_window/ConfigWindow.py | 2 +- .../config_window/widgets/createConfigWindowTitle.py | 1 - .../createSettingBoxTopBar/createSettingBoxTopBar.py | 4 ++-- .../_createSettingBoxContainer.py | 2 +- .../createSideMenuAndSettingsBoxContainers.py | 4 ++-- .../widgets/_create_sidebar/createSidebarFeatures.py | 4 ---- .../_create_sidebar/createSidebarLanguagesSettings.py | 2 +- vrct_gui/main_window/widgets/create_sidebar.py | 10 ---------- vrct_gui/main_window/widgets/create_textbox.py | 4 ++-- vrct_gui/ui_utils/__init__.py | 3 +-- vrct_gui/ui_utils/ui_utils.py | 2 +- vrct_gui/vrct_gui.py | 4 ++-- 17 files changed, 16 insertions(+), 38 deletions(-) diff --git a/view.py b/view.py index 7ec6110c..6af00b34 100644 --- a/view.py +++ b/view.py @@ -1,5 +1,4 @@ from os import path as os_path -from typing import Union from types import SimpleNamespace from tkinter import font as tk_font import webbrowser diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 340beb99..b4a64775 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -3,7 +3,7 @@ from types import SimpleNamespace from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont, CTkScrollableFrame from time import sleep -from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestWidth, getLatestHeight, applyUiScalingAndFixTheBugScrollBar +from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestHeight, applyUiScalingAndFixTheBugScrollBar from functools import partial from utils import isEven, makeEven @@ -239,7 +239,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): anchor="w", text_color=self.values_text_color, ) - # setattr(self, f"l", label_widget) label_widget.grid(row=1, column=0, padx=self.value_ipadx, pady=self.value_ipady, sticky="w") diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index 0ba102b4..ca87c547 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -159,7 +159,6 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): anchor="w", text_color=self.settings.ctm.BASIC_TEXT_COLOR, ) - # setattr(self, f"l", label_widget) label_widget.grid(row=1, column=0, padx=self.settings.uism.VALUES_TEXT_IPADX, pady=self.settings.uism.VALUES_TEXT_IPADY) diff --git a/vrct_gui/_CreateWindowCover.py b/vrct_gui/_CreateWindowCover.py index bab5382e..f86929c1 100644 --- a/vrct_gui/_CreateWindowCover.py +++ b/vrct_gui/_CreateWindowCover.py @@ -11,7 +11,6 @@ class _CreateWindowCover(CTkToplevel): self.title("") self.overrideredirect(True) - # self.wm_attributes("-alpha", 0.5) self.wm_attributes("-toolwindow", True) self.attach_window = attach_window diff --git a/vrct_gui/_changeMainWindowWidgetsStatus.py b/vrct_gui/_changeMainWindowWidgetsStatus.py index 0f2f7af2..dc303094 100644 --- a/vrct_gui/_changeMainWindowWidgetsStatus.py +++ b/vrct_gui/_changeMainWindowWidgetsStatus.py @@ -93,8 +93,7 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta vrct_gui.sls__title_text_target_language.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR) if view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is False: vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE) - # vrct_gui.sls__optionmenu_your_language.configure(state="disabled") - # vrct_gui.sls__optionmenu_target_language.configure(state="disabled") + elif status == "normal": vrct_gui.sls__container_title.configure(text_color=settings.ctm.LABELS_TEXT_COLOR) @@ -103,8 +102,7 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta if view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is False: vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR) vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR) - # vrct_gui.sls__optionmenu_your_language.configure(state="normal") - # vrct_gui.sls__optionmenu_target_language.configure(state="normal") + case "config_button": diff --git a/vrct_gui/config_window/ConfigWindow.py b/vrct_gui/config_window/ConfigWindow.py index ee88da4b..9e57aa3c 100644 --- a/vrct_gui/config_window/ConfigWindow.py +++ b/vrct_gui/config_window/ConfigWindow.py @@ -3,7 +3,7 @@ from .widgets import createConfigWindowTitle, createSideMenuAndSettingsBoxContai from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont -from ..ui_utils import getImagePath, getLatestWidth, getLatestHeight +from ..ui_utils import getImagePath, getLatestWidth from utils import isEven class ConfigWindow(CTkToplevel): diff --git a/vrct_gui/config_window/widgets/createConfigWindowTitle.py b/vrct_gui/config_window/widgets/createConfigWindowTitle.py index 4e949667..4db6b4f4 100644 --- a/vrct_gui/config_window/widgets/createConfigWindowTitle.py +++ b/vrct_gui/config_window/widgets/createConfigWindowTitle.py @@ -18,7 +18,6 @@ def createConfigWindowTitle(config_window, settings, view_variable): config_window.side_menu_config_window_title_logo_wrapper.grid_rowconfigure(0,weight=1) config_window.side_menu_config_window_title = CTkLabel( config_window.side_menu_config_window_title_logo_frame, - # text="Settings", textvariable=view_variable.VAR_CONFIG_WINDOW_TITLE, height=0, anchor="w", diff --git a/vrct_gui/config_window/widgets/createSettingBoxTopBar/createSettingBoxTopBar.py b/vrct_gui/config_window/widgets/createSettingBoxTopBar/createSettingBoxTopBar.py index 5dad5207..12a0403c 100644 --- a/vrct_gui/config_window/widgets/createSettingBoxTopBar/createSettingBoxTopBar.py +++ b/vrct_gui/config_window/widgets/createSettingBoxTopBar/createSettingBoxTopBar.py @@ -1,10 +1,10 @@ -from customtkinter import CTkFont, CTkFrame, CTkLabel +from customtkinter import CTkFrame from ._createSettingBoxTitle import _createSettingBoxTitle from ._createRestartButton import _createRestartButton from ._createSettingBoxCompactModeButton import _createSettingBoxCompactModeButton -from ....ui_utils import getLatestHeight, getLatestWidth +from ....ui_utils import getLatestHeight from utils import isEven def createSettingBoxTopBar(config_window, settings, view_variable): diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py index 8efbbdf5..97859e3a 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py @@ -28,7 +28,7 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b setting_box_row=0 - for i, setting_box_setting in enumerate(setting_box_container_settings["setting_boxes"]): + for setting_box_setting in setting_box_container_settings["setting_boxes"]: # Top-Padding that can be container the section title setting_box_top_padding = CTkFrame(setting_box_container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=settings.uism.SB__TOP_PADY) setting_box_top_padding.grid(row=setting_box_row, column=0, sticky="ew", padx=0, pady=0) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index 2fac3c15..f9694a1a 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -1,6 +1,6 @@ from customtkinter import CTkFrame, CTkScrollableFrame -from ....ui_utils import _setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar +from ....ui_utils import setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar from ._addConfigSideMenuItem import _addConfigSideMenuItem from ._createSettingBoxContainer import _createSettingBoxContainer @@ -152,7 +152,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl # Set default active side menu tab view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(sm_and_sbc_setting["textvariable"].get()) config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"]) - _setDefaultActiveTab( + setDefaultActiveTab( active_tab_widget=config_window.current_active_side_menu_tab, active_bg_color=settings.ctm.SIDE_MENU_LABELS_BG_COLOR, active_text_color=settings.ctm.SIDE_MENU_LABELS_SELECTED_TEXT_COLOR diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py index 1785f6bb..0f8314f0 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py @@ -214,10 +214,6 @@ def createSidebarFeatures(settings, main_window, view_variable): bg_color=settings.ctm.SF__BG_COLOR, progress_color=settings.ctm.SF__SWITCH_BOX_ACTIVE_BG_COLOR, ) - # # if sfs["is_checked"] is True: - # # target_attr.select() - # # else: - # # target_attr.deselect() setattr(main_window, switch_box_attr_name, switch_box_widget) diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py index 98fda4ae..346afae5 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py @@ -1,6 +1,6 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkImage -from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor, createOptionMenuBox, getLatestWidth +from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor, createOptionMenuBox from utils import callFunctionIfCallable diff --git a/vrct_gui/main_window/widgets/create_sidebar.py b/vrct_gui/main_window/widgets/create_sidebar.py index 4605bef4..763472a0 100644 --- a/vrct_gui/main_window/widgets/create_sidebar.py +++ b/vrct_gui/main_window/widgets/create_sidebar.py @@ -55,16 +55,6 @@ def createSidebar(settings, main_window, view_variable): main_window.sidebar_config_button.grid(row=0, column=0, padx=0, pady=settings.uism.SIDEBAR_CONFIG_BUTTON_IPADY) - # main_window.sidebar_config_button_update_badge = CTkFrame( - # main_window.sidebar_config_button, - # corner_radius=3, - # fg_color="#ca5361", - # width=6, - # height=6, - # ) - # main_window.sidebar_config_button_update_badge.place(relx=0.9, rely=0.1, anchor="center") - - bindButtonFunctionAndColor( target_widgets=[main_window.sidebar_config_button_wrapper, main_window.sidebar_config_button], enter_color=settings.ctm.CONFIG_BUTTON_HOVERED_BG_COLOR, diff --git a/vrct_gui/main_window/widgets/create_textbox.py b/vrct_gui/main_window/widgets/create_textbox.py index ce1f2e7a..99e977f4 100644 --- a/vrct_gui/main_window/widgets/create_textbox.py +++ b/vrct_gui/main_window/widgets/create_textbox.py @@ -1,6 +1,6 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkTextbox -from ...ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, _setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor +from ...ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor def createTextbox(settings, main_window, view_variable): @@ -152,7 +152,7 @@ def createTextbox(settings, main_window, view_variable): # Set default active textbox tab main_window.current_active_textbox_tab = getattr(main_window, "textbox_tab_all") - _setDefaultActiveTab( + setDefaultActiveTab( active_tab_widget=main_window.current_active_textbox_tab, active_bg_color=settings.ctm.TEXTBOX_TAB_BG_ACTIVE_COLOR, active_text_color=settings.ctm.TEXTBOX_TAB_TEXT_ACTIVE_COLOR diff --git a/vrct_gui/ui_utils/__init__.py b/vrct_gui/ui_utils/__init__.py index e501aebe..bc2a1337 100644 --- a/vrct_gui/ui_utils/__init__.py +++ b/vrct_gui/ui_utils/__init__.py @@ -1,2 +1 @@ -from .ui_utils import * -from .ui_utils import _setDefaultActiveTab \ No newline at end of file +from .ui_utils import * \ No newline at end of file diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index 8f562d32..03c963a8 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -88,7 +88,7 @@ def unbindEventFromActiveTabWidget(active_tab_widget): active_tab_widget.unbind(event_name) active_tab_widget.children["!ctklabel"].unbind(event_name) -def _setDefaultActiveTab(active_tab_widget, active_bg_color, active_text_color): +def setDefaultActiveTab(active_tab_widget, active_bg_color, active_text_color): active_tab_widget.configure(fg_color=active_bg_color, cursor="") active_tab_widget.children["!ctklabel"].configure(fg_color=active_bg_color, text_color=active_text_color) unbindEventFromActiveTabWidget(active_tab_widget) diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index 6971f7bb..fae93026 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -11,7 +11,7 @@ from ._printToTextbox import _printToTextbox from .main_window import createMainWindowWidgets from .config_window import ConfigWindow -from .ui_utils import _setDefaultActiveTab, getLatestHeight, setGeometryToCenterOfScreen, fadeInAnimation +from .ui_utils import setDefaultActiveTab, setGeometryToCenterOfScreen, fadeInAnimation from utils import callFunctionIfCallable, makeEven @@ -238,7 +238,7 @@ class VRCT_GUI(CTk): def _setDefaultActiveLanguagePresetTab(self, tab_no:str): self.current_active_preset_tab = getattr(self, f"sls__presets_button_{tab_no}") - _setDefaultActiveTab( + setDefaultActiveTab( active_tab_widget=self.current_active_preset_tab, active_bg_color=self.settings.main.ctm.SLS__PRESETS_TAB_BG_ACTIVE_COLOR, active_text_color=self.settings.main.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR From ff675330c6f453feb5c790b60fe1d72304fd06cb Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 15:57:01 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[Update]=20Main=20Window:=20Textbox=20log?= =?UTF-8?q?=E5=86=85=E3=81=AE=E3=82=B7=E3=82=B9=E3=83=86=E3=83=A0=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E8=8B=B1=E8=AA=9E?= =?UTF-8?q?=E3=81=A8=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=80=82=E6=96=87=E8=A8=80=E8=AA=BF=E6=95=B4=E3=80=82=20[Refac?= =?UTF-8?q?tor]=20Commented=20out=20the=20code=20that=20is=20no=20longer?= =?UTF-8?q?=20in=20use=20in=20view.py=20(osc=20error=20message)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 22 ++++++++++++++++++++++ locales/ja.yml | 21 +++++++++++++++++++++ view.py | 42 ++++++++++++++++++++---------------------- 3 files changed, 63 insertions(+), 22 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index 3fef05fe..b1fc34da 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -14,15 +14,37 @@ main_window: textbox_tab_received: Received textbox_tab_system: System + textbox_system_message: + enabled_translation: Translation feature is turned on. + disabled_translation: Translation feature is turned off. + enabled_voice2chatbox: Transcription from the microphone has started. + disabled_voice2chatbox: Transcription from the microphone has been stopped. + enabled_speaker2log: Transcription from the speaker has started. + disabled_speaker2log: Transcription from the speaker has been stopped. + enabled_foreground: The screen is fixed in the foreground. + disabled_foreground: The foreground fixation has been released. + + auth_key_success: Auth key update completed. + auth_key_error: Auth Key is incorrect or Usage limit reached. + + detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter. + + selected_your_language: "\"Your Language\" has set to %{your_language}." + selected_target_language: "\"Target Language\" has set to %{target_language}." + switched_language_preset_tab: Switched to Language Preset Tab No.%{tab_no}." + latest_language_setting: "Currently, \"Your Language\" is set to %{your_language}, and \"Target Language\" is set to %{target_language}." + update_available: New version is here! cover_message: The functionality is temporarily disabled until the settings window is closed. + selectable_language_window: title_your_language: Select Your Language title_target_language: Select Target Language go_back_button: Go Back + config_window: config_title: Settings compact_mode: Compact Mode diff --git a/locales/ja.yml b/locales/ja.yml index f6bb107e..93758f5d 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -14,6 +14,26 @@ main_window: textbox_tab_received: 受信 textbox_tab_system: システム + textbox_system_message: + enabled_translation: 翻訳機能をONにしました。 + disabled_translation: 翻訳機能をOFFしました。 + enabled_voice2chatbox: マイクからの音声入力、文字起こしを開始します。 + disabled_voice2chatbox: マイクからの音声入力、文字起こしを終了しました。 + enabled_speaker2log: スピーカーからの音声聞き取り、文字起こしを開始します。 + disabled_speaker2log: スピーカーからの音声聞き取り、文字起こしを終了しました。 + enabled_foreground: 画面を常に最前面へ固定します。 + disabled_foreground: 最前面への固定を解除しました。 + + auth_key_success: 認証キーの更新が完了しました。 + auth_key_error: 認証キーが間違っているか、API使用制限が上限に達しています. + + detected_by_word_filter: ワードフィルターに登録されている単語 %{detected_message} が検出されたため送信しませんでした。 + + selected_your_language: 「あなたの言語」 を %{your_language} に設定しました。 + selected_target_language: 「相手の言語」 を %{target_language} に設定しました。 + switched_language_preset_tab: 言語プリセット番号 %{tab_no} に切り替わりました。 + latest_language_setting: 現在「あなたの言語」は %{your_language}、「相手の言語」は %{target_language} に設定されています。 + update_available: 新しいバージョンが出ました! cover_message: 設定画面が閉じられるまで、一時的に機能を停止しています。 @@ -24,6 +44,7 @@ selectable_language_window: title_target_language: 相手の言語 go_back_button: 戻る + config_window: config_title: 設定 compact_mode: コンパクトモード diff --git a/view.py b/view.py index 6af00b34..83d82eda 100644 --- a/view.py +++ b/view.py @@ -597,56 +597,54 @@ class View(): def printToTextbox_enableTranslation(self): - self._printToTextbox_Info("翻訳機能をONにしました") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_translation")) def printToTextbox_disableTranslation(self): - self._printToTextbox_Info("翻訳機能をOFFにしました") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_translation")) def printToTextbox_enableTranscriptionSend(self): - self._printToTextbox_Info("Voice2chatbox機能をONにしました") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_voice2chatbox")) def printToTextbox_disableTranscriptionSend(self): - self._printToTextbox_Info("Voice2chatbox機能をOFFにしました") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_voice2chatbox")) def printToTextbox_enableTranscriptionReceive(self): - self._printToTextbox_Info("Speaker2chatbox機能をONにしました") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_speaker2log")) def printToTextbox_disableTranscriptionReceive(self): - self._printToTextbox_Info("Speaker2chatbox機能をOFFにしました") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_speaker2log")) def printToTextbox_enableForeground(self): - self._printToTextbox_Info("Start foreground") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_foreground")) def printToTextbox_disableForeground(self): - self._printToTextbox_Info("Stop foreground") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_foreground")) def printToTextbox_AuthenticationSuccess(self): - self._printToTextbox_Info("Auth key update completed") - + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.auth_key_success")) def printToTextbox_AuthenticationError(self): - self._printToTextbox_Info("Auth Key is incorrect or Usage limit reached") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.auth_key_error")) - def printToTextbox_OSCError(self): - self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin. or turn off the \"Send Message To VRChat\" setting") + # 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") def printToTextbox_DetectedByWordFilter(self, detected_message): - self._printToTextbox_Info(f"Detect WordFilter :{detected_message}") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.detected_by_word_filter"), detected_message=detected_message) def printToTextbox_selectedYourLanguages(self, selected_your_language): your_language = selected_your_language.replace("\n", " ") - self._printToTextbox_Info(f"Your Language has changed : {your_language}") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_your_language", your_language=your_language)) def printToTextbox_selectedTargetLanguages(self, selected_target_language): target_language = selected_target_language.replace("\n", " ") - self._printToTextbox_Info(f"Target Language has changed : {target_language}") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_target_language", target_language=target_language)) + + def printToTextbox_changedLanguagePresetTab(self, tab_no:str): + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.switched_language_preset_tab", tab_no=tab_no)) + self.printToTextbox_latestSelectedLanguages() def printToTextbox_latestSelectedLanguages(self): your_language = self.view_variable.VAR_YOUR_LANGUAGE.get().replace("\n", " ") target_language = self.view_variable.VAR_TARGET_LANGUAGE.get().replace("\n", " ") - self._printToTextbox_Info(f"Your Language : {your_language} -- Target Language : {target_language}") - - def printToTextbox_changedLanguagePresetTab(self, tab_no:str): - your_language = config.SELECTED_TAB_YOUR_LANGUAGES[tab_no].replace("\n", " ") - target_language = config.SELECTED_TAB_TARGET_LANGUAGES[tab_no].replace("\n", " ") - self._printToTextbox_Info(f"Switched Language Preset. No.{tab_no}\nYour Language : {your_language} -- Target Language : {target_language}") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.latest_language_setting", your_language=your_language, target_language=target_language)) @staticmethod From 6d6e678f72766112c8f91a1ae05e30d924733373 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 15:59:08 +0900 Subject: [PATCH 5/9] [bugfix] Typo --- locales/ja.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/ja.yml b/locales/ja.yml index 93758f5d..71995a37 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -100,7 +100,7 @@ config_window: label_for_automatic: "スピーカー入力感度の調整 (現在の設定: 自動)" desc_for_automatic: スピーカーの入力感度を自動的に調節する。 label_for_manual: "スピーカー入力感度の調整 (現在の設定: 手動)" - desc_for_manual: スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実実際に音声を聞き取り、音量を確認しながら調節できます。 + desc_for_manual: スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。 speaker_record_timeout: label: 入力が終了したとみなす無音時間 speaker_phrase_timeout: From c0fb949a381b7bd69518805d5e374d7c31ddb1b1 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:16:18 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[Update]=20Main=20Window:=20Textbox=20log?= =?UTF-8?q?=E5=86=85=E3=81=AE=E3=82=B7=E3=82=B9=E3=83=86=E3=83=A0=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AE=E8=8B=B1=E8=AA=9E?= =?UTF-8?q?=E3=80=81=E6=97=A5=E6=9C=AC=E8=AA=9E=E5=AF=BE=E5=BF=9C=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=80=82=20help=20and=20info=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=92=E3=82=AF=E3=83=AA=E3=83=83=E3=82=AF=E3=81=97?= =?UTF-8?q?=E3=80=81VRCT=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=8C=E9=96=8B=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AE=E6=96=87=E8=A8=80=E3=82=92?= =?UTF-8?q?=E3=81=95=E3=82=89=E3=81=AB=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 3 +++ locales/ja.yml | 3 +++ view.py | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index b1fc34da..d40a3e73 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -34,6 +34,9 @@ main_window: switched_language_preset_tab: Switched to Language Preset Tab No.%{tab_no}." latest_language_setting: "Currently, \"Your Language\" is set to %{your_language}, and \"Target Language\" is set to %{target_language}." + opened_web_page_booth: Opened Booth page in your web browser. + opened_web_page_vrct_documents: "Opened VRCT Documents page in your web browser.\nFor any issues, requests, or inquiries, please feel free to contact us through the links at the bottom of the documents page, the \"Contact Form,\" or via X (formerly Twitter)!" + update_available: New version is here! cover_message: The functionality is temporarily disabled until the settings window is closed. diff --git a/locales/ja.yml b/locales/ja.yml index 71995a37..6f7c104c 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -34,6 +34,9 @@ main_window: switched_language_preset_tab: 言語プリセット番号 %{tab_no} に切り替わりました。 latest_language_setting: 現在「あなたの言語」は %{your_language}、「相手の言語」は %{target_language} に設定されています。 + opened_web_page_booth: お使いのブラウザで、Boothのページを開きました。 + opened_web_page_vrct_documents: "お使いのブラウザで、VRCTのドキュメントを開きました。使用方法などはそちらに記載されています。\n不具合、ご要望、その他お問い合わせはドキュメント最下部にあるLinks、「お問合せフォーム」もしくはX(元Twitter)にて気軽にご連絡ください!" + update_available: 新しいバージョンが出ました! cover_message: 設定画面が閉じられるまで、一時的に機能を停止しています。 diff --git a/view.py b/view.py index 83d82eda..f84e955d 100644 --- a/view.py +++ b/view.py @@ -523,11 +523,11 @@ class View(): def openWebPage_Booth(self): self.openWebPage(config.BOOTH_URL) - self._printToTextbox_Info("Opened Booth page in your web browser.") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.opened_web_page_booth")) def openWebPage_VrctDocuments(self): self.openWebPage(config.DOCUMENTS_URL) - self._printToTextbox_Info("Opened the VRCT Documents page in your web browser.") + self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.opened_web_page_vrct_documents")) @staticmethod def showUpdateAvailableButton(): From 6ed59df59634373ab691aeb204a6c4b5cef699b8 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:48:15 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[Update]=20Config=20Window:=20=E5=86=8D?= =?UTF-8?q?=E8=B5=B7=E5=8B=95=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AE=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E8=A8=80=E8=AA=9E=E3=80=82UI=20Language=E3=81=8C?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=95=E3=82=8C=E3=81=9F=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AF=E3=80=81=E5=A4=89=E6=9B=B4=E5=85=88=E3=81=AE=E8=A8=80?= =?UTF-8?q?=E8=AA=9E=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 2 +- view.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controller.py b/controller.py index d6205f82..bf8ee183 100644 --- a/controller.py +++ b/controller.py @@ -360,7 +360,7 @@ def callbackSetUiLanguage(value): value = get_key_by_value(selectable_languages, value) print("callbackSetUiLanguage__after_get_key_by_value", value) config.UI_LANGUAGE = value - view.showRestartButton() + view.showRestartButton(locale=config.UI_LANGUAGE) # Translation Tab def callbackSetDeeplAuthkey(value): diff --git a/view.py b/view.py index f84e955d..541c6b72 100644 --- a/view.py +++ b/view.py @@ -1,3 +1,4 @@ +from typing import Union from os import path as os_path from types import SimpleNamespace from tkinter import font as tk_font @@ -718,7 +719,8 @@ class View(): # Config Window - def showRestartButton(self): + def showRestartButton(self, locale:Union[None,str]=None): + self.view_variable.VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL.set(i18n.t("config_window.restart_message", locale=locale)) vrct_gui.config_window.restart_button_container.grid() def hideRestartButton(self): vrct_gui.config_window.restart_button_container.grid_remove() From f8ce0ee0e6c35e0aa10fd6d1c5aca3baf38233aa Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 19:16:55 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[Update]=20Config=20Window:=20Transcription?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=80=81Mic/Speaker=20Max=20Phrases=E3=81=AA?= =?UTF-8?q?=E3=81=A9=E3=81=AE=E6=95=B0=E5=80=A4=E5=85=A5=E5=8A=9B=E7=B3=BB?= =?UTF-8?q?=E3=81=AE=E8=AA=AC=E6=98=8E=E3=81=AB=E3=80=8C=E5=8D=98=E4=BD=8D?= =?UTF-8?q?=E3=80=8D=E3=82=92=E8=A1=A8=E8=A8=98=E3=80=82yml=E5=86=85?= =?UTF-8?q?=E3=81=AB=E8=BF=BD=E5=8A=A0=E3=81=95=E3=82=8C=E3=81=9F=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88desc?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E3=81=AF=E5=88=B6=E4=BD=9C=E4=B8=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yml | 7 +++++++ locales/ja.yml | 7 +++++++ view.py | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index d40a3e73..122b7edf 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -89,10 +89,15 @@ config_window: desc_for_manual: "Manually determine the microphone input sensitivity using the slider. Press the microphone icon to input your voice and adjust the sensitivity while monitoring the volume." mic_record_timeout: label: Mic Record Timeout + desc: (Second(s)) + # desc: Duration in seconds for detecting silence and determining the end of audio input. mic_phrase_timeout: label: Mic Phrase Timeout + desc: (Second(s)) + # desc: Duration in seconds for determining the end of audio input and transcribing it in one go. mic_max_phrase: label: Mic Max Phrases + # desc: Once the minimum word count for transcription is reached, it will be send. mic_word_filter: label: Mic Word Filter desc: "It will not send the sentence if the word(s) included in the set list of words.\nHow to set: e.g. AAA,BBB,CCC" @@ -106,8 +111,10 @@ config_window: desc_for_manual: "Manually determine the speaker input sensitivity using the slider. Press the headphones icon to listen to the audio and adjust the sensitivity while monitoring the volume." speaker_record_timeout: label: Speaker Record Timeout + desc: (Second(s)) speaker_phrase_timeout: label: Speaker Phrase Timeout + desc: (Second(s)) speaker_max_phrase: label: Speaker Max Phrases diff --git a/locales/ja.yml b/locales/ja.yml index 6f7c104c..9f4d3d74 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -89,10 +89,15 @@ config_window: desc_for_manual: スライダーを調整して入力感度を手動で決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。 mic_record_timeout: label: 入力が終了したとみなす無音時間 + desc: 単位は秒です。 + # desc: 無音を検出し、音声入力が終了したとみなす時間の長さです。(秒) mic_phrase_timeout: label: 一度に文字起こしする時間の長さ + desc: 単位は秒です。 + # desc: 一度に文字起こし処理をする音声時間の長さです。(秒) mic_max_phrase: label: 送信するまでに保持する単語数 + # desc: 文字起こしされた単語数を保持する最大値で、その数を超えると送信します。 mic_word_filter: label: ワードフィルター desc: "設定された単語を検出すると、その文章は送信されません。\n設定の例: AAA,BBB,CCC" @@ -106,8 +111,10 @@ config_window: desc_for_manual: スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。 speaker_record_timeout: label: 入力が終了したとみなす無音時間 + desc: 単位は秒です。 speaker_phrase_timeout: label: 一度に文字起こしする時間の長さ + desc: 単位は秒です。 speaker_max_phrase: label: ログとして表示するまでに保持する単語数 diff --git a/view.py b/view.py index 541c6b72..ba07425a 100644 --- a/view.py +++ b/view.py @@ -229,13 +229,13 @@ class View(): VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.label")), - VAR_DESC_MIC_RECORD_TIMEOUT=None, + VAR_DESC_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.desc")), CALLBACK_SET_MIC_RECORD_TIMEOUT=None, VAR_MIC_RECORD_TIMEOUT=StringVar(value=config.INPUT_MIC_RECORD_TIMEOUT), CALLBACK_FOCUS_OUT_MIC_RECORD_TIMEOUT=self.setLatestConfigVariable_MicRecordTimeout, VAR_LABEL_MIC_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.mic_phrase_timeout.label")), - VAR_DESC_MIC_PHRASE_TIMEOUT=None, + VAR_DESC_MIC_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.mic_phrase_timeout.desc")), CALLBACK_SET_MIC_PHRASE_TIMEOUT=None, VAR_MIC_PHRASE_TIMEOUT=StringVar(value=config.INPUT_MIC_PHRASE_TIMEOUT), CALLBACK_FOCUS_OUT_MIC_PHRASE_TIMEOUT=self.setLatestConfigVariable_MicPhraseTimeout, @@ -273,13 +273,13 @@ class View(): VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.label")), - VAR_DESC_SPEAKER_RECORD_TIMEOUT=None, + VAR_DESC_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.desc")), CALLBACK_SET_SPEAKER_RECORD_TIMEOUT=None, VAR_SPEAKER_RECORD_TIMEOUT=StringVar(value=config.INPUT_SPEAKER_RECORD_TIMEOUT), CALLBACK_FOCUS_OUT_SPEAKER_RECORD_TIMEOUT=self.setLatestConfigVariable_SpeakerRecordTimeout, VAR_LABEL_SPEAKER_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_phrase_timeout.label")), - VAR_DESC_SPEAKER_PHRASE_TIMEOUT=None, + VAR_DESC_SPEAKER_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_phrase_timeout.desc")), CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT=None, VAR_SPEAKER_PHRASE_TIMEOUT=StringVar(value=config.INPUT_SPEAKER_PHRASE_TIMEOUT), CALLBACK_FOCUS_OUT_SPEAKER_PHRASE_TIMEOUT=self.setLatestConfigVariable_SpeakerPhraseTimeout, From 8f0ccdda5ba141a2577adfe2d9413f4c0bfd74d8 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 19:49:43 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[bugfix/tmp]=20Config=20Window:=20=E3=83=87?= =?UTF-8?q?=E3=83=90=E3=82=A4=E3=82=B9=E7=B3=BB=E3=81=AE=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=80=81=E3=83=89=E3=83=AD=E3=83=83=E3=83=97=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=AE=E5=B9=85?= =?UTF-8?q?=E3=82=92=E5=9F=BA=E6=9C=AC500px=E3=81=A8=E5=BA=83=E3=81=8F?= =?UTF-8?q?=E3=80=82=E9=96=93=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=81=A7?= =?UTF-8?q?=E3=81=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting_box_transcription/createSettingBox_Mic.py | 2 +- .../setting_box_transcription/createSettingBox_Speaker.py | 2 +- vrct_gui/ui_managers/UiScalingManager.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py index 8b192421..405c8df6 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py @@ -58,7 +58,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_desc_text=view_variable.VAR_DESC_MIC_DEVICE, optionmenu_attr_name="sb__optionmenu_mic_device", dropdown_menu_values=view_variable.LIST_MIC_DEVICE, - dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, + dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_500, command=lambda value: optionmenu_input_mic_device_callback(value), variable=view_variable.VAR_MIC_DEVICE, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py index 62e8dd12..64ec1854 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py @@ -41,7 +41,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DEVICE, optionmenu_attr_name="sb__optionmenu_speaker_device", dropdown_menu_values=view_variable.LIST_SPEAKER_DEVICE, - dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, + dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_500, command=lambda value: optionmenu_input_speaker_device_callback(value), variable=view_variable.VAR_SPEAKER_DEVICE, ) diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 6e359211..5159bb81 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -22,7 +22,7 @@ class UiScalingManager(): self.common.SCROLLBAR_IPADX = (self._calculateUiSize(2), self._calculateUiSize(2)) self.common.SCROLLBAR_WIDTH = self._calculateUiSize(16) - for i in range(10, 301, 10): + for i in range(10, 501, 10): setattr(self.main, f"RESPONSIVE_UI_SIZE_INT_{i}", self._calculateUiSize(i)) setattr(self.config_window, f"RESPONSIVE_UI_SIZE_INT_{i}", self._calculateUiSize(i))