[Update] Config Window: 設定画面の選択されたタブ情報を保存。設定画面開閉、コンパクトモード切り替え時でも前回開いていたタブが選択された状態で表示されるように(VRCT再起動で初期表示タブへとリセット)
This commit is contained in:
7
view.py
7
view.py
@@ -100,6 +100,8 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
# Config Window
|
# Config Window
|
||||||
|
ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_appearance",
|
||||||
|
CALLBACK_SELECTED_SETTING_BOX_TAB=None,
|
||||||
# Appearance Tab
|
# Appearance Tab
|
||||||
VAR_LABEL_TRANSPARENCY=StringVar(value="Transparency"),
|
VAR_LABEL_TRANSPARENCY=StringVar(value="Transparency"),
|
||||||
VAR_DESC_TRANSPARENCY=StringVar(value="Change the window's transparency. 50% to 100%. (Default: 100%)"),
|
VAR_DESC_TRANSPARENCY=StringVar(value="Change the window's transparency. 50% to 100%. (Default: 100%)"),
|
||||||
@@ -309,6 +311,8 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
# Config Window
|
# Config Window
|
||||||
|
self.view_variable.CALLBACK_SELECTED_SETTING_BOX_TAB=self._updateActiveSettingBoxTabNo
|
||||||
|
|
||||||
# Compact Mode Switch
|
# Compact Mode Switch
|
||||||
if config_window_registers is not None:
|
if config_window_registers is not None:
|
||||||
|
|
||||||
@@ -508,6 +512,9 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
# Config Window
|
# Config Window
|
||||||
|
def _updateActiveSettingBoxTabNo(self, active_setting_box_tab_attr_name:str):
|
||||||
|
self.view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME = active_setting_box_tab_attr_name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def setWidgetsStatus_ConfigWindowCompactModeSwitch_Disabled():
|
def setWidgetsStatus_ConfigWindowCompactModeSwitch_Disabled():
|
||||||
vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="disabled")
|
vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="disabled")
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel
|
|||||||
|
|
||||||
from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor
|
from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor
|
||||||
|
|
||||||
|
from utils import callFunctionIfCallable
|
||||||
|
|
||||||
|
|
||||||
def _addConfigSideMenuItem(config_window, settings, side_menu_settings, side_menu_row, all_side_menu_tab_attr_name):
|
def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_settings, side_menu_row, all_side_menu_tab_attr_name):
|
||||||
|
|
||||||
|
|
||||||
def switchActiveAndPassiveSettingBoxContainerTabsColor(target_active_widget):
|
def switchActiveAndPassiveSettingBoxContainerTabsColor(target_active_widget):
|
||||||
@@ -51,11 +52,12 @@ def _addConfigSideMenuItem(config_window, settings, side_menu_settings, side_men
|
|||||||
|
|
||||||
|
|
||||||
def switchToTargetSettingBoxContainer(e, text, target_active_tab_widget_attr_name, target_setting_box_container_attr_name):
|
def switchToTargetSettingBoxContainer(e, text, target_active_tab_widget_attr_name, target_setting_box_container_attr_name):
|
||||||
print("switchToTargetSettingBoxContainer", target_setting_box_container_attr_name)
|
|
||||||
config_window.main_current_active_config_title.configure(text=text)
|
config_window.main_current_active_config_title.configure(text=text)
|
||||||
target_active_tab_widget = getattr(config_window, target_active_tab_widget_attr_name)
|
target_active_tab_widget = getattr(config_window, target_active_tab_widget_attr_name)
|
||||||
switchSettingBoxContainerTabFunction(target_active_tab_widget)
|
switchSettingBoxContainerTabFunction(target_active_tab_widget)
|
||||||
switchSettingBoxContainer(target_setting_box_container_attr_name)
|
switchSettingBoxContainer(target_setting_box_container_attr_name)
|
||||||
|
callFunctionIfCallable(view_variable.CALLBACK_SELECTED_SETTING_BOX_TAB, target_active_tab_widget_attr_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
|||||||
{ "section_title": None, "setting_box": createSettingBox_Appearance },
|
{ "section_title": None, "setting_box": createSettingBox_Appearance },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"activate_by_default": True,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"side_menu_tab_attr_name": "side_menu_tab_translation",
|
"side_menu_tab_attr_name": "side_menu_tab_translation",
|
||||||
@@ -119,6 +118,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
|||||||
_addConfigSideMenuItem(
|
_addConfigSideMenuItem(
|
||||||
config_window=config_window,
|
config_window=config_window,
|
||||||
settings=settings,
|
settings=settings,
|
||||||
|
view_variable=view_variable,
|
||||||
# view_variable=view_variable,
|
# view_variable=view_variable,
|
||||||
side_menu_settings=sm_and_sbc_setting,
|
side_menu_settings=sm_and_sbc_setting,
|
||||||
side_menu_row=side_menu_row,
|
side_menu_row=side_menu_row,
|
||||||
@@ -136,7 +136,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if sm_and_sbc_setting.get("activate_by_default", None) is not None:
|
if sm_and_sbc_setting["side_menu_tab_attr_name"] == view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME:
|
||||||
# Set default active side menu tab
|
# Set default active side menu tab
|
||||||
config_window.main_current_active_config_title.configure(text=sm_and_sbc_setting["text"])
|
config_window.main_current_active_config_title.configure(text=sm_and_sbc_setting["text"])
|
||||||
config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"])
|
config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"])
|
||||||
|
|||||||
Reference in New Issue
Block a user