[Update] Speaker2Chatbox: config.pyのself._ENABLE_SPEAKER2CHATBOX True/Falseによって、Speaker2Chatbox機能の有効無効切り替え。

通常はFalse: 設定画面での項目もdisabled状態になります。
Trueの場合に設定項目が開放され、On/Offの設定を可能に。

※通常公開しない理由: 相手の発言をチャットボックスに表示できる(オウム返しのようになる)ため、迷惑目的での使用が想定でき、それをできるだけ防ぐためです。オープンソースとはいえ、ある程度抑制できると考えています。
使用者は開発者に直接相談し、config.pyのself._ENABLE_SPEAKER2CHATBOXがTrueなコードをビルドしたものを配布する予定です。
This commit is contained in:
Sakamoto Shiina
2023-12-30 19:41:19 +09:00
parent be049d9145
commit 6152f5e91a
8 changed files with 40 additions and 8 deletions

View File

@@ -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")

View File

@@ -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)

View File

@@ -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

View File

@@ -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()

View File

@@ -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}")

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,