[Update] No Device時の処理。スピーカー/マイクを使う処理時に表示するエラーメッセージの実装。表示方法は改善予定。

This commit is contained in:
Sakamoto Shiina
2023-10-17 05:36:29 +09:00
parent 9eafb5f340
commit 314e0c86b6
4 changed files with 23 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ def sendMicMessage(message):
model.logger.info(f"[SENT] {message}{translation}")
def startTranscriptionSendMessage():
model.startMicTranscript(sendMicMessage)
model.startMicTranscript(sendMicMessage, view.printToTextbox_TranscriptionSendNoDeviceError)
view.setMainWindowAllWidgetsStatusToNormal()
def stopTranscriptionSendMessage():
@@ -64,7 +64,7 @@ def stopThreadingTranscriptionSendMessage():
th_stopTranscriptionSendMessage.start()
def startTranscriptionSendMessageOnCloseConfigWindow():
model.startMicTranscript(sendMicMessage)
model.startMicTranscript(sendMicMessage, view.printToTextbox_TranscriptionSendNoDeviceError)
def stopTranscriptionSendMessageOnOpenConfigWindow():
model.stopMicTranscript()
@@ -109,7 +109,7 @@ def receiveSpeakerMessage(message):
def startTranscriptionReceiveMessage():
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
model.startSpeakerTranscript(receiveSpeakerMessage, lambda:print("[ERROR] Speaker NoDevice"))
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
view.setMainWindowAllWidgetsStatusToNormal()
def stopTranscriptionReceiveMessage():
@@ -130,7 +130,7 @@ def stopThreadingTranscriptionReceiveMessage():
def startTranscriptionReceiveMessageOnCloseConfigWindow():
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
model.startSpeakerTranscript(receiveSpeakerMessage)
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
def stopTranscriptionReceiveMessageOnOpenConfigWindow():
@@ -516,7 +516,7 @@ def callbackCheckSpeakerThreshold(is_turned_on):
model.startCheckSpeakerEnergy(
setProgressBarSpeakerEnergy,
view.initProgressBar_SpeakerEnergy,
lambda:print("[ERROR] Speaker NoDevice")
view.showErrorMessage_CheckSpeakerThreshold_NoDevice
)
view.replaceSpeakerThresholdCheckButton_Active()

View File

@@ -27,6 +27,9 @@ main_window:
auth_key_success: Auth key update completed.
auth_key_error: Auth Key is incorrect or Usage limit reached.
no_mic_device_detected_error: No mic device detected.
no_speaker_device_detected_error: No speaker device detected.
detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter.
selected_your_language: "\"Your Language\" has set to %{your_language}."

View File

@@ -27,6 +27,9 @@ main_window:
auth_key_success: 認証キーの更新が完了しました。
auth_key_error: 認証キーが間違っているか、API使用制限が上限に達しています.
no_mic_device_detected_error: マイクデバイスが検出されませんでした。
no_speaker_device_detected_error: スピーカーデバイスが検出されませんでした。
detected_by_word_filter: ワードフィルターに登録されている単語 %{detected_message} が検出されたため送信しませんでした。
selected_your_language: 「あなたの言語」 を %{your_language} に設定しました。

12
view.py
View File

@@ -609,6 +609,14 @@ class View():
def printToTextbox_AuthenticationError(self):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.auth_key_error"))
def printToTextbox_TranscriptionSendNoDeviceError(self):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.no_mic_device_detected_error"))
def printToTextbox_TranscriptionReceiveNoDeviceError(self):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.no_speaker_device_detected_error"))
# def printToTextbox_OSCError(self): [Deprecated]
# self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin. or turn off the \"Send Message To VRChat\" setting")
@@ -959,6 +967,10 @@ class View():
def showErrorMessage_SpeakerMaxPhrases(self):
self._showErrorMessage(vrct_gui.config_window.sb__entry_speaker_max_phrases, "Speaker Max Phrases Error Message")
def showErrorMessage_CheckSpeakerThreshold_NoDevice(self):
self._showErrorMessage(vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold, "No speaker device detected")
def _showErrorMessage(self, target_widget, message):
self.view_variable.VAR_ERROR_MESSAGE.set(message)
vrct_gui._showErrorMessage(target_widget=target_widget)