👍️[Update] Main/Controller : Callbackのpathとinitを追加

This commit is contained in:
misyaguziya
2024-08-07 16:46:34 +09:00
parent 3f814d123c
commit 8494bd2197
2 changed files with 70 additions and 28 deletions

View File

@@ -1093,27 +1093,7 @@ def getListInputDevice():
def getListOutputDevice():
return model.getListOutputDevice()
def initSetConfigByExeArguments():
parser = argparse.ArgumentParser()
parser.add_argument("--ip")
parser.add_argument("--port")
args = parser.parse_args()
if args.ip is not None:
config.OSC_IP_ADDRESS = str(args.ip)
# view.setGuiVariable_OscIpAddress(config.OSC_IP_ADDRESS)
if args.port is not None:
config.OSC_PORT = int(args.port)
# view.setGuiVariable_OscPort(config.OSC_PORT)
def createMainWindow(splash):
splash.toProgress(1)
# create GUI
# view.createGUI()
splash.toProgress(2)
# init config
initSetConfigByExeArguments()
def init():
initSetTranslateEngine()
initSetLanguageAndCountry()
@@ -1123,7 +1103,6 @@ def createMainWindow(splash):
auth_keys = config.AUTH_KEYS
auth_keys["DeepL_API"] = None
config.AUTH_KEYS = auth_keys
# view.printToTextbox_AuthenticationError()
# set Translation Engine
updateTranslationEngineAndEngineList()
@@ -1151,7 +1130,64 @@ def createMainWindow(splash):
if config.ENABLE_VRC_MIC_MUTE_SYNC is True:
model.startCheckMuteSelfStatus()
splash.toProgress(3) # Last one.
# def initSetConfigByExeArguments():
# parser = argparse.ArgumentParser()
# parser.add_argument("--ip")
# parser.add_argument("--port")
# args = parser.parse_args()
# if args.ip is not None:
# config.OSC_IP_ADDRESS = str(args.ip)
# # view.setGuiVariable_OscIpAddress(config.OSC_IP_ADDRESS)
# if args.port is not None:
# config.OSC_PORT = int(args.port)
# # view.setGuiVariable_OscPort(config.OSC_PORT)
# def createMainWindow(splash):
# splash.toProgress(1)
# # create GUI
# # view.createGUI()
# splash.toProgress(2)
# # init config
# initSetConfigByExeArguments()
# initSetTranslateEngine()
# initSetLanguageAndCountry()
# if config.AUTH_KEYS["DeepL_API"] is not None:
# if model.authenticationTranslatorDeepLAuthKey(auth_key=config.AUTH_KEYS["DeepL_API"]) is False:
# # error update Auth key
# auth_keys = config.AUTH_KEYS
# auth_keys["DeepL_API"] = None
# config.AUTH_KEYS = auth_keys
# # view.printToTextbox_AuthenticationError()
# # set Translation Engine
# updateTranslationEngineAndEngineList()
# # set Transcription Engine
# if config.USE_WHISPER_FEATURE is True:
# config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper"
# else:
# config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
# # set word filter
# model.addKeywords()
# # check Software Updated
# if model.checkSoftwareUpdated() is True:
# # view.showUpdateAvailableButton()
# pass
# # init logger
# if config.ENABLE_LOGGER is True:
# model.startLogger()
# # init OSC receive
# model.startReceiveOSC()
# if config.ENABLE_VRC_MIC_MUTE_SYNC is True:
# model.startCheckMuteSelfStatus()
# splash.toProgress(3) # Last one.
# set UI and callback
# view.register(

View File

@@ -166,15 +166,20 @@ controller_mapping = {
"/controller/callback_set_enable_auto_clear_chatbox": controller.callbackSetEnableAutoClearMessageBox,
"/controller/callback_set_send_only_translated_messages": controller.callbackSetEnableSendOnlyTranslatedMessages,
"/controller/callback_set_send_message_button_type": controller.callbackSetSendMessageButtonType,
"/controller/callback_set_enable_notice_xsoverlay": controller.callbackSetEnableNoticeXsoverlay,
"/controller/callback_set_enable_auto_export_message_logs": controller.callbackSetEnableAutoExportMessageLogs,
"/controller/callback_set_enable_vrc_mic_mute_sync": controller.callbackSetEnableVrcMicMuteSync,
"/controller/callback_set_enable_send_message_to_vrc": controller.callbackSetEnableSendMessageToVrc,
"/controller/callback_enable_notice_xsoverlay": controller.callbackEnableNoticeXsoverlay,
"/controller/callback_disable_notice_xsoverlay": controller.callbackDisableNoticeXsoverlay,
"/controller/callback_enable_auto_export_message_logs": controller.callbackEnableAutoExportMessageLogs,
"/controller/callback_disable_auto_export_message_logs": controller.callbackDisableAutoExportMessageLogs,
"/controller/callback_enable_vrc_mic_mute_sync": controller.callbackEnableVrcMicMuteSync,
"/controller/callback_disable_vrc_mic_mute_sync": controller.callbackDisableVrcMicMuteSync,
"/controller/callback_enable_send_message_to_vrc": controller.callbackEnableSendMessageToVrc,
"/controller/callback_disable_send_message_to_vrc": controller.callbackDisableSendMessageToVrc,
"/controller/callback_set_send_message_format": controller.callbackSetSendMessageFormat,
"/controller/callback_set_send_message_format_with_t": controller.callbackSetSendMessageFormatWithT,
"/controller/callback_set_received_message_format": controller.callbackSetReceivedMessageFormat,
"/controller/callback_set_received_message_format_with_t": controller.callbackSetReceivedMessageFormatWithT,
"/controller/callback_set_enable_send_received_message_to_vrc": controller.callbackSetEnableSendReceivedMessageToVrc,
"/controller/callback_enable_send_received_message_to_vrc": controller.callbackEnableSendReceivedMessageToVrc,
"/controller/callback_disable_send_received_message_to_vrc": controller.callbackDisableSendReceivedMessageToVrc,
"/controller/callback_set_osc_ip_address": controller.callbackSetOscIpAddress,
"/controller/callback_set_osc_port": controller.callbackSetOscPort,
}
@@ -285,6 +290,7 @@ if __name__ == "__main__":
# print(response, flush=True)
try:
controller.init()
print(json.dumps({"init_key_from_py": "Initialization from Python."}), flush=True)
while True:
main()