Files
VRCT/view.py
2023-08-30 19:54:40 +09:00

101 lines
4.3 KiB
Python

from customtkinter import StringVar
from vrct_gui import vrct_gui
from config import config
class view():
def __init__(self):
pass
def initializer(self, sidebar_features, language_presets, entry_message_box):
vrct_gui.CALLBACK_TOGGLE_TRANSLATION = sidebar_features["callback_toggle_translation"]
vrct_gui.CALLBACK_TOGGLE_TRANSCRIPTION_SEND = sidebar_features["callback_toggle_transcription_send"]
vrct_gui.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE = sidebar_features["callback_toggle_transcription_receive"]
vrct_gui.CALLBACK_TOGGLE_FOREGROUND = sidebar_features["callback_toggle_foreground"]
vrct_gui.sqls__optionmenu_your_language.configure(values=language_presets["values"])
vrct_gui.sqls__optionmenu_your_language.configure(command=language_presets["callback_your_language"])
vrct_gui.sqls__optionmenu_your_language.configure(variable=StringVar(value=config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO]))
vrct_gui.sqls__optionmenu_target_language.configure(values=language_presets["values"])
vrct_gui.sqls__optionmenu_target_language.configure(command=language_presets["callback_target_language"])
vrct_gui.sqls__optionmenu_target_language.configure(variable=StringVar(value=config.SELECTED_TAB_TARGET_LANGUAGES[config.SELECTED_TAB_NO]))
vrct_gui.CALLBACK_SELECTED_TAB_NO_1 = language_presets["callback_selected_tab_no_1"]
vrct_gui.CALLBACK_SELECTED_TAB_NO_2 = language_presets["callback_selected_tab_no_2"]
vrct_gui.CALLBACK_SELECTED_TAB_NO_3 = language_presets["callback_selected_tab_no_3"]
vrct_gui.setDefaultActiveLanguagePresetTab(tab_no=config.SELECTED_TAB_NO)
entry_message_box = getattr(vrct_gui, "entry_message_box")
entry_message_box.bind("<Return>", lambda: entry_message_box["bind_Return"])
entry_message_box.bind("<Any-KeyPress>", lambda: entry_message_box["bind_Any_KeyPress"])
entry_message_box.bind("<FocusIn>", self._foregroundOffForcefully)
entry_message_box.bind("<FocusOut>", self._foregroundOnForcefully)
def setMainWindowAllWidgetsStatusToNormal(self):
vrct_gui.changeMainWindowWidgetsStatus("normal", "All")
def setMainWindowAllWidgetsStatusToDisabled(self):
vrct_gui.changeMainWindowWidgetsStatus("disabled", "All")
def _foregroundOffForcefully(self, _e):
if config.ENABLE_FOREGROUND:
vrct_gui.attributes("-topmost", False)
def _foregroundOnForcefully(self, _e):
if config.ENABLE_FOREGROUND:
vrct_gui.attributes("-topmost", True)
def getTranslationButtonStatus(self):
return vrct_gui.translation_switch_box.get()
def getTranscriptionSendButtonStatus(self):
return vrct_gui.transcription_send_switch_box.get()
def getTranscriptionReceiveButtonStatus(self):
return vrct_gui.transcription_receive_switch_box.get()
def getForegroundButtonStatus(self):
return vrct_gui.foreground_switch_box.get()
def printToTextbox_enableTranslation(self):
self._printToTextbox_Info("翻訳機能をONにしました")
def printToTextbox_disableTranslation(self):
self._printToTextbox_Info("翻訳機能をOFFにしました")
def printToTextbox_enableTranscriptionSend(self):
self._printToTextbox_Info("Voice2chatbox機能をONにしました")
def printToTextbox_disableTranscriptionSend(self):
self._printToTextbox_Info("Voice2chatbox機能をOFFにしました")
def printToTextbox_enableTranscriptionReceive(self):
self._printToTextbox_Info("Speaker2chatbox機能をONにしました")
def printToTextbox_disableTranscriptionReceive(self):
self._printToTextbox_Info("Speaker2chatbox機能をOFFにしました")
def printToTextbox_enableForeground(self):
self._printToTextbox_Info("Start foreground")
def printToTextbox_disableForeground(self):
self._printToTextbox_Info("Stop foreground")
def _printToTextbox_Info(self, info_message):
vrct_gui.printToTextbox(vrct_gui.textbox_all, info_message, "", "INFO")
vrct_gui.printToTextbox(vrct_gui.textbox_system, info_message, "", "INFO")
pass
def getTextFromMessageBox(self):
return vrct_gui.entry_message_box.get()
view = view()