[Update] main windowのみ処理の実装完了

This commit is contained in:
misygauziya
2023-08-29 16:15:54 +09:00
parent 78ef7404aa
commit 957c48caeb
4 changed files with 37 additions and 25 deletions

34
main.py
View File

@@ -207,6 +207,16 @@ def logTranscriptionSendStatusChange():
vrct_gui.printToTextbox(textbox_all, "Voice2chatbox機能をOFFにしました", "", "INFO")
vrct_gui.printToTextbox(textbox_system, "Voice2chatbox機能をOFFにしました", "", "INFO")
def logTranscriptionReceiveStatusChange():
textbox_all = getattr(vrct_gui, "textbox_all")
textbox_system = getattr(vrct_gui, "textbox_system")
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
vrct_gui.printToTextbox(textbox_all, "Speaker2chatbox機能をONにしました", "", "INFO")
vrct_gui.printToTextbox(textbox_system, "Speaker2chatbox機能をONにしました", "", "INFO")
else:
vrct_gui.printToTextbox(textbox_all, "Speaker2chatbox機能をOFFにしました", "", "INFO")
vrct_gui.printToTextbox(textbox_system, "Speaker2chatbox機能をOFFにしました", "", "INFO")
def logSendMessage(message, translate):
textbox_all = getattr(vrct_gui, "textbox_all")
textbox_sent = getattr(vrct_gui, "textbox_sent")
@@ -248,11 +258,11 @@ def logForegroundStatusChange():
vrct_gui.printToTextbox(textbox_system, "Stop foreground", "", "INFO")
# command func
def toggleTranslationFeature():
def callbackToggleTranslation():
config.ENABLE_TRANSLATION = getattr(vrct_gui, "translation_switch_box").get()
logTranslationStatusChange()
def toggleTranscriptionSendFeature():
def callbackToggleTranscriptionSend():
vrct_gui.changeMainWindowWidgetsStatus("disabled", "All")
config.ENABLE_TRANSCRIPTION_SEND = getattr(vrct_gui, "transcription_send_switch_box").get()
if config.ENABLE_TRANSCRIPTION_SEND is True:
@@ -265,7 +275,7 @@ def toggleTranscriptionSendFeature():
th_stopTranscriptionSendMessage.start()
logTranscriptionSendStatusChange()
def toggleTranscriptionReceiveFeature():
def callbackToggleTranscriptionReceive():
vrct_gui.changeMainWindowWidgetsStatus("disabled", "All")
config.ENABLE_TRANSCRIPTION_RECEIVE = getattr(vrct_gui, "transcription_receive_switch_box").get()
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
@@ -276,9 +286,9 @@ def toggleTranscriptionReceiveFeature():
th_stopTranscriptionReceiveMessage = Thread(target=stopTranscriptionReceiveMessage)
th_stopTranscriptionReceiveMessage.daemon = True
th_stopTranscriptionReceiveMessage.start()
logTranscriptionSendStatusChange()
logTranscriptionReceiveStatusChange()
def toggleForegroundFeature():
def callbackToggleForeground():
config.ENABLE_FOREGROUND = getattr(vrct_gui, "foreground_switch_box").get()
if config.ENABLE_FOREGROUND is True:
vrct_gui.attributes("-topmost", True)
@@ -303,15 +313,11 @@ model.checkOSCStarted()
# check Software Updated
model.checkSoftwareUpdated()
# set commands
translation_switch_box = getattr(vrct_gui, "translation_switch_box")
translation_switch_box.configure(command=toggleTranslationFeature)
transcription_send_switch_box = getattr(vrct_gui, "transcription_send_switch_box")
transcription_send_switch_box.configure(command=toggleTranscriptionSendFeature)
transcription_receive_switch_box = getattr(vrct_gui, "transcription_receive_switch_box")
transcription_receive_switch_box.configure(command=toggleTranscriptionReceiveFeature)
foreground_switch_box = getattr(vrct_gui, "foreground_switch_box")
foreground_switch_box.configure(command=toggleForegroundFeature)
# set UI and callback
vrct_gui.CALLBACK_TOGGLE_TRANSLATION = callbackToggleTranslation
vrct_gui.CALLBACK_TOGGLE_TRANSCRIPTION_SEND = callbackToggleTranscriptionSend
vrct_gui.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE = callbackToggleTranscriptionReceive
vrct_gui.CALLBACK_TOGGLE_FOREGROUND = callbackToggleForeground
entry_message_box = getattr(vrct_gui, "entry_message_box")
entry_message_box.bind("<Return>", messageBoxPressKeyEnter)

View File

@@ -85,7 +85,8 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, status, target_names):
vrct_gui.sqls__container_title.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR)
vrct_gui.sqls__title_text_your_language.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR)
vrct_gui.sqls__title_text_target_language.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR)
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE)
if settings.IS_SIDEBAR_COMPACT_MODE is False:
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE)
vrct_gui.sqls__optionmenu_your_language.configure(state="disabled")
vrct_gui.sqls__optionmenu_target_language.configure(state="disabled")
@@ -93,8 +94,9 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, status, target_names):
vrct_gui.sqls__container_title.configure(text_color=settings.ctm.LABELS_TEXT_COLOR)
vrct_gui.sqls__title_text_your_language.configure(text_color=settings.ctm.LABELS_TEXT_COLOR)
vrct_gui.sqls__title_text_target_language.configure(text_color=settings.ctm.LABELS_TEXT_COLOR)
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
if settings.IS_SIDEBAR_COMPACT_MODE is False:
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
vrct_gui.sqls__optionmenu_your_language.configure(state="normal")
vrct_gui.sqls__optionmenu_target_language.configure(state="normal")

View File

@@ -18,30 +18,30 @@ def createSidebar(settings, main_window):
def toggleTranslationFeature():
if callable(main_window.CALLBACK_TOGGLE_TRANSLATION) is True:
main_window.CALLBACK_TOGGLE_TRANSLATION()
is_turned_on = getattr(main_window, "translation_switch_box").get()
print(is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.translation_selected_mark)
def toggleTranscriptionSendFeature():
if callable(main_window.CALLBACK_TOGGLE_TRANSCRIPTION_SEND) is True:
main_window.CALLBACK_TOGGLE_TRANSCRIPTION_SEND()
is_turned_on = getattr(main_window, "transcription_send_switch_box").get()
print(is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.transcription_send_selected_mark)
if is_turned_on is True:
changeMainWindowWidgetsStatus("disabled", "All")
sleep(1.5)
changeMainWindowWidgetsStatus("normal", "All")
def toggleTranscriptionReceiveFeature():
if callable(main_window.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE) is True:
main_window.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE()
is_turned_on = getattr(main_window, "transcription_receive_switch_box").get()
print(is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.transcription_receive_selected_mark)
if is_turned_on is True:
changeMainWindowWidgetsStatus("disabled", "All")
sleep(1.5)
changeMainWindowWidgetsStatus("normal", "All")
def toggleForegroundFeature():
if callable(main_window.CALLBACK_TOGGLE_FOREGROUND) is True:
main_window.CALLBACK_TOGGLE_FOREGROUND()
is_turned_on = getattr(main_window, "foreground_switch_box").get()
print(is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.foreground_selected_mark)

View File

@@ -47,6 +47,10 @@ class VRCT_GUI(CTk):
self.YOUR_LANGUAGE = "Japanese\n(Japan)"
self.TARGET_LANGUAGE = "English\n(United States)"
self.CALLBACK_TOGGLE_TRANSLATION = None
self.CALLBACK_TOGGLE_TRANSCRIPTION_SEND = None
self.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE = None
self.CALLBACK_TOGGLE_FOREGROUND = None
self.CALLBACK_SELECTED_TAB_NO_1 = None
self.CALLBACK_SELECTED_TAB_NO_2 = None
self.CALLBACK_SELECTED_TAB_NO_3 = None