diff --git a/view.py b/view.py index 00c1bf96..5fa0b13f 100644 --- a/view.py +++ b/view.py @@ -100,6 +100,8 @@ class View(): # Config Window + ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_appearance", + CALLBACK_SELECTED_SETTING_BOX_TAB=None, # Appearance Tab VAR_LABEL_TRANSPARENCY=StringVar(value="Transparency"), VAR_DESC_TRANSPARENCY=StringVar(value="Change the window's transparency. 50% to 100%. (Default: 100%)"), @@ -244,6 +246,19 @@ class View(): VAR_MESSAGE_FORMAT=StringVar(value=config.MESSAGE_FORMAT), + VAR_LABEL_ENABLE_OSC=StringVar(value="Send Message To VRChat"), + VAR_DESC_ENABLE_OSC=StringVar(value="There is a way to use it without sending messages to VRChat."), + CALLBACK_SET_ENABLE_OSC=None, + VAR_ENABLE_OSC=BooleanVar(value=config.ENABLE_OSC), + + VAR_LABEL_ENABLE_OSC_ERROR_LOG=StringVar(value="Ignore The OSC Error Message"), + VAR_DESC_ENABLE_OSC_ERROR_LOG=StringVar(value="Remember to turn on OSC yourself when you want to use it and send messages to VRChat."), + CALLBACK_SET_ENABLE_OSC_ERROR_LOG=None, + VAR_ENABLE_OSC_ERROR_LOG=BooleanVar(value=config.ENABLE_OSC_ERROR_LOG), + + + + # Advanced Settings Tab VAR_LABEL_OSC_IP_ADDRESS=StringVar(value="OSC IP Address"), VAR_DESC_OSC_IP_ADDRESS=StringVar(value="(Default: 127.0.0.1)"), @@ -309,6 +324,8 @@ class View(): # Config Window + self.view_variable.CALLBACK_SELECTED_SETTING_BOX_TAB=self._updateActiveSettingBoxTabNo + # Compact Mode Switch if config_window_registers is not None: @@ -508,6 +525,9 @@ class View(): # 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 def setWidgetsStatus_ConfigWindowCompactModeSwitch_Disabled(): vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="disabled") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_addConfigSideMenuItem.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_addConfigSideMenuItem.py index cb2f79b2..22e9d372 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_addConfigSideMenuItem.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_addConfigSideMenuItem.py @@ -2,9 +2,10 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel 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): @@ -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): - print("switchToTargetSettingBoxContainer", target_setting_box_container_attr_name) config_window.main_current_active_config_title.configure(text=text) target_active_tab_widget = getattr(config_window, target_active_tab_widget_attr_name) switchSettingBoxContainerTabFunction(target_active_tab_widget) switchSettingBoxContainer(target_setting_box_container_attr_name) + callFunctionIfCallable(view_variable.CALLBACK_SELECTED_SETTING_BOX_TAB, target_active_tab_widget_attr_name) + diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index 32c1156e..390220d4 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -59,7 +59,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl { "section_title": None, "setting_box": createSettingBox_Appearance }, ] }, - "activate_by_default": True, }, { "side_menu_tab_attr_name": "side_menu_tab_translation", @@ -119,6 +118,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl _addConfigSideMenuItem( config_window=config_window, settings=settings, + view_variable=view_variable, # view_variable=view_variable, side_menu_settings=sm_and_sbc_setting, 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 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"]) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index 311fbbbd..ad39496b 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -18,6 +18,12 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v def checkbox_auto_export_message_logs_callback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS, checkbox_box_widget.get()) + def checkbox_enable_osc_callback(checkbox_box_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OSC, checkbox_box_widget.get()) + + def checkbox_enable_osc_error_log_callback(checkbox_box_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OSC_ERROR_LOG, checkbox_box_widget.get()) + def entry_message_format_callback(value): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, value) @@ -69,4 +75,27 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v entry_textvariable=view_variable.VAR_MESSAGE_FORMAT, ) config_window.sb__message_format.grid(row=row) + row+=1 + + + config_window.sb__enable_osc = createSettingBoxCheckbox( + parent_widget=setting_box_wrapper, + for_var_label_text=view_variable.VAR_LABEL_ENABLE_OSC, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_OSC, + checkbox_attr_name="sb__checkbox_enable_osc", + command=lambda: checkbox_enable_osc_callback(config_window.sb__checkbox_enable_osc), + variable=view_variable.VAR_ENABLE_OSC, + ) + config_window.sb__enable_osc.grid(row=row) + row+=1 + + config_window.sb__enable_osc_error_log = createSettingBoxCheckbox( + parent_widget=setting_box_wrapper, + for_var_label_text=view_variable.VAR_LABEL_ENABLE_OSC_ERROR_LOG, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_OSC_ERROR_LOG, + checkbox_attr_name="sb__checkbox_enable_osc_error_log", + command=lambda: checkbox_enable_osc_error_log_callback(config_window.sb__checkbox_enable_osc_error_log), + variable=view_variable.VAR_ENABLE_OSC_ERROR_LOG, + ) + config_window.sb__enable_osc_error_log.grid(row=row) row+=1 \ No newline at end of file