🗑️[remove] Model : XSOverlay の機能を削除
This commit is contained in:
12
config.py
12
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):
|
||||
@@ -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)
|
||||
@@ -917,8 +913,7 @@ def callbackSetSendMessageButtonType(value):
|
||||
view.changeMainWindowSendMessageButton(config.SEND_MESSAGE_BUTTON_TYPE)
|
||||
|
||||
def callbackSetEnableNoticeXsoverlay(value):
|
||||
print("callbackSetEnableNoticeXsoverlay", value)
|
||||
config.ENABLE_NOTICE_XSOVERLAY = value
|
||||
pass
|
||||
|
||||
def callbackSetEnableAutoExportMessageLogs(value):
|
||||
print("callbackSetEnableAutoExportMessageLogs", value)
|
||||
|
||||
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")
|
||||
Reference in New Issue
Block a user