🚧[WIP/TEST] Main: viewをコメントアウト

This commit is contained in:
misyaguziya
2024-07-29 18:31:29 +09:00
parent 3f499b243b
commit 73954d12fe

View File

@@ -4,7 +4,7 @@ from subprocess import Popen
from threading import Thread from threading import Thread
from config import config from config import config
from model import model from model import model
from view import view # from view import view
from utils import getKeyByValue, isUniqueStrings, strPctToInt from utils import getKeyByValue, isUniqueStrings, strPctToInt
import argparse import argparse
@@ -33,18 +33,19 @@ def callbackQuitVrct():
def callbackEnableEasterEgg(): def callbackEnableEasterEgg():
config.IS_EASTER_EGG_ENABLED = True config.IS_EASTER_EGG_ENABLED = True
config.OVERLAY_UI_TYPE = "sakura" config.OVERLAY_UI_TYPE = "sakura"
view.printToTextbox_enableEasterEgg() # view.printToTextbox_enableEasterEgg()
def setMainWindowGeometry(): def setMainWindowGeometry():
PRE_SCALING_INT = strPctToInt(view.getPreUiScaling()) # PRE_SCALING_INT = strPctToInt(view.getPreUiScaling())
NEW_SCALING_INT = strPctToInt(config.UI_SCALING) # NEW_SCALING_INT = strPctToInt(config.UI_SCALING)
MULTIPLY_FLOAT = (NEW_SCALING_INT / PRE_SCALING_INT) # MULTIPLY_FLOAT = (NEW_SCALING_INT / PRE_SCALING_INT)
main_window_geometry = view.getMainWindowGeometry(return_int=True) # main_window_geometry = view.getMainWindowGeometry(return_int=True)
main_window_geometry["width"] = str(int(main_window_geometry["width"] * MULTIPLY_FLOAT)) # main_window_geometry["width"] = str(int(main_window_geometry["width"] * MULTIPLY_FLOAT))
main_window_geometry["height"] = str(int(main_window_geometry["height"] * MULTIPLY_FLOAT)) # main_window_geometry["height"] = str(int(main_window_geometry["height"] * MULTIPLY_FLOAT))
main_window_geometry["x_pos"] = str(main_window_geometry["x_pos"]) # main_window_geometry["x_pos"] = str(main_window_geometry["x_pos"])
main_window_geometry["y_pos"] = str(main_window_geometry["y_pos"]) # main_window_geometry["y_pos"] = str(main_window_geometry["y_pos"])
config.MAIN_WINDOW_GEOMETRY = main_window_geometry # config.MAIN_WINDOW_GEOMETRY = main_window_geometry
pass
def messageFormatter(format_type:str, translation, message): def messageFormatter(format_type:str, translation, message):
if format_type == "RECEIVED": if format_type == "RECEIVED":
@@ -68,7 +69,7 @@ def changeToCTranslate2Process():
config.CHOICE_INPUT_TRANSLATOR = "CTranslate2" config.CHOICE_INPUT_TRANSLATOR = "CTranslate2"
config.CHOICE_OUTPUT_TRANSLATOR = "CTranslate2" config.CHOICE_OUTPUT_TRANSLATOR = "CTranslate2"
updateTranslationEngineAndEngineList() updateTranslationEngineAndEngineList()
view.printToTextbox_TranslationEngineLimitError() # view.printToTextbox_TranslationEngineLimitError()
# func transcription send message # func transcription send message
class MicMessage: class MicMessage:
@@ -134,8 +135,9 @@ def stopThreadingTranscriptionSendMessage(action:Callable[[dict], None]) -> None
th_stopTranscriptionSendMessage.daemon = True th_stopTranscriptionSendMessage.daemon = True
th_stopTranscriptionSendMessage.start() th_stopTranscriptionSendMessage.start()
def startTranscriptionSendMessageOnCloseConfigWindow(): def startTranscriptionSendMessageOnCloseConfigWindow(action:Callable[[dict], None]) -> None:
model.startMicTranscript(sendMicMessage, view.printToTextbox_TranscriptionSendNoDeviceError) mic_message = MicMessage(action)
model.startMicTranscript(mic_message.send)
def stopTranscriptionSendMessageOnOpenConfigWindow(): def stopTranscriptionSendMessageOnOpenConfigWindow():
model.stopMicTranscript() model.stopMicTranscript()
@@ -214,9 +216,9 @@ def stopThreadingTranscriptionReceiveMessage(action:Callable[[dict], None]) -> N
th_stopTranscriptionReceiveMessage.daemon = True th_stopTranscriptionReceiveMessage.daemon = True
th_stopTranscriptionReceiveMessage.start() th_stopTranscriptionReceiveMessage.start()
def startTranscriptionReceiveMessageOnCloseConfigWindow(): def startTranscriptionReceiveMessageOnCloseConfigWindow(action:Callable[[dict], None]) -> None:
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError) speaker_message = SpeakerMessage(action)
model.startSpeakerTranscript(speaker_message.receive)
def stopTranscriptionReceiveMessageOnOpenConfigWindow(): def stopTranscriptionReceiveMessageOnOpenConfigWindow():
model.stopSpeakerTranscript() model.stopSpeakerTranscript()
@@ -261,7 +263,7 @@ def sendChatMessage(message):
# model.updateOverlay(overlay_image) # model.updateOverlay(overlay_image)
# update textbox message log (Sent) # update textbox message log (Sent)
view.printToTextbox_SentMessage(message, translation) # view.printToTextbox_SentMessage(message, translation)
if config.ENABLE_LOGGER is True: if config.ENABLE_LOGGER is True:
if len(translation) > 0: if len(translation) > 0:
translation = f" ({translation})" translation = f" ({translation})"
@@ -269,12 +271,14 @@ def sendChatMessage(message):
# delete message in entry message box # delete message in entry message box
if config.ENABLE_AUTO_CLEAR_MESSAGE_BOX is True: if config.ENABLE_AUTO_CLEAR_MESSAGE_BOX is True:
view.clearMessageBox() # view.clearMessageBox()
pass
def messageBoxPressKeyEnter(): def messageBoxPressKeyEnter():
model.oscStopSendTyping() # model.oscStopSendTyping()
message = view.getTextFromMessageBox() # message = view.getTextFromMessageBox()
sendChatMessage(message) # sendChatMessage(message)
pass
def messageBoxPressKeyAny(e): def messageBoxPressKeyAny(e):
if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
@@ -283,10 +287,11 @@ def messageBoxPressKeyAny(e):
model.oscStopSendTyping() model.oscStopSendTyping()
def messageBoxFocusIn(e): def messageBoxFocusIn(e):
view.foregroundOffIfForegroundEnabled() # view.foregroundOffIfForegroundEnabled()
pass
def messageBoxFocusOut(e): def messageBoxFocusOut(e):
view.foregroundOnIfForegroundEnabled() # view.foregroundOnIfForegroundEnabled()
if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
model.oscStopSendTyping() model.oscStopSendTyping()
@@ -300,7 +305,7 @@ def updateMessageBox(index_offset):
try: try:
new_index = config.CURRENT_SENT_MESSAGES_LOG_INDEX + index_offset new_index = config.CURRENT_SENT_MESSAGES_LOG_INDEX + index_offset
target_message_text = config.SENT_MESSAGES_LOG[new_index] target_message_text = config.SENT_MESSAGES_LOG[new_index]
view.replaceMessageBox(target_message_text) # view.replaceMessageBox(target_message_text)
config.CURRENT_SENT_MESSAGES_LOG_INDEX = new_index config.CURRENT_SENT_MESSAGES_LOG_INDEX = new_index
except IndexError: except IndexError:
pass pass
@@ -726,9 +731,9 @@ def callbackSetSpeakerEnergyThreshold(value) -> dict:
try: try:
value = int(value) value = int(value)
if 0 <= value and value <= config.MAX_SPEAKER_ENERGY_THRESHOLD: if 0 <= value and value <= config.MAX_SPEAKER_ENERGY_THRESHOLD:
view.clearNotificationMessage() # view.clearNotificationMessage()
config.INPUT_SPEAKER_ENERGY_THRESHOLD = value config.INPUT_SPEAKER_ENERGY_THRESHOLD = value
view.setGuiVariable_SpeakerEnergyThreshold(config.INPUT_SPEAKER_ENERGY_THRESHOLD) # view.setGuiVariable_SpeakerEnergyThreshold(config.INPUT_SPEAKER_ENERGY_THRESHOLD)
else: else:
raise ValueError() raise ValueError()
except Exception: except Exception:
@@ -739,29 +744,32 @@ def callbackSetSpeakerDynamicEnergyThreshold(value) -> dict:
print("callbackSetSpeakerDynamicEnergyThreshold", value) print("callbackSetSpeakerDynamicEnergyThreshold", value)
config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value
if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True: if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True:
view.closeSpeakerEnergyThresholdWidget() # view.closeSpeakerEnergyThresholdWidget()
pass
else: else:
view.openSpeakerEnergyThresholdWidget() # view.openSpeakerEnergyThresholdWidget()
pass
return {"status":"success"} return {"status":"success"}
def setProgressBarSpeakerEnergy(energy): def setProgressBarSpeakerEnergy(energy):
view.updateSetProgressBar_SpeakerEnergy(energy) # view.updateSetProgressBar_SpeakerEnergy(energy)
pass
def callbackCheckSpeakerThreshold(is_turned_on): def callbackCheckSpeakerThreshold(is_turned_on):
print("callbackCheckSpeakerThreshold", is_turned_on) print("callbackCheckSpeakerThreshold", is_turned_on)
if is_turned_on is True: if is_turned_on is True:
view.replaceSpeakerThresholdCheckButton_Disabled() # view.replaceSpeakerThresholdCheckButton_Disabled()
model.startCheckSpeakerEnergy( model.startCheckSpeakerEnergy(
setProgressBarSpeakerEnergy, setProgressBarSpeakerEnergy,
view.initProgressBar_SpeakerEnergy, # view.initProgressBar_SpeakerEnergy,
view.showErrorMessage_CheckSpeakerThreshold_NoDevice # view.showErrorMessage_CheckSpeakerThreshold_NoDevice
) )
view.replaceSpeakerThresholdCheckButton_Active() # view.replaceSpeakerThresholdCheckButton_Active()
else: else:
view.replaceSpeakerThresholdCheckButton_Disabled() # view.replaceSpeakerThresholdCheckButton_Disabled()
model.stopCheckSpeakerEnergy() model.stopCheckSpeakerEnergy()
view.replaceSpeakerThresholdCheckButton_Passive() # view.replaceSpeakerThresholdCheckButton_Passive()
def callbackSetSpeakerRecordTimeout(value): def callbackSetSpeakerRecordTimeout(value):
print("callbackSetSpeakerRecordTimeout", value) print("callbackSetSpeakerRecordTimeout", value)
@@ -770,13 +778,14 @@ def callbackSetSpeakerRecordTimeout(value):
try: try:
value = int(value) value = int(value)
if 0 <= value and value <= config.INPUT_SPEAKER_PHRASE_TIMEOUT: if 0 <= value and value <= config.INPUT_SPEAKER_PHRASE_TIMEOUT:
view.clearNotificationMessage() # view.clearNotificationMessage()
config.INPUT_SPEAKER_RECORD_TIMEOUT = value config.INPUT_SPEAKER_RECORD_TIMEOUT = value
view.setGuiVariable_SpeakerRecordTimeout(config.INPUT_SPEAKER_RECORD_TIMEOUT) # view.setGuiVariable_SpeakerRecordTimeout(config.INPUT_SPEAKER_RECORD_TIMEOUT)
else: else:
raise ValueError() raise ValueError()
except Exception: except Exception:
view.showErrorMessage_SpeakerRecordTimeout() # view.showErrorMessage_SpeakerRecordTimeout()
pass
def callbackSetSpeakerPhraseTimeout(value): def callbackSetSpeakerPhraseTimeout(value):
print("callbackSetSpeakerPhraseTimeout", value) print("callbackSetSpeakerPhraseTimeout", value)
@@ -785,13 +794,14 @@ def callbackSetSpeakerPhraseTimeout(value):
try: try:
value = int(value) value = int(value)
if 0 <= value and value >= config.INPUT_SPEAKER_RECORD_TIMEOUT: if 0 <= value and value >= config.INPUT_SPEAKER_RECORD_TIMEOUT:
view.clearNotificationMessage() # view.clearNotificationMessage()
config.INPUT_SPEAKER_PHRASE_TIMEOUT = value config.INPUT_SPEAKER_PHRASE_TIMEOUT = value
view.setGuiVariable_SpeakerPhraseTimeout(config.INPUT_SPEAKER_PHRASE_TIMEOUT) # view.setGuiVariable_SpeakerPhraseTimeout(config.INPUT_SPEAKER_PHRASE_TIMEOUT)
else: else:
raise ValueError() raise ValueError()
except Exception: except Exception:
view.showErrorMessage_SpeakerPhraseTimeout() # view.showErrorMessage_SpeakerPhraseTimeout()
pass
def callbackSetSpeakerMaxPhrases(value): def callbackSetSpeakerMaxPhrases(value):
print("callbackSetSpeakerMaxPhrases", value) print("callbackSetSpeakerMaxPhrases", value)
@@ -800,20 +810,21 @@ def callbackSetSpeakerMaxPhrases(value):
try: try:
value = int(value) value = int(value)
if 0 <= value: if 0 <= value:
view.clearNotificationMessage() # view.clearNotificationMessage()
config.INPUT_SPEAKER_MAX_PHRASES = value config.INPUT_SPEAKER_MAX_PHRASES = value
view.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES) # view.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES)
else: else:
raise ValueError() raise ValueError()
except Exception: except Exception:
view.showErrorMessage_SpeakerMaxPhrases() # view.showErrorMessage_SpeakerMaxPhrases()
pass
# Transcription (Internal AI Model) # Transcription (Internal AI Model)
def callbackSetUserWhisperFeature(value): def callbackSetUserWhisperFeature(value):
print("callbackSetUserWhisperFeature", value) print("callbackSetUserWhisperFeature", value)
config.USE_WHISPER_FEATURE = value config.USE_WHISPER_FEATURE = value
if config.USE_WHISPER_FEATURE is True: if config.USE_WHISPER_FEATURE is True:
view.openWhisperWeightTypeWidget() # view.openWhisperWeightTypeWidget()
if model.checkTranscriptionWhisperModelWeight() is True: if model.checkTranscriptionWhisperModelWeight() is True:
config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = False config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = False
config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper" config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper"
@@ -821,22 +832,22 @@ def callbackSetUserWhisperFeature(value):
config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = True config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = True
config.SELECTED_TRANSCRIPTION_ENGINE = "Google" config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
else: else:
view.closeWhisperWeightTypeWidget() # view.closeWhisperWeightTypeWidget()
config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = False config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = False
config.SELECTED_TRANSCRIPTION_ENGINE = "Google" config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
view.showRestartButtonIfRequired() # view.showRestartButtonIfRequired()
def callbackSetWhisperWeightType(value): def callbackSetWhisperWeightType(value):
print("callbackSetWhisperWeightType", value) print("callbackSetWhisperWeightType", value)
config.WHISPER_WEIGHT_TYPE = str(value) config.WHISPER_WEIGHT_TYPE = str(value)
view.updateSelectedWhisperWeightType(config.WHISPER_WEIGHT_TYPE) # view.updateSelectedWhisperWeightType(config.WHISPER_WEIGHT_TYPE)
if model.checkTranscriptionWhisperModelWeight() is True: if model.checkTranscriptionWhisperModelWeight() is True:
config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = False config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = False
config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper" config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper"
else: else:
config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = True config.IS_RESET_BUTTON_DISPLAYED_FOR_WHISPER = True
config.SELECTED_TRANSCRIPTION_ENGINE = "Google" config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
view.showRestartButtonIfRequired() # view.showRestartButtonIfRequired()
# VR Tab # VR Tab
def callbackSetOverlaySettings(value, set_type:str): def callbackSetOverlaySettings(value, set_type:str):
@@ -862,9 +873,11 @@ def callbackSetEnableOverlaySmallLog(value):
model.shutdownOverlay() model.shutdownOverlay()
if config.ENABLE_OVERLAY_SMALL_LOG is True: if config.ENABLE_OVERLAY_SMALL_LOG is True:
view.setStateOverlaySmallLog("enabled") # view.setStateOverlaySmallLog("enabled")
pass
elif config.ENABLE_OVERLAY_SMALL_LOG is False: elif config.ENABLE_OVERLAY_SMALL_LOG is False:
view.setStateOverlaySmallLog("disabled") # view.setStateOverlaySmallLog("disabled")
pass
def callbackSetOverlaySmallLogSettings(value, set_type:str): def callbackSetOverlaySmallLogSettings(value, set_type:str):
print("callbackSetOverlaySmallLogSettings", value, set_type) print("callbackSetOverlaySmallLogSettings", value, set_type)
@@ -889,7 +902,7 @@ def callbackSetEnableSendOnlyTranslatedMessages(value):
def callbackSetSendMessageButtonType(value): def callbackSetSendMessageButtonType(value):
print("callbackSetSendMessageButtonType", value) print("callbackSetSendMessageButtonType", value)
config.SEND_MESSAGE_BUTTON_TYPE = value config.SEND_MESSAGE_BUTTON_TYPE = value
view.changeMainWindowSendMessageButton(config.SEND_MESSAGE_BUTTON_TYPE) # view.changeMainWindowSendMessageButton(config.SEND_MESSAGE_BUTTON_TYPE)
def callbackSetEnableNoticeXsoverlay(value): def callbackSetEnableNoticeXsoverlay(value):
print("callbackSetEnableNoticeXsoverlay", value) print("callbackSetEnableNoticeXsoverlay", value)
@@ -909,10 +922,10 @@ def callbackSetEnableVrcMicMuteSync(value):
config.ENABLE_VRC_MIC_MUTE_SYNC = value config.ENABLE_VRC_MIC_MUTE_SYNC = value
if config.ENABLE_VRC_MIC_MUTE_SYNC is True: if config.ENABLE_VRC_MIC_MUTE_SYNC is True:
model.startCheckMuteSelfStatus() model.startCheckMuteSelfStatus()
view.setStateVrcMicMuteSync("enabled") # view.setStateVrcMicMuteSync("enabled")
else: else:
model.stopCheckMuteSelfStatus() model.stopCheckMuteSelfStatus()
view.setStateVrcMicMuteSync("disabled") # view.setStateVrcMicMuteSync("disabled")
model.changeMicTranscriptStatus() model.changeMicTranscriptStatus()
@@ -925,44 +938,48 @@ def callbackSetSendMessageFormat(value):
print("callbackSetSendMessageFormat", value) print("callbackSetSendMessageFormat", value)
if isUniqueStrings(["[message]"], value) is True: if isUniqueStrings(["[message]"], value) is True:
config.SEND_MESSAGE_FORMAT = value config.SEND_MESSAGE_FORMAT = value
view.clearNotificationMessage() # view.clearNotificationMessage()
view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) # view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT)
else: else:
view.showErrorMessage_SendMessageFormat() # view.showErrorMessage_SendMessageFormat()
view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) # view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT)
pass
def callbackSetSendMessageFormatWithT(value): def callbackSetSendMessageFormatWithT(value):
print("callbackSetSendMessageFormatWithT", value) print("callbackSetSendMessageFormatWithT", value)
if len(value) > 0: if len(value) > 0:
if isUniqueStrings(["[message]", "[translation]"], value) is True: if isUniqueStrings(["[message]", "[translation]"], value) is True:
config.SEND_MESSAGE_FORMAT_WITH_T = value config.SEND_MESSAGE_FORMAT_WITH_T = value
view.clearNotificationMessage() # view.clearNotificationMessage()
view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) # view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T)
else: else:
view.showErrorMessage_SendMessageFormatWithT() # view.showErrorMessage_SendMessageFormatWithT()
view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) # view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T)
pass
# Others (Message Formats(Received) # Others (Message Formats(Received)
def callbackSetReceivedMessageFormat(value): def callbackSetReceivedMessageFormat(value):
print("callbackSetReceivedMessageFormat", value) print("callbackSetReceivedMessageFormat", value)
if isUniqueStrings(["[message]"], value) is True: if isUniqueStrings(["[message]"], value) is True:
config.RECEIVED_MESSAGE_FORMAT = value config.RECEIVED_MESSAGE_FORMAT = value
view.clearNotificationMessage() # view.clearNotificationMessage()
view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) # view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT)
else: else:
view.showErrorMessage_ReceivedMessageFormat() # view.showErrorMessage_ReceivedMessageFormat()
view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) # view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT)
pass
def callbackSetReceivedMessageFormatWithT(value): def callbackSetReceivedMessageFormatWithT(value):
print("callbackSetReceivedMessageFormatWithT", value) print("callbackSetReceivedMessageFormatWithT", value)
if len(value) > 0: if len(value) > 0:
if isUniqueStrings(["[message]", "[translation]"], value) is True: if isUniqueStrings(["[message]", "[translation]"], value) is True:
config.RECEIVED_MESSAGE_FORMAT_WITH_T = value config.RECEIVED_MESSAGE_FORMAT_WITH_T = value
view.clearNotificationMessage() # view.clearNotificationMessage()
view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) # view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T)
else: else:
view.showErrorMessage_ReceivedMessageFormatWithT() # view.showErrorMessage_ReceivedMessageFormatWithT()
view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) # view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T)
pass
# ---------------------Speaker2Chatbox--------------------- # ---------------------Speaker2Chatbox---------------------
def callbackSetEnableSendReceivedMessageToVrc(value): def callbackSetEnableSendReceivedMessageToVrc(value):
@@ -1004,15 +1021,15 @@ def initSetConfigByExeArguments():
args = parser.parse_args() args = parser.parse_args()
if args.ip is not None: if args.ip is not None:
config.OSC_IP_ADDRESS = str(args.ip) config.OSC_IP_ADDRESS = str(args.ip)
view.setGuiVariable_OscIpAddress(config.OSC_IP_ADDRESS) # view.setGuiVariable_OscIpAddress(config.OSC_IP_ADDRESS)
if args.port is not None: if args.port is not None:
config.OSC_PORT = int(args.port) config.OSC_PORT = int(args.port)
view.setGuiVariable_OscPort(config.OSC_PORT) # view.setGuiVariable_OscPort(config.OSC_PORT)
def createMainWindow(splash): def createMainWindow(splash):
splash.toProgress(1) splash.toProgress(1)
# create GUI # create GUI
view.createGUI() # view.createGUI()
splash.toProgress(2) splash.toProgress(2)
# init config # init config
@@ -1026,7 +1043,7 @@ def createMainWindow(splash):
auth_keys = config.AUTH_KEYS auth_keys = config.AUTH_KEYS
auth_keys["DeepL_API"] = None auth_keys["DeepL_API"] = None
config.AUTH_KEYS = auth_keys config.AUTH_KEYS = auth_keys
view.printToTextbox_AuthenticationError() # view.printToTextbox_AuthenticationError()
# set Translation Engine # set Translation Engine
updateTranslationEngineAndEngineList() updateTranslationEngineAndEngineList()
@@ -1042,7 +1059,8 @@ def createMainWindow(splash):
# check Software Updated # check Software Updated
if model.checkSoftwareUpdated() is True: if model.checkSoftwareUpdated() is True:
view.showUpdateAvailableButton() # view.showUpdateAvailableButton()
pass
# init logger # init logger
if config.ENABLE_LOGGER is True: if config.ENABLE_LOGGER is True:
@@ -1056,125 +1074,125 @@ def createMainWindow(splash):
splash.toProgress(3) # Last one. splash.toProgress(3) # Last one.
# set UI and callback # set UI and callback
view.register( # view.register(
common_registers={ # common_registers={
"callback_enable_easter_egg": callbackEnableEasterEgg, # "callback_enable_easter_egg": callbackEnableEasterEgg,
"callback_update_software": callbackUpdateSoftware, # "callback_update_software": callbackUpdateSoftware,
"callback_restart_software": callbackRestartSoftware, # "callback_restart_software": callbackRestartSoftware,
"callback_filepath_logs": callbackFilepathLogs, # "callback_filepath_logs": callbackFilepathLogs,
"callback_filepath_config_file": callbackFilepathConfigFile, # "callback_filepath_config_file": callbackFilepathConfigFile,
"callback_quit_vrct": callbackQuitVrct, # "callback_quit_vrct": callbackQuitVrct,
}, # },
window_action_registers={ # window_action_registers={
"callback_open_config_window": callbackOpenConfigWindow, # "callback_open_config_window": callbackOpenConfigWindow,
"callback_close_config_window": callbackCloseConfigWindow, # "callback_close_config_window": callbackCloseConfigWindow,
}, # },
main_window_registers={ # main_window_registers={
"callback_enable_main_window_sidebar_compact_mode": callbackEnableMainWindowSidebarCompactMode, # "callback_enable_main_window_sidebar_compact_mode": callbackEnableMainWindowSidebarCompactMode,
"callback_disable_main_window_sidebar_compact_mode": callbackDisableMainWindowSidebarCompactMode, # "callback_disable_main_window_sidebar_compact_mode": callbackDisableMainWindowSidebarCompactMode,
"callback_toggle_translation": callbackToggleTranslation, # "callback_toggle_translation": callbackToggleTranslation,
"callback_toggle_transcription_send": callbackToggleTranscriptionSend, # "callback_toggle_transcription_send": callbackToggleTranscriptionSend,
"callback_toggle_transcription_receive": callbackToggleTranscriptionReceive, # "callback_toggle_transcription_receive": callbackToggleTranscriptionReceive,
"callback_toggle_foreground": callbackToggleForeground, # "callback_toggle_foreground": callbackToggleForeground,
"callback_your_language": setYourLanguageAndCountry, # "callback_your_language": setYourLanguageAndCountry,
"callback_target_language": setTargetLanguageAndCountry, # "callback_target_language": setTargetLanguageAndCountry,
"values": model.getListLanguageAndCountry(), # "values": model.getListLanguageAndCountry(),
"callback_swap_languages": swapYourLanguageAndTargetLanguage, # "callback_swap_languages": swapYourLanguageAndTargetLanguage,
"callback_selected_language_preset_tab": callbackSelectedLanguagePresetTab, # "callback_selected_language_preset_tab": callbackSelectedLanguagePresetTab,
"callback_selected_translation_engine": callbackSelectedTranslationEngine, # "callback_selected_translation_engine": callbackSelectedTranslationEngine,
"message_box_bind_Return": messageBoxPressKeyEnter, # "message_box_bind_Return": messageBoxPressKeyEnter,
"message_box_bind_Any_KeyPress": messageBoxPressKeyAny, # "message_box_bind_Any_KeyPress": messageBoxPressKeyAny,
"message_box_bind_FocusIn": messageBoxFocusIn, # "message_box_bind_FocusIn": messageBoxFocusIn,
"message_box_bind_FocusOut": messageBoxFocusOut, # "message_box_bind_FocusOut": messageBoxFocusOut,
"message_box_bind_Up_KeyPress": messageBoxUpKeyPress, # "message_box_bind_Up_KeyPress": messageBoxUpKeyPress,
"message_box_bind_Down_KeyPress": messageBoxDownKeyPress, # "message_box_bind_Down_KeyPress": messageBoxDownKeyPress,
}, # },
config_window_registers={ # config_window_registers={
# Compact Mode Switch # # Compact Mode Switch
"callback_disable_config_window_compact_mode": callbackEnableConfigWindowCompactMode, # "callback_disable_config_window_compact_mode": callbackEnableConfigWindowCompactMode,
"callback_enable_config_window_compact_mode": callbackDisableConfigWindowCompactMode, # "callback_enable_config_window_compact_mode": callbackDisableConfigWindowCompactMode,
# Appearance Tab # # Appearance Tab
"callback_set_transparency": callbackSetTransparency, # "callback_set_transparency": callbackSetTransparency,
"callback_set_appearance": callbackSetAppearance, # "callback_set_appearance": callbackSetAppearance,
"callback_set_ui_scaling": callbackSetUiScaling, # "callback_set_ui_scaling": callbackSetUiScaling,
"callback_set_textbox_ui_scaling": callbackSetTextboxUiScaling, # "callback_set_textbox_ui_scaling": callbackSetTextboxUiScaling,
"callback_set_message_box_ratio": callbackSetMessageBoxRatio, # "callback_set_message_box_ratio": callbackSetMessageBoxRatio,
"callback_set_font_family": callbackSetFontFamily, # "callback_set_font_family": callbackSetFontFamily,
"callback_set_ui_language": callbackSetUiLanguage, # "callback_set_ui_language": callbackSetUiLanguage,
"callback_set_enable_restore_main_window_geometry": callbackSetEnableRestoreMainWindowGeometry, # "callback_set_enable_restore_main_window_geometry": callbackSetEnableRestoreMainWindowGeometry,
# Translation Tab # # Translation Tab
"callback_set_use_translation_feature": callbackSetUseTranslationFeature, # "callback_set_use_translation_feature": callbackSetUseTranslationFeature,
"callback_set_ctranslate2_weight_type": callbackSetCtranslate2WeightType, # "callback_set_ctranslate2_weight_type": callbackSetCtranslate2WeightType,
"callback_set_deepl_auth_key": callbackSetDeeplAuthKey, # "callback_set_deepl_auth_key": callbackSetDeeplAuthKey,
# Transcription Tab (Mic) # # Transcription Tab (Mic)
"callback_set_mic_host": callbackSetMicHost, # "callback_set_mic_host": callbackSetMicHost,
"list_mic_host": model.getListInputHost(), # "list_mic_host": model.getListInputHost(),
"callback_set_mic_device": callbackSetMicDevice, # "callback_set_mic_device": callbackSetMicDevice,
"list_mic_device": model.getListInputDevice(), # "list_mic_device": model.getListInputDevice(),
"callback_set_mic_energy_threshold": callbackSetMicEnergyThreshold, # "callback_set_mic_energy_threshold": callbackSetMicEnergyThreshold,
"callback_set_mic_dynamic_energy_threshold": callbackSetMicDynamicEnergyThreshold, # "callback_set_mic_dynamic_energy_threshold": callbackSetMicDynamicEnergyThreshold,
"callback_check_mic_threshold": callbackCheckMicThreshold, # "callback_check_mic_threshold": callbackCheckMicThreshold,
"callback_set_mic_record_timeout": callbackSetMicRecordTimeout, # "callback_set_mic_record_timeout": callbackSetMicRecordTimeout,
"callback_set_mic_phrase_timeout": callbackSetMicPhraseTimeout, # "callback_set_mic_phrase_timeout": callbackSetMicPhraseTimeout,
"callback_set_mic_max_phrases": callbackSetMicMaxPhrases, # "callback_set_mic_max_phrases": callbackSetMicMaxPhrases,
"callback_set_mic_word_filter": callbackSetMicWordFilter, # "callback_set_mic_word_filter": callbackSetMicWordFilter,
"callback_delete_mic_word_filter": callbackDeleteMicWordFilter, # "callback_delete_mic_word_filter": callbackDeleteMicWordFilter,
# Transcription Tab (Speaker) # # Transcription Tab (Speaker)
"callback_set_speaker_device": callbackSetSpeakerDevice, # "callback_set_speaker_device": callbackSetSpeakerDevice,
"list_speaker_device": model.getListOutputDevice(), # "list_speaker_device": model.getListOutputDevice(),
"callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold, # "callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold,
"callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold, # "callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold,
"callback_check_speaker_threshold": callbackCheckSpeakerThreshold, # "callback_check_speaker_threshold": callbackCheckSpeakerThreshold,
"callback_set_speaker_record_timeout": callbackSetSpeakerRecordTimeout, # "callback_set_speaker_record_timeout": callbackSetSpeakerRecordTimeout,
"callback_set_speaker_phrase_timeout": callbackSetSpeakerPhraseTimeout, # "callback_set_speaker_phrase_timeout": callbackSetSpeakerPhraseTimeout,
"callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases, # "callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases,
# Transcription Tab (Internal AI Model) # # Transcription Tab (Internal AI Model)
"callback_set_use_whisper_feature": callbackSetUserWhisperFeature, # "callback_set_use_whisper_feature": callbackSetUserWhisperFeature,
"callback_set_whisper_weight_type": callbackSetWhisperWeightType, # "callback_set_whisper_weight_type": callbackSetWhisperWeightType,
# VR Tab # # VR Tab
"callback_set_overlay_settings": callbackSetOverlaySettings, # "callback_set_overlay_settings": callbackSetOverlaySettings,
"callback_set_enable_overlay_small_log": callbackSetEnableOverlaySmallLog, # "callback_set_enable_overlay_small_log": callbackSetEnableOverlaySmallLog,
"callback_set_overlay_small_log_settings": callbackSetOverlaySmallLogSettings, # "callback_set_overlay_small_log_settings": callbackSetOverlaySmallLogSettings,
# Others Tab # # Others Tab
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, # "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
"callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages, # "callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages,
"callback_set_send_message_button_type": callbackSetSendMessageButtonType, # "callback_set_send_message_button_type": callbackSetSendMessageButtonType,
"callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay, # "callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay,
"callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs, # "callback_set_enable_auto_export_message_logs": callbackSetEnableAutoExportMessageLogs,
"callback_set_enable_vrc_mic_mute_sync": callbackSetEnableVrcMicMuteSync, # "callback_set_enable_vrc_mic_mute_sync": callbackSetEnableVrcMicMuteSync,
"callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc, # "callback_set_enable_send_message_to_vrc": callbackSetEnableSendMessageToVrc,
# Others(Message Formats(Send) # # Others(Message Formats(Send)
"callback_set_send_message_format": callbackSetSendMessageFormat, # "callback_set_send_message_format": callbackSetSendMessageFormat,
"callback_set_send_message_format_with_t": callbackSetSendMessageFormatWithT, # "callback_set_send_message_format_with_t": callbackSetSendMessageFormatWithT,
# Others(Message Formats(Received) # # Others(Message Formats(Received)
"callback_set_received_message_format": callbackSetReceivedMessageFormat, # "callback_set_received_message_format": callbackSetReceivedMessageFormat,
"callback_set_received_message_format_with_t": callbackSetReceivedMessageFormatWithT, # "callback_set_received_message_format_with_t": callbackSetReceivedMessageFormatWithT,
# Speaker2Chatbox---------------- # # Speaker2Chatbox----------------
"callback_set_enable_send_received_message_to_vrc": callbackSetEnableSendReceivedMessageToVrc, # "callback_set_enable_send_received_message_to_vrc": callbackSetEnableSendReceivedMessageToVrc,
# Speaker2Chatbox---------------- # # Speaker2Chatbox----------------
# Advanced Settings Tab # # Advanced Settings Tab
"callback_set_osc_ip_address": callbackSetOscIpAddress, # "callback_set_osc_ip_address": callbackSetOscIpAddress,
"callback_set_osc_port": callbackSetOscPort, # "callback_set_osc_port": callbackSetOscPort,
}, # },
) # )
def showMainWindow(): # def showMainWindow():
view.startMainLoop() # view.startMainLoop()