[Update/Refactor] Add Message Formats Features more. UIとしての設定項目追加と、config.jsonへの書き込みまで。

送信メッセージと、受信したメッセージを送信する際のメッセージフォーマット設定項目追加。また、翻訳付きとそうじゃない場合のメッセージフォーマット設定項目を追加。
それに伴いリファクタリングなど。
※config.jsonのMESSAGE_FORMAT項目は消えます。ユーザーが元々設定していたデータは今のところ引き継げない状態です。
This commit is contained in:
Sakamoto Shiina
2023-12-19 12:31:34 +09:00
parent 194ec9241c
commit f34abbe184
13 changed files with 584 additions and 221 deletions

View File

@@ -447,19 +447,6 @@ class Config:
self._AUTH_KEYS[key] = value self._AUTH_KEYS[key] = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.AUTH_KEYS) saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.AUTH_KEYS)
@property
@json_serializable('MESSAGE_FORMAT')
def MESSAGE_FORMAT(self):
return self._MESSAGE_FORMAT
@MESSAGE_FORMAT.setter
def MESSAGE_FORMAT(self, value):
if isinstance(value, str):
if isUniqueStrings(["[message]", "[translation]"], value) is False:
value = "[message]([translation])"
self._MESSAGE_FORMAT = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property @property
@json_serializable('ENABLE_AUTO_CLEAR_MESSAGE_BOX') @json_serializable('ENABLE_AUTO_CLEAR_MESSAGE_BOX')
def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self): def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self):
@@ -505,7 +492,32 @@ class Config:
# self._STARTUP_OSC_ENABLED_CHECK = value # self._STARTUP_OSC_ENABLED_CHECK = value
# saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
# Speaker2Chatbox------------------ @property
@json_serializable('SEND_MESSAGE_FORMAT')
def SEND_MESSAGE_FORMAT(self):
return self._SEND_MESSAGE_FORMAT
@SEND_MESSAGE_FORMAT.setter
def SEND_MESSAGE_FORMAT(self, value):
if isinstance(value, str):
if isUniqueStrings(["[message]"], value) is False:
value = "[message]"
self._SEND_MESSAGE_FORMAT = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('SEND_MESSAGE_FORMAT_WITH_T')
def SEND_MESSAGE_FORMAT_WITH_T(self):
return self._SEND_MESSAGE_FORMAT_WITH_T
@SEND_MESSAGE_FORMAT_WITH_T.setter
def SEND_MESSAGE_FORMAT_WITH_T(self, value):
if isinstance(value, str):
if isUniqueStrings(["[message]", "[translation]"], value) is False:
value = "[message]([translation])"
self._SEND_MESSAGE_FORMAT_WITH_T = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property @property
@json_serializable('RECEIVED_MESSAGE_FORMAT') @json_serializable('RECEIVED_MESSAGE_FORMAT')
def RECEIVED_MESSAGE_FORMAT(self): def RECEIVED_MESSAGE_FORMAT(self):
@@ -514,11 +526,27 @@ class Config:
@RECEIVED_MESSAGE_FORMAT.setter @RECEIVED_MESSAGE_FORMAT.setter
def RECEIVED_MESSAGE_FORMAT(self, value): def RECEIVED_MESSAGE_FORMAT(self, value):
if isinstance(value, str): if isinstance(value, str):
if isUniqueStrings(["[message]", "[translation]"], value) is False: if isUniqueStrings(["[message]"], value) is False:
value = "[message]([translation])" value = "[message]"
self._RECEIVED_MESSAGE_FORMAT = value self._RECEIVED_MESSAGE_FORMAT = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('RECEIVED_MESSAGE_FORMAT_WITH_T')
def RECEIVED_MESSAGE_FORMAT_WITH_T(self):
return self._RECEIVED_MESSAGE_FORMAT_WITH_T
@RECEIVED_MESSAGE_FORMAT_WITH_T.setter
def RECEIVED_MESSAGE_FORMAT_WITH_T(self, value):
if isinstance(value, str):
if isUniqueStrings(["[message]", "[translation]"], value) is False:
value = "[message]([translation])"
self._RECEIVED_MESSAGE_FORMAT_WITH_T = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
# Speaker2Chatbox------------------
@property @property
@json_serializable('ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC') @json_serializable('ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC')
def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self): def ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC(self):
@@ -529,7 +557,6 @@ class Config:
if isinstance(value, bool): if isinstance(value, bool):
self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
# Speaker2Chatbox------------------ # Speaker2Chatbox------------------
@@ -623,8 +650,10 @@ class Config:
"Bing": None, "Bing": None,
"Google": None, "Google": None,
} }
self._MESSAGE_FORMAT = "[message]([translation])" self._SEND_MESSAGE_FORMAT = "[message]"
self._RECEIVED_MESSAGE_FORMAT = "[message]([translation])" # speaker2Chatbox self._SEND_MESSAGE_FORMAT_WITH_T = "[message]([translation])"
self._RECEIVED_MESSAGE_FORMAT = "[message]"
self._RECEIVED_MESSAGE_FORMAT_WITH_T = "[message]([translation])"
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True
self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_NOTICE_XSOVERLAY = False
self._ENABLE_SEND_MESSAGE_TO_VRC = True self._ENABLE_SEND_MESSAGE_TO_VRC = True

View File

@@ -42,7 +42,7 @@ def sendMicMessage(message):
if config.ENABLE_TRANSCRIPTION_SEND is True: if config.ENABLE_TRANSCRIPTION_SEND is True:
if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
if len(translation) > 0: if len(translation) > 0:
osc_message = config.MESSAGE_FORMAT.replace("[message]", message) osc_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message)
osc_message = osc_message.replace("[translation]", translation) osc_message = osc_message.replace("[translation]", translation)
else: else:
osc_message = message osc_message = message
@@ -116,7 +116,7 @@ def receiveSpeakerMessage(message):
# send OSC message # send OSC message
if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True: if config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC is True:
if len(translation) > 0: if len(translation) > 0:
osc_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) osc_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message)
osc_message = osc_message.replace("[translation]", translation) osc_message = osc_message.replace("[translation]", translation)
else: else:
osc_message = message osc_message = message
@@ -662,16 +662,26 @@ def callbackSetEnableAutoExportMessageLogs(value):
else: else:
model.stopLogger() model.stopLogger()
def callbackSetMessageFormat(value): def callbackSetSendMessageFormat(value):
print("callbackSetMessageFormat", value) print("callbackSetSendMessageFormat", value)
if isUniqueStrings(["[message]"], value) is True:
config.SEND_MESSAGE_FORMAT = value
view.clearErrorMessage()
view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT)
else:
view.showErrorMessage_SendMessageFormat()
view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT)
def callbackSetSendMessageFormatWithT(value):
print("callbackSetSendMessageFormatWithT", value)
if len(value) > 0: if len(value) > 0:
if isUniqueStrings(["[message]", "[translation]"], value) is True: if isUniqueStrings(["[message]", "[translation]"], value) is True:
config.MESSAGE_FORMAT = value config.SEND_MESSAGE_FORMAT_WITH_T = value
view.clearErrorMessage() view.clearErrorMessage()
view.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T)
else: else:
view.showErrorMessage_MessageFormat() view.showErrorMessage_SendMessageFormatWithT()
view.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T)
def callbackSetEnableSendMessageToVrc(value): def callbackSetEnableSendMessageToVrc(value):
@@ -683,18 +693,31 @@ def callbackSetEnableSendMessageToVrc(value):
# print("callbackSetStartupOscEnabledCheck", value) # print("callbackSetStartupOscEnabledCheck", value)
# config.STARTUP_OSC_ENABLED_CHECK = value # config.STARTUP_OSC_ENABLED_CHECK = value
# ---------------------Speaker2Chatbox---------------------
def callbackSetReceivedMessageFormat(value): def callbackSetReceivedMessageFormat(value):
print("callbackSetReceivedMessageFormat", value) print("callbackSetReceivedMessageFormat", value)
if isUniqueStrings(["[message]"], value) is True:
config.RECEIVED_MESSAGE_FORMAT = value
view.clearErrorMessage()
view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT)
else:
view.showErrorMessage_ReceivedMessageFormat()
view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT)
def callbackSetReceivedMessageFormatWithT(value):
print("callbackSetReceivedMessageFormatWithT", value)
if len(value) > 0: if len(value) > 0:
if isUniqueStrings(["[message]", "[translation]"], value) is True: if isUniqueStrings(["[message]", "[translation]"], value) is True:
config.RECEIVED_MESSAGE_FORMAT = value config.RECEIVED_MESSAGE_FORMAT_WITH_T = value
view.clearErrorMessage() view.clearErrorMessage()
view.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T)
else: else:
view.showErrorMessage_ReceivedMessageFormat() view.showErrorMessage_ReceivedMessageFormatWithT()
view.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T)
# ---------------------Speaker2Chatbox---------------------
def callbackSetEnableSendReceivedMessageToVrc(value): def callbackSetEnableSendReceivedMessageToVrc(value):
print("callbackSetEnableSendReceivedMessageToVrc", value) print("callbackSetEnableSendReceivedMessageToVrc", value)
config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value config.ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = value
@@ -834,11 +857,14 @@ def createMainWindow():
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
"callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay,
"callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs,
"callback_set_message_format": callbackSetMessageFormat,
"callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc,
# "callback_set_startup_osc_enabled_check": callbackSetStartupOscEnabledCheck, # [deprecated] # "callback_set_startup_osc_enabled_check": callbackSetStartupOscEnabledCheck, # [deprecated]
# Speaker2Chatbox---------------- "callback_set_send_message_format": callbackSetSendMessageFormat,
"callback_set_send_message_format_with_t": callbackSetSendMessageFormatWithT,
"callback_set_received_message_format": callbackSetReceivedMessageFormat, "callback_set_received_message_format": callbackSetReceivedMessageFormat,
"callback_set_received_message_format_with_t": callbackSetReceivedMessageFormatWithT,
# Speaker2Chatbox----------------
"callback_set_enable_send_received_message_to_vrc": callbackSetEnableSendReceivedMessageToVrc, "callback_set_enable_send_received_message_to_vrc": callbackSetEnableSendReceivedMessageToVrc,
# Speaker2Chatbox---------------- # Speaker2Chatbox----------------

View File

@@ -82,6 +82,8 @@ config_window:
transcription_mic: Mic transcription_mic: Mic
transcription_speaker: Speaker transcription_speaker: Speaker
others: Others others: Others
others_send_message_formats: Message Formats(Send)
others_received_message_formats: Message Formats(Received)
others_speaker2chatbox: Speaker2Chatbox others_speaker2chatbox: Speaker2Chatbox
advanced_settings: Advanced Settings advanced_settings: Advanced Settings
@@ -180,25 +182,40 @@ config_window:
label: Auto Export Message Logs label: Auto Export Message Logs
desc: Automatically export the conversation messages as a text file. desc: Automatically export the conversation messages as a text file.
message_format:
label: Message Format
desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message.\nIt will be used in Notification XSOverlay too."
example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display.
error_message: "The characters '[message]' and '[translation]' cannot be used."
send_message_to_vrc: send_message_to_vrc:
label: Send Message To VRChat label: Send Message To VRChat
desc: There is a way to use it without sending messages to VRChat, but it is not supported. Enable this feature when you intend to send a message to VRChat. desc: There is a way to use it without sending messages to VRChat, but it is not supported. Enable this feature when you intend to send a message to VRChat.
# Speaker2Chatbox
received_message_format: send_message_format:
label: Message Format (Speaker2Chatbox) label: Message Format
desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message."
example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display.
error_message: "The characters '[message]' cannot be used."
send_message_format_with_t:
label: Message Format(With translation)
desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message."
example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display. example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display.
error_message: "The characters '[message]' and '[translation]' cannot be used." error_message: "The characters '[message]' and '[translation]' cannot be used."
received_message_format:
label: Message Format
desc: "You can change the decoration of the received message you want to send.\n[message] will be replaced with the message.\nIt will be used in Notification XSOverlay too."
example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display.
error_message: "The characters '[message]' cannot be used."
received_message_format_with_t:
label: Message Format(With translation)
desc: It will be used in Notification XSOverlay too.
example_text: This is an example sentence. Fonts, line breaks, etc. may differ from the actual display.
error_message: "The characters '[message]' and '[translation]' cannot be used."
# Speaker2Chatbox
send_received_message_to_vrc: send_received_message_to_vrc:
label: Send Received Message To VRChat label: Send Received Message To VRChat
# Speaker2Chatbox # Speaker2Chatbox
osc_ip_address: osc_ip_address:
label: OSC IP Address label: OSC IP Address

View File

@@ -178,16 +178,36 @@ config_window:
label: 会話ログを自動的に保存する label: 会話ログを自動的に保存する
desc: テキストファイルとしてログがlogsフォルダ内に保存されます。 desc: テキストファイルとしてログがlogsフォルダ内に保存されます。
message_format:
label: 送信するメッセージのフォーマット
desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、[translation]が翻訳されたメッセージに置換されます。\n※XSOverlayでの通知受け取り機能でも使われます。"
example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。
error_message: "[message]と[translation]という文字は使えません。"
send_message_to_vrc: send_message_to_vrc:
label: VRChatにメッセージを送信する label: VRChatにメッセージを送信する
desc: "サポート対象外ですが、VRChatにメッセージを送信せずに使う方法があります。送信したい場合、この機能を有効にする事を忘れないでください。" desc: "サポート対象外ですが、VRChatにメッセージを送信せずに使う方法があります。送信したい場合、この機能を有効にする事を忘れないでください。"
send_message_format:
label: 送信するメッセージのフォーマット
desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換されます。"
example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。
error_message: "[message]という文字は使えません。"
send_message_format_with_t:
label: 送信するメッセージのフォーマット(翻訳付き)
desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、[translation]が翻訳されたメッセージに置換されます。"
example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。
error_message: "[message]と[translation]という文字は使えません。"
received_message_format:
label: 送信するメッセージのフォーマット
desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換されます。\n※XSOverlayでの通知受け取り機能にも使われます。"
example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。
error_message: "[message]という文字は使えません。"
received_message_format_with_t:
label: 送信するメッセージのフォーマット(翻訳付き)
desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、[translation]が翻訳されたメッセージに置換されます。\n※XSOverlayでの通知受け取り機能にも使われます。"
example_text: これは例文です。フォントや改行箇所など、実際の表示とは異なる場合があります。
error_message: "[message]と[translation]という文字は使えません。"
osc_ip_address: osc_ip_address:
label: OSC IP Address label: OSC IP Address

View File

@@ -172,7 +172,7 @@ config_window:
# label: Auto Export Message Logs # label: Auto Export Message Logs
# desc: Automatically export the conversation messages as a text file. # desc: Automatically export the conversation messages as a text file.
message_format: send_message_format_with_t:
label: 전송 형식 label: 전송 형식
# desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message.\nIt will be used in Notification XSOverlay too." # desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message.\nIt will be used in Notification XSOverlay too."
example_text: 예문입니다. 글꼴, 줄 바꿈 등이 실제 표시와 다를 수 있습니다. example_text: 예문입니다. 글꼴, 줄 바꿈 등이 실제 표시와 다를 수 있습니다.

290
view.py
View File

@@ -345,20 +345,6 @@ class View():
VAR_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=BooleanVar(value=config.ENABLE_LOGGER), VAR_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=BooleanVar(value=config.ENABLE_LOGGER),
VAR_LABEL_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.message_format.label")),
VAR_DESC_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.message_format.desc")),
CALLBACK_SET_MESSAGE_FORMAT=None,
CALLBACK_SWAP_MESSAGE_FORMAT_REQUIRED_TEXT=self._swapMessageFormatRequiredText,
VAR_MESSAGE_FORMAT=StringVar(value=config.MESSAGE_FORMAT),
VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_0_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_1_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_2_MESSAGE_FORMAT=StringVar(value=""),
VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT=StringVar(value="[message]"),
VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT=StringVar(value="[translation]"),
CALLBACK_FOCUS_OUT_MESSAGE_FORMAT=self.callbackBindFocusOut_MessageFormat,
VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.label")), VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.label")),
VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.desc")), VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.desc")),
CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC=None, CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC=None,
@@ -372,25 +358,65 @@ class View():
VAR_SECOND_TITLE_OTHERS_SEND_MESSAGE_FORMATS=StringVar(value=i18n.t("config_window.side_menu_labels.others_send_message_formats")),
VAR_LABEL_SEND_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.send_message_format.label")),
VAR_DESC_SEND_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.send_message_format.desc")),
CALLBACK_SET_SEND_MESSAGE_FORMAT=None,
VAR_SEND_MESSAGE_FORMAT=StringVar(value=config.SEND_MESSAGE_FORMAT),
VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_0_SEND_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_1_SEND_MESSAGE_FORMAT=StringVar(value=""),
VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT=StringVar(value="[message]"),
CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT=self.callbackBindFocusOut_SendMessageFormat,
VAR_LABEL_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.send_message_format_with_t.label")),
VAR_DESC_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.send_message_format_with_t.desc")),
CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T=None,
CALLBACK_SWAP_SEND_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT=self._swapSendMessageFormatWithT_RequiredText,
VAR_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=config.SEND_MESSAGE_FORMAT_WITH_T),
VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value="[message]"),
VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T=StringVar(value="[translation]"),
CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT_WITH_T=self.callbackBindFocusOut_SendMessageFormatWithT,
# -------------------Speaker2Chatbox-----------
VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX=StringVar(value=i18n.t("config_window.side_menu_labels.others_speaker2chatbox")),
VAR_LABEL_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.label")), VAR_LABEL_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.label")),
VAR_DESC_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.desc")), VAR_DESC_RECEIVED_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.received_message_format.desc")),
CALLBACK_SET_RECEIVED_MESSAGE_FORMAT=None, CALLBACK_SET_RECEIVED_MESSAGE_FORMAT=None,
CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_REQUIRED_TEXT=self._swapReceivedMessageFormatRequiredText,
VAR_RECEIVED_MESSAGE_FORMAT=StringVar(value=config.RECEIVED_MESSAGE_FORMAT), VAR_RECEIVED_MESSAGE_FORMAT=StringVar(value=config.RECEIVED_MESSAGE_FORMAT),
VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT=StringVar(value=""), VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT=StringVar(value=""),
VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT=StringVar(value=""),
VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT=StringVar(value="[message]"), VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT=StringVar(value="[message]"),
VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT=StringVar(value="[translation]"),
CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT=self.callbackBindFocusOut_ReceivedMessageFormat, CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT=self.callbackBindFocusOut_ReceivedMessageFormat,
VAR_SECOND_TITLE_OTHERS_RECEIVED_MESSAGE_FORMATS=StringVar(value=i18n.t("config_window.side_menu_labels.others_received_message_formats")),
VAR_LABEL_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.received_message_format_with_t.label")),
VAR_DESC_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=i18n.t("config_window.received_message_format_with_t.desc")),
CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T=None,
CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT=self._swapReceivedMessageFormatWithT_RequiredText,
VAR_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=config.RECEIVED_MESSAGE_FORMAT_WITH_T),
VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value=""),
VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value="[message]"),
VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T=StringVar(value="[translation]"),
CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT_WITH_T=self.callbackBindFocusOut_ReceivedMessageFormatWithT,
# -------------------Speaker2Chatbox-----------
VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX=StringVar(value=i18n.t("config_window.side_menu_labels.others_speaker2chatbox")),
VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.label")), VAR_LABEL_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.label")),
VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.desc")), VAR_DESC_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_received_message_to_vrc.desc")),
CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=None, CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC=None,
@@ -522,15 +548,18 @@ 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_AUTO_CLEAR_MESSAGE_BOX = config_window_registers.get("callback_set_enable_auto_clear_chatbox", 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_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_AUTO_EXPORT_MESSAGE_LOGS = config_window_registers.get("callback_set_enable_auto_export_message_logs", None)
self.view_variable.CALLBACK_SET_MESSAGE_FORMAT = config_window_registers.get("callback_set_message_format", None)
self.view_variable.CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_message_to_vrc", None) self.view_variable.CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_message_to_vrc", None)
# self.view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK = config_window_registers.get("callback_set_startup_osc_enabled_check", None) #[deprecated] # self.view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK = config_window_registers.get("callback_set_startup_osc_enabled_check", None) #[deprecated]
self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT = config_window_registers.get("callback_set_send_message_format", None)
self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T = config_window_registers.get("callback_set_send_message_format_with_t", None)
self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT = config_window_registers.get("callback_set_received_message_format", None) self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT = config_window_registers.get("callback_set_received_message_format", None)
self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T = config_window_registers.get("callback_set_received_message_format_with_t", None)
# Speaker2Chatbox----------------
self.view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_received_message_to_vrc", None) self.view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = config_window_registers.get("callback_set_enable_send_received_message_to_vrc", None)
# Speaker2Chatbox----------------
@@ -572,104 +601,134 @@ class View():
self.openSpeakerEnergyThresholdWidget() self.openSpeakerEnergyThresholdWidget()
self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) self.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT)
self.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) self.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T)
self.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT)
self.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T)
# Insert sample conversation for testing. # Insert sample conversation for testing.
# self._insertSampleConversationToTextbox() # self._insertSampleConversationToTextbox()
# Send Message Format
def setMessageFormatEntryWidgets(self, message_format:str): def setSendMessageFormat_EntryWidgets(self, message_format:str):
result = self.extractMessageFormat(message_format) result = self.extractMessageFormat(message_format)
self.view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT.set(result.before)
self.view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT.set(result.after)
self.updateSendMessageFormat_ExampleTextWidget()
def updateSendMessageFormat_ExampleTextWidget(self):
message = i18n.t("config_window.send_message_format.example_text")
example_message = config.SEND_MESSAGE_FORMAT.replace("[message]", message)
self.view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT.set(example_message)
# Send Message Format With Translation
def setSendMessageFormatWithT_EntryWidgets(self, message_format:str):
result = self.extractMessageFormatWithT(message_format)
if result.is_message_first is True: if result.is_message_first is True:
self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.set("[message]") self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.set("[message]")
self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.set("[translation]") self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.set("[translation]")
else: else:
self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.set("[translation]") self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.set("[translation]")
self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.set("[message]") self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.set("[message]")
self.view_variable.VAR_ENTRY_0_MESSAGE_FORMAT.set(result.before) self.view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T.set(result.before)
self.view_variable.VAR_ENTRY_1_MESSAGE_FORMAT.set(result.between) self.view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T.set(result.between)
self.view_variable.VAR_ENTRY_2_MESSAGE_FORMAT.set(result.after) self.view_variable.VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T.set(result.after)
self.updateMessageFormat_ExampleTextWidget() self.updateSendMessageFormatWithT_ExampleTextWidget()
def _swapMessageFormatRequiredText(self): def _swapSendMessageFormatWithT_RequiredText(self):
text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.get() text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.get()
text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.get() text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.get()
self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.set(text_1) self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.set(text_1)
self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.set(text_0) self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.set(text_0)
self.updateMessageFormat_ExampleTextWidget() self.updateSendMessageFormatWithT_ExampleTextWidget()
new_message_format = self.getLatestMessageFormatFromWidget() new_message_format = self.getLatestMessageFormatWithT_FromWidget()
callFunctionIfCallable(self.view_variable.CALLBACK_SET_MESSAGE_FORMAT, new_message_format) callFunctionIfCallable(self.view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T, new_message_format)
def getLatestMessageFormatFromWidget(self): def getLatestMessageFormatWithT_FromWidget(self):
text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT.get() text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T.get()
text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT.get() text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T.get()
entry_0 = self.view_variable.VAR_ENTRY_0_MESSAGE_FORMAT.get() entry_0 = self.view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T.get()
entry_1 = self.view_variable.VAR_ENTRY_1_MESSAGE_FORMAT.get() entry_1 = self.view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T.get()
entry_2 = self.view_variable.VAR_ENTRY_2_MESSAGE_FORMAT.get() entry_2 = self.view_variable.VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T.get()
return entry_0+text_0+entry_1+text_1+entry_2 return entry_0+text_0+entry_1+text_1+entry_2
def updateMessageFormat_ExampleTextWidget(self): def updateSendMessageFormatWithT_ExampleTextWidget(self):
message = i18n.t("config_window.message_format.example_text", locale=config.UI_LANGUAGE) message = i18n.t("config_window.send_message_format_with_t.example_text", locale=config.UI_LANGUAGE)
translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en" translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en"
translation = i18n.t("config_window.message_format.example_text", locale=translation_locale) translation = i18n.t("config_window.send_message_format_with_t.example_text", locale=translation_locale)
example_message = config.MESSAGE_FORMAT.replace("[message]", message) example_message = config.SEND_MESSAGE_FORMAT_WITH_T.replace("[message]", message)
example_message = example_message.replace("[translation]", translation) example_message = example_message.replace("[translation]", translation)
self.view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT.set(example_message) self.view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT_WITH_T.set(example_message)
# Received Message Format
# Speaker2Chatbox---------------------------- def setReceivedMessageFormat_EntryWidgets(self, message_format:str):
def setReceivedMessageFormatEntryWidgets(self, message_format:str):
result = self.extractMessageFormat(message_format) result = self.extractMessageFormat(message_format)
if result.is_message_first is True:
self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set("[message]")
self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set("[translation]")
else:
self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set("[translation]")
self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set("[message]")
self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.set(result.before) self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.set(result.before)
self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.set(result.between) self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.set(result.after)
self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT.set(result.after)
self.updateReceivedMessageFormat_ExampleTextWidget() self.updateReceivedMessageFormat_ExampleTextWidget()
def _swapReceivedMessageFormatRequiredText(self):
text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.get()
text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.get()
self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.set(text_1)
self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.set(text_0)
self.updateReceivedMessageFormat_ExampleTextWidget()
new_message_format = self.getLatestReceivedMessageFormatFromWidget()
callFunctionIfCallable(self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, new_message_format)
def getLatestReceivedMessageFormatFromWidget(self):
text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT.get()
text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT.get()
entry_0 = self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT.get()
entry_1 = self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT.get()
entry_2 = self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT.get()
return entry_0+text_0+entry_1+text_1+entry_2
def updateReceivedMessageFormat_ExampleTextWidget(self): def updateReceivedMessageFormat_ExampleTextWidget(self):
message = i18n.t("config_window.message_format.example_text", locale=config.UI_LANGUAGE) message = i18n.t("config_window.received_message_format.example_text")
translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en"
translation = i18n.t("config_window.message_format.example_text", locale=translation_locale)
example_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message) example_message = config.RECEIVED_MESSAGE_FORMAT.replace("[message]", message)
example_message = example_message.replace("[translation]", translation)
self.view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT.set(example_message) self.view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT.set(example_message)
# Speaker2Chatbox----------------------------
# Received Message Format With Translation
def setReceivedMessageFormatWithT_EntryWidgets(self, message_format:str):
result = self.extractMessageFormatWithT(message_format)
if result.is_message_first is True:
self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[message]")
self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[translation]")
else:
self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[translation]")
self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set("[message]")
self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set(result.before)
self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set(result.between)
self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T.set(result.after)
self.updateReceivedMessageFormatWithT_ExampleTextWidget()
def _swapReceivedMessageFormatWithT_RequiredText(self):
text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.set(text_1)
self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.set(text_0)
self.updateReceivedMessageFormatWithT_ExampleTextWidget()
new_message_format = self.getLatestReceivedMessageFormatWithT_FromWidget()
callFunctionIfCallable(self.view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T, new_message_format)
def getLatestReceivedMessageFormatWithT_FromWidget(self):
text_0 = self.view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
text_1 = self.view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
entry_0 = self.view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
entry_1 = self.view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
entry_2 = self.view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T.get()
return entry_0+text_0+entry_1+text_1+entry_2
def updateReceivedMessageFormatWithT_ExampleTextWidget(self):
message = i18n.t("config_window.received_message_format_with_t.example_text", locale=config.UI_LANGUAGE)
translation_locale = "ja" if config.UI_LANGUAGE == "en" else "en"
translation = i18n.t("config_window.received_message_format_with_t.example_text", locale=translation_locale)
example_message = config.RECEIVED_MESSAGE_FORMAT_WITH_T.replace("[message]", message)
example_message = example_message.replace("[translation]", translation)
self.view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT_WITH_T.set(example_message)
@@ -1211,10 +1270,14 @@ class View():
case "SpeakerMaxPhrases": case "SpeakerMaxPhrases":
self.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES) self.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES)
case "MessageFormat": case "SendMessageFormat":
self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT) self.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT)
case "SendMessageFormatWithT":
self.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T)
case "ReceivedMessageFormat": case "ReceivedMessageFormat":
self.setReceivedMessageFormatEntryWidgets(config.RECEIVED_MESSAGE_FORMAT) self.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT)
case "ReceivedMessageFormatWithT":
self.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T)
case _: case _:
raise ValueError(f"No matching case for target_name: {target_name}") raise ValueError(f"No matching case for target_name: {target_name}")
@@ -1365,14 +1428,21 @@ class View():
self.clearErrorMessage() self.clearErrorMessage()
def callbackBindFocusOut_MessageFormat(self, _e=None): def callbackBindFocusOut_SendMessageFormat(self, _e=None):
self.setLatestConfigVariable("MessageFormat") self.setLatestConfigVariable("SendMessageFormat")
self.clearErrorMessage()
def callbackBindFocusOut_SendMessageFormatWithT(self, _e=None):
self.setLatestConfigVariable("SendMessageFormatWithT")
self.clearErrorMessage() self.clearErrorMessage()
def callbackBindFocusOut_ReceivedMessageFormat(self, _e=None): def callbackBindFocusOut_ReceivedMessageFormat(self, _e=None):
self.setLatestConfigVariable("ReceivedMessageFormat") self.setLatestConfigVariable("ReceivedMessageFormat")
self.clearErrorMessage() self.clearErrorMessage()
def callbackBindFocusOut_ReceivedMessageFormatWithT(self, _e=None):
self.setLatestConfigVariable("ReceivedMessageFormatWithT")
self.clearErrorMessage()
@@ -1454,16 +1524,28 @@ class View():
) )
def showErrorMessage_MessageFormat(self): def showErrorMessage_SendMessageFormat(self):
self._showErrorMessage( self._showErrorMessage(
vrct_gui.config_window.sb__entry_message_format_2, vrct_gui.config_window.sb__entry_send_message_format_1,
self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message")) self._makeInvalidValueErrorMessage(i18n.t("config_window.send_message_format.error_message"))
)
def showErrorMessage_SendMessageFormatWithT(self):
self._showErrorMessage(
vrct_gui.config_window.sb__entry_send_message_format_with_t_2,
self._makeInvalidValueErrorMessage(i18n.t("config_window.send_message_format_with_t.error_message"))
) )
def showErrorMessage_ReceivedMessageFormat(self): def showErrorMessage_ReceivedMessageFormat(self):
self._showErrorMessage( self._showErrorMessage(
vrct_gui.config_window.sb__entry_received_message_format_2, vrct_gui.config_window.sb__entry_received_message_format_1,
self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message")) self._makeInvalidValueErrorMessage(i18n.t("config_window.received_message_format.error_message"))
)
def showErrorMessage_ReceivedMessageFormatWithT(self):
self._showErrorMessage(
vrct_gui.config_window.sb__entry_received_message_format_with_t_2,
self._makeInvalidValueErrorMessage(i18n.t("config_window.received_message_format_with_t.error_message"))
) )
@@ -1475,9 +1557,17 @@ class View():
self.view_variable.VAR_ERROR_MESSAGE.set(message) self.view_variable.VAR_ERROR_MESSAGE.set(message)
vrct_gui._showErrorMessage(target_widget=target_widget) vrct_gui._showErrorMessage(target_widget=target_widget)
@staticmethod @staticmethod
def extractMessageFormat(text): def extractMessageFormat(text):
split_result = text.split("[message]")
result_data = SimpleNamespace(
before = split_result[0],
after = split_result[1],
)
return result_data
@staticmethod
def extractMessageFormatWithT(text):
import re import re
message_index = text.find("[message]") message_index = text.find("[message]")
translation_index = text.find("[translation]") translation_index = text.find("[translation]")

View File

@@ -8,7 +8,7 @@ from ._createSettingBoxContainer import _createSettingBoxContainer
from .setting_box_containers.setting_box_appearance import createSettingBox_Appearance from .setting_box_containers.setting_box_appearance import createSettingBox_Appearance
from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker
from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_Additional from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_SendMessageFormats, createSettingBox_Others_ReceivedMessageFormats, createSettingBox_Others_Additional
from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings
from .setting_box_containers.setting_box_translation import createSettingBox_Translation from .setting_box_containers.setting_box_translation import createSettingBox_Translation
@@ -106,6 +106,8 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
"setting_box_container_attr_name": "setting_box_container_others", "setting_box_container_attr_name": "setting_box_container_others",
"setting_boxes": [ "setting_boxes": [
{ "var_section_title": None, "setting_box": createSettingBox_Others }, { "var_section_title": None, "setting_box": createSettingBox_Others },
{ "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_SEND_MESSAGE_FORMATS, "setting_box": createSettingBox_Others_SendMessageFormats },
{ "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_RECEIVED_MESSAGE_FORMATS, "setting_box": createSettingBox_Others_ReceivedMessageFormats },
{ "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX, "setting_box": createSettingBox_Others_Additional }, { "var_section_title": view_variable.VAR_SECOND_TITLE_OTHERS_SPEAKER2CHATBOX, "setting_box": createSettingBox_Others_Additional },
] ]
}, },

View File

@@ -538,7 +538,7 @@ class _SettingBoxGenerator():
def createSettingBoxMessageFormatEntries(self, def createSettingBoxMessageFormatEntries_WithTranslation(self,
base_entry_attr_name, base_entry_attr_name,
entry_textvariable_0, entry_textvariable_0,
entry_textvariable_1, entry_textvariable_1,
@@ -736,6 +736,119 @@ class _SettingBoxGenerator():
def createSettingBoxMessageFormatEntries(self,
base_entry_attr_name,
entry_textvariable_0,
entry_textvariable_1,
textvariable_0,
example_label_textvariable,
entry_bind__Any_KeyRelease,
entry_bind__FocusOut=None,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(base_entry_attr_name)
all_wrapper = CTkFrame(setting_box_item_frame, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
all_wrapper.grid(row=1, column=0, sticky="ew")
all_wrapper.grid_columnconfigure(0, weight=1)
example_box_wrapper = CTkFrame(all_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
example_box_wrapper.grid(row=0, column=0, pady=self.settings.uism.SB__MESSAGE_FORMAT__ENTRIES_BOTTOM_PADY, sticky="ew")
entries_wrapper = CTkFrame(all_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
entries_wrapper.grid(row=1, column=0, pady=self.settings.uism.SB__MESSAGE_FORMAT__ENTRIES_BOTTOM_PADY, sticky="ew")
example_box_wrapper.grid_columnconfigure((0,2), weight=1)
example_frame_widget = CTkFrame(example_box_wrapper, corner_radius=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_CORNER_RADIUS, fg_color=self.settings.ctm.SB__MESSAGE_FORMAT__EXAMPLE_BG_COLOR, width=0, height=0)
example_frame_widget.grid(row=0, column=1)
example_frame_widget.grid_rowconfigure((0,2), weight=1)
example_frame_widget.grid_columnconfigure((0,2), weight=1)
example_label_widget = CTkLabel(
example_frame_widget,
textvariable=example_label_textvariable,
anchor="center",
justify="center",
wraplength=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_WRAP_LENGTH,
height=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__MESSAGE_FORMAT__REQUIRED_TEXT_FONT_SIZE, weight="normal"),
text_color=self.settings.ctm.SB__MESSAGE_FORMAT__EXAMPLE_TEXT_COLOR,
)
example_label_widget.grid(row=1, column=1, padx=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_IPADXY, pady=self.settings.uism.SB__MESSAGE_FORMAT__EXAMPLE_IPADXY, sticky="ew")
self.config_window.additional_widgets.append(example_box_wrapper)
entry_textvariables = [entry_textvariable_0, entry_textvariable_1]
for i in range(2):
entry_widget = CTkEntry(
entries_wrapper,
text_color=self.settings.ctm.SB__ENTRY_TEXT_COLOR,
fg_color=self.settings.ctm.SB__ENTRY_BG_COLOR,
border_color=self.settings.ctm.SB__ENTRY_BORDER_COLOR,
height=self.settings.uism.SB__MESSAGE_FORMAT__ENTRY_HEIGHT,
textvariable=entry_textvariables[i],
justify="center",
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__ENTRY_FONT_SIZE, weight="normal"),
)
setattr(self.config_window, base_entry_attr_name + "_" + str(i), entry_widget)
if entry_bind__FocusOut is not None:
entry_widget.bind("<FocusOut>", entry_bind__FocusOut, "+")
label_frame_widget_0 = CTkFrame(entries_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
label_frame_widget_0.grid_rowconfigure((0,2), weight=1)
label_frame_widget_0.grid_columnconfigure(0, weight=1)
label_widget_0 = CTkLabel(
label_frame_widget_0,
textvariable=textvariable_0,
anchor="center",
height=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__MESSAGE_FORMAT__REQUIRED_TEXT_FONT_SIZE, weight="normal"),
text_color=self.settings.ctm.LABELS_TEXT_COLOR
)
label_widget_0.grid(row=1, column=0, padx=0, pady=0, sticky="ew")
entries_wrapper.grid_columnconfigure((0,2), weight=1)
entries_wrapper.grid_columnconfigure(1, weight=0)
entry_widget_0 = getattr(self.config_window, base_entry_attr_name+"_0")
entry_widget_1 = getattr(self.config_window, base_entry_attr_name+"_1")
entry_widget_0.grid(row=0, column=0, sticky="ew")
entry_widget_1.grid(row=0, column=2, sticky="ew")
label_frame_widget_0.grid(row=0, column=1, padx=self.settings.uism.SB__MESSAGE_FORMAT__REQUIRED_TEXT_PADX, sticky="ew")
def adjusted_command__for_entry_bind__Any_KeyRelease(_e):
message_format = entry_widget_0.get() + textvariable_0.get() + entry_widget_1.get()
entry_bind__Any_KeyRelease(message_format)
entry_widget_0.bind("<Any-KeyRelease>", adjusted_command__for_entry_bind__Any_KeyRelease)
entry_widget_1.bind("<Any-KeyRelease>", adjusted_command__for_entry_bind__Any_KeyRelease)
return setting_box_frame
def createSettingBoxButtonWithImage( def createSettingBoxButtonWithImage(
self, self,
for_var_label_text, for_var_desc_text, for_var_label_text, for_var_desc_text,

View File

@@ -1,2 +1,4 @@
from .createSettingBox_Others import createSettingBox_Others from .createSettingBox_Others import createSettingBox_Others
from .createSettingBox_Others_SendMessageFormats import createSettingBox_Others_SendMessageFormats
from .createSettingBox_Others_ReceivedMessageFormats import createSettingBox_Others_ReceivedMessageFormats
from .createSettingBox_Others_Additional import createSettingBox_Others_Additional from .createSettingBox_Others_Additional import createSettingBox_Others_Additional

View File

@@ -7,7 +7,7 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
createSettingBoxAutoExportMessageLogs = sbg.createSettingBoxAutoExportMessageLogs createSettingBoxAutoExportMessageLogs = sbg.createSettingBoxAutoExportMessageLogs
createSettingBox_Labels = sbg.createSettingBox_Labels createSettingBox_Labels = sbg.createSettingBox_Labels
createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation
# 元 checkbox_auto_clear_chatbox_callback # 元 checkbox_auto_clear_chatbox_callback
@@ -30,13 +30,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v
# def checkbox_startup_osc_enabled_check_callback(checkbox_box_widget): # def checkbox_startup_osc_enabled_check_callback(checkbox_box_widget):
# callFunctionIfCallable(view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK, checkbox_box_widget.get()) # callFunctionIfCallable(view_variable.CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK, checkbox_box_widget.get())
def entry_message_format_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_MESSAGE_FORMAT, value)
def entry_swap_message_format_callback(_e):
callFunctionIfCallable(view_variable.CALLBACK_SWAP_MESSAGE_FORMAT_REQUIRED_TEXT)
row=0 row=0
config_window.sb__auto_clear_message_box = createSettingBoxCheckbox( config_window.sb__auto_clear_message_box = createSettingBoxCheckbox(
for_var_label_text=view_variable.VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX, for_var_label_text=view_variable.VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX,
@@ -72,32 +65,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v
row+=1 row+=1
config_window.sb__message_format_labels = createSettingBox_Labels(
for_var_label_text=view_variable.VAR_LABEL_MESSAGE_FORMAT,
for_var_desc_text=view_variable.VAR_DESC_MESSAGE_FORMAT,
labels_attr_name="sb__labels_message_format",
)
config_window.sb__message_format_labels.grid(row=row, pady=0)
row+=1
config_window.sb__message_format = createSettingBoxMessageFormatEntries(
base_entry_attr_name="sb__entry_message_format",
# entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150,
entry_textvariable_0=view_variable.VAR_ENTRY_0_MESSAGE_FORMAT,
entry_textvariable_1=view_variable.VAR_ENTRY_1_MESSAGE_FORMAT,
entry_textvariable_2=view_variable.VAR_ENTRY_2_MESSAGE_FORMAT,
textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_MESSAGE_FORMAT,
textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_MESSAGE_FORMAT,
example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_MESSAGE_FORMAT,
entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value),
swap_button_command=entry_swap_message_format_callback,
# entry_textvariable=view_variable.VAR_MESSAGE_FORMAT,
entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_MESSAGE_FORMAT,
)
config_window.sb__message_format.grid(row=row)
row+=1
config_window.sb__enable_send_message_to_vrc = createSettingBoxCheckbox( config_window.sb__enable_send_message_to_vrc = createSettingBoxCheckbox(
for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC, for_var_label_text=view_variable.VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC,
for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC, for_var_desc_text=view_variable.VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC,

View File

@@ -5,46 +5,12 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_Others_Additional(setting_box_wrapper, config_window, settings, view_variable): def createSettingBox_Others_Additional(setting_box_wrapper, config_window, settings, view_variable):
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable) sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
createSettingBox_Labels = sbg.createSettingBox_Labels
createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries
def checkbox_enable_send_received_message_to_vrc_callback(checkbox_box_widget): def checkbox_enable_send_received_message_to_vrc_callback(checkbox_box_widget):
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, checkbox_box_widget.get()) callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC, checkbox_box_widget.get())
def entry_received_message_format_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, value)
def entry_swap_received_message_format_callback(_e):
callFunctionIfCallable(view_variable.CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_REQUIRED_TEXT)
row=0 row=0
config_window.sb__received_message_format_labels = createSettingBox_Labels(
for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT,
# for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT,
labels_attr_name="sb__labels_message_format",
)
config_window.sb__received_message_format_labels.grid(row=row, pady=0)
row+=1
config_window.sb__received_message_format = createSettingBoxMessageFormatEntries(
base_entry_attr_name="sb__entry_received_message_format",
# entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150,
entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT,
entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT,
entry_textvariable_2=view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT,
textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT,
textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT,
example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT,
entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_callback(value),
swap_button_command=entry_swap_received_message_format_callback,
# entry_textvariable=view_variable.VAR_RECEIVED_MESSAGE_FORMAT,
entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT,
)
config_window.sb__received_message_format.grid(row=row)
row+=1
config_window.sb__enable_send_received_message_to_vrc = createSettingBoxCheckbox( 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_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,

View File

@@ -0,0 +1,65 @@
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_Others_ReceivedMessageFormats(setting_box_wrapper, config_window, settings, view_variable):
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBox_Labels = sbg.createSettingBox_Labels
createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries
createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation
def entry_received_message_format_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT, value)
def entry_received_message_format_with_t_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_RECEIVED_MESSAGE_FORMAT_WITH_T, value)
def entry_swap_received_message_format_with_t_callback(_e):
callFunctionIfCallable(view_variable.CALLBACK_SWAP_RECEIVED_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT)
row=0
config_window.sb__received_message_format_labels = createSettingBox_Labels(
for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT,
for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT,
labels_attr_name="sb__labels_received_message_format",
)
config_window.sb__received_message_format_labels.grid(row=row, pady=0)
row+=1
config_window.sb__received_message_format = createSettingBoxMessageFormatEntries(
base_entry_attr_name="sb__entry_received_message_format",
entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT,
entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT,
textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT,
example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT,
entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_callback(value),
entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT,
)
config_window.sb__received_message_format.grid(row=row)
row+=1
config_window.sb__received_message_format_with_t_labels = createSettingBox_Labels(
for_var_label_text=view_variable.VAR_LABEL_RECEIVED_MESSAGE_FORMAT_WITH_T,
for_var_desc_text=view_variable.VAR_DESC_RECEIVED_MESSAGE_FORMAT_WITH_T,
labels_attr_name="sb__labels_message_format_with_t",
)
config_window.sb__received_message_format_with_t_labels.grid(row=row, pady=0)
row+=1
config_window.sb__received_message_format_with_t = createSettingBoxMessageFormatEntries_WithTranslation(
base_entry_attr_name="sb__entry_received_message_format_with_t",
entry_textvariable_0=view_variable.VAR_ENTRY_0_RECEIVED_MESSAGE_FORMAT_WITH_T,
entry_textvariable_1=view_variable.VAR_ENTRY_1_RECEIVED_MESSAGE_FORMAT_WITH_T,
entry_textvariable_2=view_variable.VAR_ENTRY_2_RECEIVED_MESSAGE_FORMAT_WITH_T,
textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_RECEIVED_MESSAGE_FORMAT_WITH_T,
textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_RECEIVED_MESSAGE_FORMAT_WITH_T,
example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_RECEIVED_MESSAGE_FORMAT_WITH_T,
entry_bind__Any_KeyRelease=lambda value: entry_received_message_format_with_t_callback(value),
swap_button_command=entry_swap_received_message_format_with_t_callback,
entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_RECEIVED_MESSAGE_FORMAT_WITH_T,
)
config_window.sb__received_message_format_with_t.grid(row=row, pady=0)
row+=1

View File

@@ -0,0 +1,66 @@
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_Others_SendMessageFormats(setting_box_wrapper, config_window, settings, view_variable):
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBox_Labels = sbg.createSettingBox_Labels
createSettingBoxMessageFormatEntries = sbg.createSettingBoxMessageFormatEntries
createSettingBoxMessageFormatEntries_WithTranslation = sbg.createSettingBoxMessageFormatEntries_WithTranslation
def entry_send_message_format_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT, value)
def entry_send_message_format_with_t_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_SEND_MESSAGE_FORMAT_WITH_T, value)
def entry_swap_message_format_with_t_callback(_e):
callFunctionIfCallable(view_variable.CALLBACK_SWAP_SEND_MESSAGE_FORMAT_WITH_T_REQUIRED_TEXT)
row=0
config_window.sb__send_message_format_labels = createSettingBox_Labels(
for_var_label_text=view_variable.VAR_LABEL_SEND_MESSAGE_FORMAT,
for_var_desc_text=view_variable.VAR_DESC_SEND_MESSAGE_FORMAT,
labels_attr_name="sb__labels_send_message_format",
)
config_window.sb__send_message_format_labels.grid(row=row, pady=0)
row+=1
config_window.sb__message_format = createSettingBoxMessageFormatEntries(
base_entry_attr_name="sb__entry_send_message_format",
entry_textvariable_0=view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT,
entry_textvariable_1=view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT,
textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT,
example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT,
entry_bind__Any_KeyRelease=lambda value: entry_send_message_format_callback(value),
entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT,
)
config_window.sb__message_format.grid(row=row)
row+=1
config_window.sb__send_message_format_with_t_labels = createSettingBox_Labels(
for_var_label_text=view_variable.VAR_LABEL_SEND_MESSAGE_FORMAT_WITH_T,
for_var_desc_text=view_variable.VAR_DESC_SEND_MESSAGE_FORMAT_WITH_T,
labels_attr_name="sb__labels_send_message_format_with_t",
)
config_window.sb__send_message_format_with_t_labels.grid(row=row, pady=0)
row+=1
config_window.sb__message_format_with_t = createSettingBoxMessageFormatEntries_WithTranslation(
base_entry_attr_name="sb__entry_send_message_format_with_t",
entry_textvariable_0=view_variable.VAR_ENTRY_0_SEND_MESSAGE_FORMAT_WITH_T,
entry_textvariable_1=view_variable.VAR_ENTRY_1_SEND_MESSAGE_FORMAT_WITH_T,
entry_textvariable_2=view_variable.VAR_ENTRY_2_SEND_MESSAGE_FORMAT_WITH_T,
textvariable_0=view_variable.VAR_TEXT_REQUIRED_0_SEND_MESSAGE_FORMAT_WITH_T,
textvariable_1=view_variable.VAR_TEXT_REQUIRED_1_SEND_MESSAGE_FORMAT_WITH_T,
example_label_textvariable=view_variable.VAR_LABEL_EXAMPLE_TEXT_SEND_MESSAGE_FORMAT_WITH_T,
entry_bind__Any_KeyRelease=lambda value: entry_send_message_format_with_t_callback(value),
swap_button_command=entry_swap_message_format_with_t_callback,
entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SEND_MESSAGE_FORMAT_WITH_T,
)
config_window.sb__message_format_with_t.grid(row=row, pady=0)
row+=1