Merge branch 'develop'
This commit is contained in:
14
config.py
14
config.py
@@ -769,17 +769,6 @@ class Config:
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('ENABLE_NOTICE_XSOVERLAY')
|
||||
def ENABLE_NOTICE_XSOVERLAY(self):
|
||||
return self._ENABLE_NOTICE_XSOVERLAY
|
||||
|
||||
@ENABLE_NOTICE_XSOVERLAY.setter
|
||||
def ENABLE_NOTICE_XSOVERLAY(self, value):
|
||||
if isinstance(value, bool):
|
||||
self._ENABLE_NOTICE_XSOVERLAY = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('OVERLAY_SETTINGS')
|
||||
def OVERLAY_SETTINGS(self):
|
||||
@@ -960,7 +949,7 @@ class Config:
|
||||
|
||||
def init_config(self):
|
||||
# Read Only
|
||||
self._VERSION = "2.2.6"
|
||||
self._VERSION = "2.2.7"
|
||||
self._ENABLE_SPEAKER2CHATBOX = False # Speaker2Chatbox
|
||||
self._ENABLE_SPEAKER2CHATBOX_PASS_CONFIRMATION = "VRCT=0YEN"
|
||||
self._PATH_LOCAL = os_path.dirname(sys.argv[0])
|
||||
@@ -1113,7 +1102,6 @@ class Config:
|
||||
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True
|
||||
self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = "show"
|
||||
self._ENABLE_NOTICE_XSOVERLAY = False
|
||||
self._OVERLAY_SETTINGS = {
|
||||
"opacity": 1.0,
|
||||
"ui_scaling": 1.0,
|
||||
|
||||
@@ -158,10 +158,6 @@ def receiveSpeakerMessage(message):
|
||||
changeToCTranslate2Process()
|
||||
|
||||
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||
if config.ENABLE_NOTICE_XSOVERLAY is True:
|
||||
xsoverlay_message = messageFormatter("RECEIVED", translation, message)
|
||||
model.notificationXSOverlay(xsoverlay_message)
|
||||
|
||||
if config.ENABLE_OVERLAY_SMALL_LOG is True:
|
||||
if model.overlay.initialized is True:
|
||||
overlay_image = model.createOverlayImageShort(message, translation)
|
||||
@@ -916,10 +912,6 @@ def callbackSetSendMessageButtonType(value):
|
||||
config.SEND_MESSAGE_BUTTON_TYPE = value
|
||||
view.changeMainWindowSendMessageButton(config.SEND_MESSAGE_BUTTON_TYPE)
|
||||
|
||||
def callbackSetEnableNoticeXsoverlay(value):
|
||||
print("callbackSetEnableNoticeXsoverlay", value)
|
||||
config.ENABLE_NOTICE_XSOVERLAY = value
|
||||
|
||||
def callbackSetEnableAutoExportMessageLogs(value):
|
||||
print("callbackSetEnableAutoExportMessageLogs", value)
|
||||
config.ENABLE_LOGGER = value
|
||||
@@ -1167,7 +1159,6 @@ def createMainWindow(splash):
|
||||
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
|
||||
"callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages,
|
||||
"callback_set_send_message_button_type": callbackSetSendMessageButtonType,
|
||||
"callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay,
|
||||
"callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs,
|
||||
"callback_set_enable_vrc_mic_mute_sync": callbackSetEnableVrcMicMuteSync,
|
||||
"callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc,
|
||||
|
||||
4
model.py
4
model.py
@@ -21,7 +21,6 @@ from models.osc.osc_tools import sendTyping, sendMessage, receiveOscParameters,
|
||||
from models.transcription.transcription_recorder import SelectedMicEnergyAndAudioRecorder, SelectedSpeakerEnergyAndAudioRecorder
|
||||
from models.transcription.transcription_recorder import SelectedMicEnergyRecorder, SelectedSpeakerEnergyRecorder
|
||||
from models.transcription.transcription_transcriber import AudioTranscriber
|
||||
from models.xsoverlay.notification import xsoverlayForVRCT
|
||||
from models.translation.translation_languages import translation_lang
|
||||
from models.transcription.transcription_languages import transcription_lang
|
||||
from models.translation.translation_utils import checkCTranslate2Weight
|
||||
@@ -671,9 +670,6 @@ class Model:
|
||||
self.speaker_energy_recorder.stop()
|
||||
self.speaker_energy_recorder = None
|
||||
|
||||
def notificationXSOverlay(self, message):
|
||||
xsoverlayForVRCT(content=f"{message}")
|
||||
|
||||
def createOverlayImageShort(self, message, translation):
|
||||
your_language = config.TARGET_LANGUAGE
|
||||
target_language = config.SOURCE_LANGUAGE
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
# ###########################################################################################################################
|
||||
# DOCUMENT:https://xiexe.github.io/XSOverlayDocumentation/#/NotificationsAPI
|
||||
# SOURCE:https://zenn.dev/eeharumt/scraps/95f49a62dd809a
|
||||
# messageType: int = 0 # 1: ポップアップ通知, 2: メディアプレーヤー情報
|
||||
# index: int = 0 # メディアプレーヤーでのみ使用され、手首のアイコンを変更する
|
||||
# timeout: float = 0.5 # 通知インジケータが表示され続ける時間[秒]
|
||||
# height: float = 175 # 通知インジケータの高さ
|
||||
# opacity: float = 1 # 通知インジケータの透明度。0.0-1.0の範囲で低いほど透明に
|
||||
# volume: float = 0.7 # 通知音の大きさ
|
||||
# audioPath: str = "" # 通知音ファイルのパス。規定音として"default", "error", "warning"を指定可能。空文字列で通知音なしにできる。
|
||||
# title: str = "" # 通知タイトル、リッチテキストフォーマットをサポート。
|
||||
# content: str = "" # 通知内容、リッチテキストフォーマットをサポート。省略することで小サイズ通知となる。
|
||||
# useBase64Icon: bool = False # TrueにすることでBase64の画像を表示する
|
||||
# icon: str = "" # Base64画像イメージまたは画像ファイルパス。規定アイコンとして"default", "error", or "warning"を指定可能
|
||||
# sourceApp: str = "" # 通知したアプリ名(デバック用)
|
||||
# ##########################################################################################################################
|
||||
|
||||
import socket
|
||||
import json
|
||||
import base64
|
||||
from os import path as os_path
|
||||
|
||||
def XSOverlay(
|
||||
endpoint:tuple=("127.0.0.1", 42069), messageType:int=1, index:int=0, timeout:float=2,
|
||||
height:float=120.0, opacity:float=1.0, volume:float=0.0, audioPath:str="",
|
||||
title:str="", content:str="", useBase64Icon:bool=False, icon:str="default", sourceApp:str=""
|
||||
) -> int:
|
||||
|
||||
if icon in ["default", "error", "warning"]:
|
||||
icon_data = icon
|
||||
elif useBase64Icon:
|
||||
try:
|
||||
with open(icon, "rb") as f:
|
||||
icon_data_bytes = f.read()
|
||||
icon_data = base64.b64encode(icon_data_bytes).decode("utf-8")
|
||||
except Exception:
|
||||
icon_data = "default"
|
||||
else:
|
||||
icon_data = icon
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
|
||||
data_msg = {
|
||||
"messageType": messageType,
|
||||
"index": index,
|
||||
"timeout":timeout,
|
||||
"height": height,
|
||||
"opacity": opacity,
|
||||
"volume": volume,
|
||||
"audioPath": audioPath,
|
||||
"title": title,
|
||||
"content": content,
|
||||
"useBase64Icon": useBase64Icon,
|
||||
"icon": icon_data,
|
||||
"sourceApp": sourceApp,
|
||||
}
|
||||
msg_str = json.dumps(data_msg)
|
||||
response = sock.sendto(msg_str.encode("utf-8"), endpoint)
|
||||
sock.close()
|
||||
return response
|
||||
|
||||
def xsoverlayForVRCT(content:str="") -> int:
|
||||
response = XSOverlay(
|
||||
title="VRCT",
|
||||
content=content,
|
||||
useBase64Icon=True,
|
||||
icon=os_path.join(os_path.dirname(__file__), "img", "xsoverlay2.png"),
|
||||
sourceApp="VRCT"
|
||||
)
|
||||
return response
|
||||
|
||||
if __name__ == "__main__":
|
||||
xsoverlayForVRCT(content="notification test")
|
||||
@@ -8,12 +8,15 @@ pyyaml == 6.0.1
|
||||
python-i18n == 0.3.9
|
||||
CTkToolTip == 0.8
|
||||
pyinstaller==6.2.0
|
||||
transformers[torch]==4.37.2
|
||||
numpy==1.26.4
|
||||
torch==2.2.2
|
||||
transformers==4.37.2
|
||||
sentencepiece==0.1.99
|
||||
ctranslate2==4.1.0
|
||||
faster-whisper==1.0.1
|
||||
faster-whisper==1.0.3
|
||||
openvr==1.26.701
|
||||
pydub==0.25.1
|
||||
translators @ git+https://github.com/misyaguziya/translators@5.9.2
|
||||
psutil==5.9.8
|
||||
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
|
||||
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4
|
||||
tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.2
|
||||
6
view.py
6
view.py
@@ -539,11 +539,6 @@ class View():
|
||||
"show_and_disable_enter_key": StringVar(value=i18n.t("config_window.send_message_button_type.show_and_disable_enter_key")),
|
||||
},
|
||||
|
||||
VAR_LABEL_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.label")),
|
||||
VAR_DESC_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.desc")),
|
||||
CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=None,
|
||||
VAR_ENABLE_NOTICE_XSOVERLAY=BooleanVar(value=config.ENABLE_NOTICE_XSOVERLAY),
|
||||
|
||||
VAR_LABEL_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=StringVar(value=i18n.t("config_window.auto_export_message_logs.label")),
|
||||
VAR_DESC_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=StringVar(value=i18n.t("config_window.auto_export_message_logs.desc")),
|
||||
CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=None,
|
||||
@@ -804,7 +799,6 @@ class View():
|
||||
self.view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX=config_window_registers.get("callback_set_enable_auto_clear_chatbox", None)
|
||||
self.view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES=config_window_registers.get("callback_set_send_only_translated_messages", None)
|
||||
self.view_variable.CALLBACK_SET_SEND_MESSAGE_BUTTON_TYPE=config_window_registers.get("callback_set_send_message_button_type", None)
|
||||
self.view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=config_window_registers.get("callback_set_enable_notice_xsoverlay", None)
|
||||
self.view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=config_window_registers.get("callback_set_enable_auto_export_message_logs", None)
|
||||
|
||||
self.view_variable.CALLBACK_SET_ENABLE_VRC_MIC_MUTE_SYNC=config_window_registers.get("callback_set_enable_vrc_mic_mute_sync", None)
|
||||
|
||||
@@ -5,7 +5,6 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
def createSettingBox_Vr(setting_box_wrapper, config_window, settings, view_variable):
|
||||
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
|
||||
createSettingBox_Overlay = sbg.createSettingBox_Overlay
|
||||
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
|
||||
|
||||
def switchEnableOverlayUiCallback(switch_widget):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG, switch_widget.get())
|
||||
@@ -14,10 +13,6 @@ def createSettingBox_Vr(setting_box_wrapper, config_window, settings, view_varia
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW)
|
||||
|
||||
|
||||
def checkboxNoticeXsoverlayCallback(checkbox_box_widget):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get())
|
||||
|
||||
|
||||
row=0
|
||||
config_window.sb__enable_overlay_small_log = createSettingBox_Overlay(
|
||||
for_var_label_text=view_variable.VAR_LABEL_ENABLE_OVERLAY_SMALL_LOG,
|
||||
@@ -28,16 +23,4 @@ def createSettingBox_Vr(setting_box_wrapper, config_window, settings, view_varia
|
||||
for_var_button_label=view_variable.VAR_OPEN_OVERLAY_SETTINGS_BUTTON,
|
||||
label_button_clicked_command=buttonOpenOverlaySettingsWindow,
|
||||
)
|
||||
config_window.sb__enable_overlay_small_log.grid(row=row)
|
||||
row+=1
|
||||
|
||||
|
||||
config_window.sb__notice_xsoverlay = createSettingBoxCheckbox(
|
||||
for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY,
|
||||
for_var_desc_text=view_variable.VAR_DESC_ENABLE_NOTICE_XSOVERLAY,
|
||||
checkbox_attr_name="sb__checkbox_notice_xsoverlay",
|
||||
command=lambda: checkboxNoticeXsoverlayCallback(config_window.sb__checkbox_notice_xsoverlay),
|
||||
variable=view_variable.VAR_ENABLE_NOTICE_XSOVERLAY,
|
||||
)
|
||||
config_window.sb__notice_xsoverlay.grid(row=row, pady=0)
|
||||
row+=1
|
||||
config_window.sb__enable_overlay_small_log.grid(row=row, pady=0)
|
||||
Reference in New Issue
Block a user