Setting box: add Translation tab. add item DeepL Auth Key.

This commit is contained in:
Sakamoto Shiina
2023-08-30 02:14:50 +09:00
parent 338a29baa3
commit ff306ed53d
4 changed files with 45 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ from .addConfigSideMenuItem import addConfigSideMenuItem
from .createSettingBoxContainer import createSettingBoxContainer
from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others, createSettingBox_AdvancedSettings
from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Translation, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others, createSettingBox_AdvancedSettings
def createSideMenuAndSettingsBoxContainers(config_window, settings):
@@ -64,7 +64,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings):
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_translation",
"setting_boxes": [
{ "section_title": None, "setting_box": None },
{ "section_title": None, "setting_box": createSettingBox_Translation },
]
},
},

View File

@@ -2,3 +2,4 @@ from .setting_box_appearance import createSettingBox_Appearance
from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker
from .setting_box_others import createSettingBox_Others
from .setting_box_advanced_settings import createSettingBox_AdvancedSettings
from .setting_box_translation import createSettingBox_Translation

View File

@@ -0,0 +1 @@
from .createSettingBox_Translation import createSettingBox_Translation

View File

@@ -0,0 +1,40 @@
from time import sleep
from customtkinter import StringVar, IntVar
from ..SettingBoxGenerator import SettingBoxGenerator
from config import config
def createSettingBox_Translation(setting_box_wrapper, config_window, settings):
sbg = SettingBoxGenerator(config_window, settings)
createSettingBoxEntry = sbg.createSettingBoxEntry
def deepl_authkey_callback(value):
print(str(value))
# config.AUTH_KEYS["DeepL(auth)"] = str(value)
# if len(value) > 0:
# if model.authenticationTranslator(choice_translator="DeepL(auth)", auth_key=value) is True:
# print_textbox(self.parent.textbox_message_log, "Auth key update completed", "INFO")
# print_textbox(self.parent.textbox_message_system_log, "Auth key update completed", "INFO")
# else:
# pass
row=0
config_window.sb__deepl_authkey = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="DeepL Auth Key",
desc_text="",
entry_attr_name="sb__deepl_authkey",
entry_width=settings.uism.SB__ENTRY_WIDTH_300,
entry_bind__Any_KeyRelease=lambda value: deepl_authkey_callback(value),
entry_textvariable=StringVar(value=config.AUTH_KEYS["DeepL(auth)"]),
)
config_window.sb__deepl_authkey.grid(row=row)
row+=1