[Update] Main Window: Textbox デザイン大幅変更。テスト用or今後ユーザーがデザインカスタム設定する際に使えるサンプルとして会話を挿入する関数追加。

This commit is contained in:
Sakamoto Shiina
2023-09-15 09:51:41 +09:00
parent f27e4985cd
commit cbef891fe8
5 changed files with 239 additions and 47 deletions

134
view.py
View File

@@ -350,6 +350,7 @@ class View():
self.view_variable.CALLBACK_SET_OSC_IP_ADDRESS = config_window_registers.get("callback_set_osc_ip_address", None)
self.view_variable.CALLBACK_SET_OSC_PORT = config_window_registers.get("callback_set_osc_port", None)
# self._insertSampleConversationToTextbox()
@@ -438,22 +439,23 @@ class View():
@staticmethod
def _printToTextbox_Info(info_message):
vrct_gui.printToTextbox(
target_type="INFO",
target_type="SYSTEM",
original_message=info_message,
translated_message="",
# translated_message="",
)
def printToTextbox_SentMessage(self, original_message, translated_message):
self._printToTextbox_Sent(original_message, translated_message)
def printToTextbox_SentMessage(self, original_message, translated_message, actual_sent_message=None):
self._printToTextbox_Sent(original_message, translated_message, actual_sent_message)
@staticmethod
def _printToTextbox_Sent(original_message, translated_message):
def _printToTextbox_Sent(original_message, translated_message, actual_sent_message=None):
vrct_gui.printToTextbox(
target_type="SEND",
target_type="SENT",
original_message=original_message,
translated_message=translated_message,
actual_sent_message=actual_sent_message,
)
@@ -463,7 +465,7 @@ class View():
@staticmethod
def _printToTextbox_Received(original_message, translated_message):
vrct_gui.printToTextbox(
target_type="RECEIVE",
target_type="RECEIVED",
original_message=original_message,
translated_message=translated_message,
)
@@ -626,4 +628,122 @@ class View():
# These conversation is generated by ChatGPT
def _insertSampleConversationToTextbox(self):
self.printToTextbox_enableTranscriptionSend()
self.printToTextbox_enableTranscriptionReceive()
conversation_data_without_translation = [
{
"me": "おはよう。",
},
{
"me": "おはよう。",
"target": "やぁ。",
},
{
"me": "今日の天気はどうかな?",
"target": "天気予報を見てないけど、晴れるといいね。",
},
{
"me": "そうだね。昨日は雨だったから。",
"target": "それで、今日の予定は?",
},
]
for data in conversation_data_without_translation:
if data.get("me", None) is not None:
self.printToTextbox_SentMessage(data.get("me", None), data.get("me_t", None))
if data.get("target", None) is not None:
self.printToTextbox_ReceivedMessage(data.get("target", None), data.get("target_t", None))
self.printToTextbox_enableTranslation()
conversation_data = [
{
"me": "I have work in the morning, but I'm meeting friends for dinner in the evening.",
"me_t": "아침에 일이 있지만 저녁에 친구들과 만나 저녁 식사할 예정이에요.",
"target": "재미있어 보여요! 무엇을 먹을 예정이에요?",
"target_t": "Sounds fun! What are you planning to eat?"
},
{
"me": "We're going to an Italian restaurant, and I'm going to have pizza.",
"me_t": "우리는 이탈리안 레스토랑에 가서 피자를 먹을 거에요.",
"target": "그걸 듣자마자 배가 고파져요. 언젠가 함께하고 싶어요.",
"target_t": "Just hearing that makes me hungry. I'd love to join you sometime."
},
{
"me": "Let's plan it for next time!",
"me_t": "다음 번에 계획해 봐요!",
"target": "그래요!",
"target_t": "Sure!"
},
{
"me": "When would be a good time for you?",
"me_t": "너에게 언제가 좋을까?",
"target": "나는 주말이 가장 좋을 것 같아요. 토요일은 어때요?",
"target_t": "I think the weekend works best for me. How about Saturday?"
},
{
"me": "Saturday sounds perfect. What time would be convenient?",
"me_t": "토요일이 완벽해 보여. 편한 시간은 언제인가요?",
"target": "저는 저녁이 괜찮아요. 7시쯤 괜찮을까요?",
"target_t": "Evening works for me. Is around 7 PM okay?"
},
{
"me": "7 PM works great. Do you have any preferences for food other than Italian?",
"me_t": "7시가 아주 적당해. 이탈리안 음식 이외에 어떤 음식을 좋아하세요?",
"target": "특별한 선호도는 없어요. 무엇이든 괜찮아요. 추천 디저트가 있다면 알려주세요.",
"target_t": "I don't have any particular preferences, so anything is fine. If there's a recommended dessert, let me know."
},
{
"me": "朝は仕事があるけど、夜は友達と食事に行く予定だよ。",
"me_t": "I have work in the morning, but I'm meeting friends for dinner in the evening.",
"target": "Sounds fun! What are you planning to eat?",
"target_t": "楽しそう!何を食べる予定?",
},
{
"me": "イタリアンレストランに行って、ピザを食べるつもりだよ。",
"me_t": "We're going to an Italian restaurant, and I'm going to have pizza.",
"target": "Just hearing that makes me hungry. I'd love to join you sometime.",
"target_t": "それ聞いただけでおなかすいたよ。私も一緒に行きたいな。",
},
{
"me": "次回にぜひ一緒に行こう!",
"me_t": "Let's plan it for next time!",
"target": "Sure!",
"target_t": "そうだね!",
},
{
"me": "次回はいつがいいかな?",
"me_t": "When would be a good time for you?",
"target": "I think the weekend works best for me. How about Saturday?",
"target_t": "私は週末が一番いいかな。土曜日はどう?"
},
{
"me": "土曜日はちょうどいいね。何時ごろが良いかな?",
"me_t": "Saturday sounds perfect. What time would be convenient?",
"target": "Evening works for me. Is around 7 PM okay?",
"target_t": "夜がいいかな。7時くらいからがちょうど良いかな。"
},
{
"me": "7時からはちょうどいいよ。イタリアン以外の食べ物について何か好みがある",
"me_t": "7 PM works great. Do you have any preferences for food other than Italian?",
"target": "I don't have any particular preferences, so anything is fine. If there's a recommended dessert, let me know.",
"target_t": "特に好みはないから、何でも大丈夫。おすすめのデザートがあれば教えてね。"
},
]
for data in conversation_data:
if data.get("me", None) is not None:
# actual_sent_message = config.MESSAGE_FORMAT.replace("[message]", data.get("me", None))
# actual_sent_message = actual_sent_message.replace("[translation]", data.get("me_t", None))
self.printToTextbox_SentMessage(data.get("me", None), data.get("me_t", None))
# self.printToTextbox_SentMessage(data.get("me", None), data.get("me_t", None), actual_sent_message)
if data.get("target", None) is not None:
self.printToTextbox_ReceivedMessage(data.get("target", None), data.get("target_t", None))
view = View()