From 5a95fccd3754db8bb8532fbcc4cecf3f79c1124e Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:37:26 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Update]=20Config=20Window:=20=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=81=AE=E9=81=B8=E6=8A=9E=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=9F=E3=82=BF=E3=83=96=E6=83=85=E5=A0=B1=E3=82=92?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E3=80=82=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E9=96=8B=E9=96=89=E3=80=81=E3=82=B3=E3=83=B3=E3=83=91=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=83=A2=E3=83=BC=E3=83=89=E5=88=87=E3=82=8A=E6=9B=BF?= =?UTF-8?q?=E3=81=88=E6=99=82=E3=81=A7=E3=82=82=E5=89=8D=E5=9B=9E=E9=96=8B?= =?UTF-8?q?=E3=81=84=E3=81=A6=E3=81=84=E3=81=9F=E3=82=BF=E3=83=96=E3=81=8C?= =?UTF-8?q?=E9=81=B8=E6=8A=9E=E3=81=95=E3=82=8C=E3=81=9F=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB(VRCT=E5=86=8D=E8=B5=B7=E5=8B=95=E3=81=A7?= =?UTF-8?q?=E5=88=9D=E6=9C=9F=E8=A1=A8=E7=A4=BA=E3=82=BF=E3=83=96=E3=81=B8?= =?UTF-8?q?=E3=81=A8=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 7 +++++++ .../_addConfigSideMenuItem.py | 6 ++++-- .../createSideMenuAndSettingsBoxContainers.py | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/view.py b/view.py index 00c1bf96..a5553f61 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%)"), @@ -309,6 +311,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 +512,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"]) From 5f0cca062d7906a038f839af383a25051f0c16c7 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 16 Sep 2023 20:34:25 +0900 Subject: [PATCH 2/2] [Update] Config Window: Add chackboxes ENABLE_OSC and ENABLE_OSC_ERROR_LOG to setting box. --- view.py | 13 +++++++++ .../createSettingBox_Others.py | 29 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/view.py b/view.py index a5553f61..5fa0b13f 100644 --- a/view.py +++ b/view.py @@ -246,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)"), 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