From 6152f5e91a19be10eb220f4484754d3f72759d6d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 30 Dec 2023 19:41:19 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20Speaker2Chatbox:=20config.py?= =?UTF-8?q?=E3=81=AEself.=5FENABLE=5FSPEAKER2CHATBOX=20True/False=E3=81=AB?= =?UTF-8?q?=E3=82=88=E3=81=A3=E3=81=A6=E3=80=81Speaker2Chatbox=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E3=81=AE=E6=9C=89=E5=8A=B9=E7=84=A1=E5=8A=B9=E5=88=87?= =?UTF-8?q?=E3=82=8A=E6=9B=BF=E3=81=88=E3=80=82=20=E9=80=9A=E5=B8=B8?= =?UTF-8?q?=E3=81=AFFalse:=20=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E9=A0=85=E7=9B=AE=E3=82=82disabled=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=8A=E3=81=BE=E3=81=99=E3=80=82=20True?= =?UTF-8?q?=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB=E8=A8=AD=E5=AE=9A=E9=A0=85?= =?UTF-8?q?=E7=9B=AE=E3=81=8C=E9=96=8B=E6=94=BE=E3=81=95=E3=82=8C=E3=80=81?= =?UTF-8?q?On/Off=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ※通常公開しない理由: 相手の発言をチャットボックスに表示できる(オウム返しのようになる)ため、迷惑目的での使用が想定でき、それをできるだけ防ぐためです。オープンソースとはいえ、ある程度抑制できると考えています。 使用者は開発者に直接相談し、config.pyのself._ENABLE_SPEAKER2CHATBOXがTrueなコードをビルドしたものを配布する予定です。 --- config.py | 10 +++++++++- controller.py | 11 ++++++----- locales/en.yml | 1 + view.py | 7 +++++++ vrct_gui/_changeConfigWindowWidgetsStatus.py | 15 ++++++++++++++- .../createSettingBox_Others_Additional.py | 2 +- vrct_gui/ui_managers/Themes/_darkTheme.py | 1 + vrct_gui/ui_managers/Themes/_lightTheme.py | 1 + 8 files changed, 40 insertions(+), 8 deletions(-) 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,