diff --git a/config.py b/config.py index 8c3398ef..d4231f91 100644 --- a/config.py +++ b/config.py @@ -39,6 +39,10 @@ class Config: def VERSION(self): return self._VERSION + @property + def ENABLE_SPEAKER2CHATBOX(self): + return self._ENABLE_SPEAKER2CHATBOX + @property def LOCAL_PATH(self): return self._LOCAL_PATH @@ -589,7 +593,10 @@ class Config: @ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC.setter def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self, value): if isinstance(value, bool): - self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value + if self._ENABLE_SPEAKER2CHATBOX is True: + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value + else: + self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) # Speaker2Chatbox------------------ @@ -620,6 +627,7 @@ class Config: def init_config(self): # Read Only self._VERSION = "2.0.1" + self._ENABLE_SPEAKER2CHATBOX = False self._LOCAL_PATH = os_path.dirname(sys.argv[0]) self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs") diff --git a/controller.py b/controller.py index 0f505099..fe6db61a 100644 --- a/controller.py +++ b/controller.py @@ -133,11 +133,12 @@ def receiveSpeakerMessage(message): model.notificationXSOverlay(xsoverlay_message) # ------------Speaker2Chatbox------------ - # send OSC message - if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: - osc_message = messageFormatter("RECEIVED", translation, message) - model.oscSendMessage(osc_message) - # ------------Speaker2Chatbox------------ + if config.ENABLE_SPEAKER2CHATBOX is True: + # send OSC message + if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: + osc_message = messageFormatter("RECEIVED", translation, message) + model.oscSendMessage(osc_message) + # ------------Speaker2Chatbox------------ # update textbox message log (Received) view.printToTextbox_ReceivedMessage(message, translation) diff --git a/locales/en.yml b/locales/en.yml index fd159673..e90f49a0 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -225,6 +225,7 @@ config_window: # Speaker2Chatbox send_received_message_to_vrc: label: Send Received Message To VRChat + desc: Send the message you received from the speaker's sound to VRChat's chatbox. However, this feature is intended for users who genuinely need it. Please consult with the developer. # Speaker2Chatbox diff --git a/view.py b/view.py index 712821e7..a169d0a5 100644 --- a/view.py +++ b/view.py @@ -616,6 +616,13 @@ class View(): ) self.replaceMicThresholdCheckButton_Disabled() + if config.ENABLE_SPEAKER2CHATBOX is False: + vrct_gui._changeConfigWindowWidgetsStatus( + status="disabled", + target_names=[ + "sb__checkbox_enable_send_received_message_to_vrc", + ] + ) if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True: self.closeMicEnergyThresholdWidget() diff --git a/vrct_gui/_changeConfigWindowWidgetsStatus.py b/vrct_gui/_changeConfigWindowWidgetsStatus.py index 95ebb187..b9b0f9d8 100644 --- a/vrct_gui/_changeConfigWindowWidgetsStatus.py +++ b/vrct_gui/_changeConfigWindowWidgetsStatus.py @@ -5,10 +5,13 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta # target_names = [] - def disableOptionmenuWidget(target_widget): + def disableLabelsWidgets(target_widget): target_widget.label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) if target_widget.desc_widget is not None: target_widget.desc_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) + + def disableOptionmenuWidget(target_widget): + disableLabelsWidgets(target_widget) target_widget.optionmenu_label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR) target_widget.optionmenu_img_widget.configure(image=CTkImage(settings.image_file.ARROW_LEFT_DISABLED.rotate(90), size=settings.uism.SB__OPTIONMENU_IMG_SIZE)) target_widget.optionmenu_box.unbindFunction() @@ -32,6 +35,16 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta target_widget = config_window.sb__widgets["sb__optionmenu_appearance_theme"] disableOptionmenuWidget(target_widget) + + case "sb__checkbox_enable_send_received_message_to_vrc": + if status == "disabled": + target_widget = config_window.sb__widgets["sb__checkbox_enable_send_received_message_to_vrc"] + disableLabelsWidgets(target_widget) + config_window.sb__checkbox_enable_send_received_message_to_vrc.configure( + state="disabled", + border_color=settings.ctm.SB__CHECKBOX_BORDER_DISABLED_COLOR + ) + case _: raise ValueError(f"No matching case for target_name: {target_name}") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py index 53551128..b7f39f91 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others_Additional.py @@ -13,7 +13,7 @@ def createSettingBox_Others_Additional(setting_box_wrapper, config_window, setti row=0 config_window.sb__enable_send_received_message_to_vrc = createSettingBoxCheckbox( for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, - # for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, checkbox_attr_name="sb__checkbox_enable_send_received_message_to_vrc", command=lambda: checkbox_enable_send_received_message_to_vrc_callback(config_window.sb__checkbox_enable_send_received_message_to_vrc), variable=view_variable.VAR_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, diff --git a/vrct_gui/ui_managers/Themes/_darkTheme.py b/vrct_gui/ui_managers/Themes/_darkTheme.py index ed3c7cd8..93c81365 100644 --- a/vrct_gui/ui_managers/Themes/_darkTheme.py +++ b/vrct_gui/ui_managers/Themes/_darkTheme.py @@ -211,6 +211,7 @@ def _darkTheme(base_color): SB__SWITCH_BOX_BUTTON_HOVERED_COLOR = base_color.DARK_350_COLOR, SB__CHECKBOX_BORDER_COLOR = base_color.DARK_600_COLOR, + SB__CHECKBOX_BORDER_DISABLED_COLOR = base_color.DARK_800_COLOR, SB__CHECKBOX_HOVER_COLOR = base_color.DARK_800_COLOR, SB__CHECKBOX_CHECKED_COLOR = base_color.PRIMARY_700_COLOR, SB__CHECKBOX_CHECKMARK_COLOR = base_color.DARK_BASIC_TEXT_COLOR, diff --git a/vrct_gui/ui_managers/Themes/_lightTheme.py b/vrct_gui/ui_managers/Themes/_lightTheme.py index 95accf92..96c11238 100644 --- a/vrct_gui/ui_managers/Themes/_lightTheme.py +++ b/vrct_gui/ui_managers/Themes/_lightTheme.py @@ -204,6 +204,7 @@ def _lightTheme(base_color): SB__SWITCH_BOX_BUTTON_HOVERED_COLOR = base_color.LIGHT_200_COLOR, SB__CHECKBOX_BORDER_COLOR = base_color.LIGHT_600_COLOR, + SB__CHECKBOX_BORDER_DISABLED_COLOR = base_color.LIGHT_300_COLOR, SB__CHECKBOX_HOVER_COLOR = base_color.LIGHT_350_COLOR, SB__CHECKBOX_CHECKED_COLOR = base_color.PRIMARY_250_COLOR, SB__CHECKBOX_CHECKMARK_COLOR = base_color.LIGHT_BASIC_TEXT_COLOR,