[update] auth keyが設定されている場合、優先的にDeepL(auth)を使用するように変更
※view.pyにprintToTextbox_AuthenticationSuccessが実装される前提で実装
This commit is contained in:
12
main.py
12
main.py
@@ -237,13 +237,11 @@ def callbackSetUiLanguage(value):
|
|||||||
# Translation Tab
|
# Translation Tab
|
||||||
def callbackSetDeeplAuthkey(value):
|
def callbackSetDeeplAuthkey(value):
|
||||||
print("callbackSetDeeplAuthkey", str(value))
|
print("callbackSetDeeplAuthkey", str(value))
|
||||||
# config.AUTH_KEYS["DeepL(auth)"] = str(value)
|
if len(value) > 0 and model.authenticationTranslator(callbackSetAuthKeys, choice_translator="DeepL(auth)", auth_key=value) is True:
|
||||||
# if len(value) > 0:
|
config.CHOICE_TRANSLATOR = "DeepL(auth)"
|
||||||
# if model.authenticationTranslator(callbackSetAuthKeys, choice_translator="DeepL(auth)", auth_key=value) is True:
|
view.printToTextbox_AuthenticationSuccess()
|
||||||
# print_textbox(self.parent.textbox_message_log, "Auth key update completed", "INFO")
|
else:
|
||||||
# print_textbox(self.parent.textbox_message_system_log, "Auth key update completed", "INFO")
|
view.printToTextbox_AuthenticationError()
|
||||||
# else:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# Transcription Tab (Mic)
|
# Transcription Tab (Mic)
|
||||||
def callbackSetMicHost(value):
|
def callbackSetMicHost(value):
|
||||||
|
|||||||
8
model.py
8
model.py
@@ -78,7 +78,7 @@ class Model:
|
|||||||
if result:
|
if result:
|
||||||
auth_keys = config.AUTH_KEYS
|
auth_keys = config.AUTH_KEYS
|
||||||
auth_keys[choice_translator] = auth_key
|
auth_keys[choice_translator] = auth_key
|
||||||
fnc(auth_key)
|
fnc(auth_keys)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def startLogger(self):
|
def startLogger(self):
|
||||||
@@ -119,7 +119,11 @@ class Model:
|
|||||||
target_languages = translation_lang.get(engine, {}).get("target", {})
|
target_languages = translation_lang.get(engine, {}).get("target", {})
|
||||||
if source_lang in source_languages and target_lang in target_languages:
|
if source_lang in source_languages and target_lang in target_languages:
|
||||||
compatible_engines.append(engine)
|
compatible_engines.append(engine)
|
||||||
return compatible_engines[0]
|
engine_name = compatible_engines[0]
|
||||||
|
|
||||||
|
if engine_name == "DeepL(web)" and config.AUTH_KEYS["DeepL(auth)"] != None:
|
||||||
|
engine_name = "DeepL(auth)"
|
||||||
|
return engine_name
|
||||||
|
|
||||||
def getTranslatorStatus(self):
|
def getTranslatorStatus(self):
|
||||||
return self.translator.translator_status[config.CHOICE_TRANSLATOR]
|
return self.translator.translator_status[config.CHOICE_TRANSLATOR]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# translatorEngine = ["DeepL(web)", "DeepL(auth)", "Google(web)", "Bing(web)"]
|
translatorEngine = ["DeepL(web)", "DeepL(auth)", "Google(web)", "Bing(web)"]
|
||||||
translatorEngine = ["DeepL(web)", "Google(web)", "Bing(web)"]
|
|
||||||
translation_lang = {}
|
translation_lang = {}
|
||||||
dict_deepl_web_languages = {
|
dict_deepl_web_languages = {
|
||||||
"Japanese":"JA",
|
"Japanese":"JA",
|
||||||
|
|||||||
Reference in New Issue
Block a user