[Update] Message Format: [message]と[translation]は一意かつそれぞれ一つだけの使用に。それに伴いエラー表示や初期値の挿入など。

This commit is contained in:
Sakamoto Shiina
2023-11-05 11:30:34 +09:00
parent 44baaa84b8
commit 72877ab98b
8 changed files with 49 additions and 11 deletions

15
view.py
View File

@@ -355,6 +355,7 @@ class View():
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")),
@@ -1121,6 +1122,9 @@ class View():
case "SpeakerMaxPhrases":
self.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES)
case "MessageFormat":
self.setMessageFormatEntryWidgets(config.MESSAGE_FORMAT)
case _:
raise ValueError(f"No matching case for target_name: {target_name}")
@@ -1270,7 +1274,9 @@ class View():
self.clearErrorMessage()
def callbackBindFocusOut_MessageFormat(self, _e=None):
self.setLatestConfigVariable("MessageFormat")
self.clearErrorMessage()
@@ -1352,6 +1358,13 @@ class View():
self._makeInvalidValueErrorMessage(i18n.t("config_window.speaker_dynamic_energy_threshold.no_device_error_message"))
)
def showErrorMessage_MessageFormat(self):
self._showErrorMessage(
vrct_gui.config_window.sb__entry_message_format_2,
self._makeInvalidValueErrorMessage(i18n.t("config_window.message_format.error_message"))
)
@staticmethod
def _makeInvalidValueErrorMessage(error_message):
return i18n.t("config_window.common_error_message.invalid_value") + "\n" + error_message