From 4b61178b0edf2ed63a7f7a9eae03af57fe7f1dfe Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:23:02 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Main/Controller?= =?UTF-8?q?/Model/Config=20:=20VRC=20ChatBox=E3=81=AE=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=9F=B3=E3=81=AEON/OFF=E3=81=AE=E3=82=A8=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=83=9D=E3=82=A4=E3=83=B3=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/config.py | 12 ++++++++++++ src-python/controller.py | 14 ++++++++++++++ src-python/mainloop.py | 4 ++++ src-python/model.py | 4 ++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src-python/config.py b/src-python/config.py index 6b8433d1..db67aab4 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -931,6 +931,17 @@ class Config: self._VRC_MIC_MUTE_SYNC = value self.saveConfig(inspect.currentframe().f_code.co_name, value) + @property + @json_serializable('NOTIFICATION_VRC_SFX') + def NOTIFICATION_VRC_SFX(self): + return self._NOTIFICATION_VRC_SFX + + @NOTIFICATION_VRC_SFX.setter + def NOTIFICATION_VRC_SFX(self, value): + if isinstance(value, bool): + self._NOTIFICATION_VRC_SFX = value + self.saveConfig(inspect.currentframe().f_code.co_name, value) + def init_config(self): # Read Only self._VERSION = "3.0.2" @@ -1114,6 +1125,7 @@ class Config: self._SEND_RECEIVED_MESSAGE_TO_VRC = False self._LOGGER_FEATURE = False self._VRC_MIC_MUTE_SYNC = False + self._NOTIFICATION_VRC_SFX = True def load_config(self): if os_path.isfile(self.PATH_CONFIG) is not False: diff --git a/src-python/controller.py b/src-python/controller.py index bd193ff0..bb94bf26 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -1099,6 +1099,20 @@ class Controller: model.setOscPort(config.OSC_PORT) return {"status":200, "result":config.OSC_PORT} + @staticmethod + def getNotificationVrcSfx(*args, **kwargs) -> dict: + return {"status":200, "result":config.NOTIFICATION_VRC_SFX} + + @staticmethod + def setEnableNotificationVrcSfx(*args, **kwargs) -> dict: + config.NOTIFICATION_VRC_SFX = True + return {"status":200, "result":config.NOTIFICATION_VRC_SFX} + + @staticmethod + def setDisableNotificationVrcSfx(*args, **kwargs) -> dict: + config.NOTIFICATION_VRC_SFX = False + return {"status":200, "result":config.NOTIFICATION_VRC_SFX} + @staticmethod def getDeepLAuthKey(*args, **kwargs) -> dict: return {"status":200, "result":config.AUTH_KEYS["DeepL_API"]} diff --git a/src-python/mainloop.py b/src-python/mainloop.py index e2dabbfc..cd50a503 100644 --- a/src-python/mainloop.py +++ b/src-python/mainloop.py @@ -295,6 +295,10 @@ mapping = { "/get/data/osc_port": {"status": True, "variable":controller.getOscPort}, "/set/data/osc_port": {"status": True, "variable":controller.setOscPort}, + "/get/data/notification_vrc_sfx": {"status": True, "variable":controller.getNotificationVrcSfx}, + "/set/enable/notification_vrc_sfx": {"status": True, "variable":controller.setEnableNotificationVrcSfx}, + "/set/disable/notification_vrc_sfx": {"status": True, "variable":controller.setDisableNotificationVrcSfx}, + "/run/open_filepath_config_file": {"status": True, "variable":controller.openFilepathConfigFile}, # "/run/start_watchdog": {"status": True, "variable":controller.startWatchdog}, diff --git a/src-python/model.py b/src-python/model.py index b6a416b4..f393314d 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -289,8 +289,8 @@ class Model: def oscStopSendTyping(self): self.osc_handler.sendTyping(flag=False) - def oscSendMessage(self, message, notification=True): - self.osc_handler.sendMessage(message=message, notification=notification) + def oscSendMessage(self, message:str): + self.osc_handler.sendMessage(message=message, notification=config.NOTIFICATION_VRC_SFX) def getMuteSelfStatus(self): return self.osc_handler.getOSCParameterMuteSelf()