[Update] Config Window: Restore DeepL Auth Key UI

This commit is contained in:
Sakamoto Shiina
2023-10-19 15:36:04 +09:00
parent d6dfd0ae9a
commit 7aefe652e5
5 changed files with 43 additions and 25 deletions

View File

@@ -71,7 +71,7 @@ config_window:
side_menu_labels:
appearance: Appearance
# translation: Translation
translation: Translation
transcription: Transcription
transcription_mic: Mic
transcription_speaker: Speaker
@@ -96,8 +96,8 @@ config_window:
ui_language:
label: UI Language
# deepl_auth_key:
# label: DeepL Auth Key
deepl_auth_key:
label: DeepL Auth Key
mic_host:
label: Mic Host/Driver

View File

@@ -72,7 +72,7 @@ config_window:
side_menu_labels:
appearance: デザイン
# translation: 翻訳
translation: 翻訳
transcription: 音声認識
transcription_mic: マイク
transcription_speaker: スピーカー
@@ -97,8 +97,8 @@ config_window:
ui_language:
label: UIの言語 / UI Language
# deepl_auth_key:
# label: DeepL 認証キー
deepl_auth_key:
label: DeepL 認証キー
mic_host:
label: マイク(ホスト/ドライバー)

10
view.py
View File

@@ -223,10 +223,10 @@ class View():
# Translation Tab
# VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value=i18n.t("config_window.deepl_auth_key.label")),
# VAR_DESC_DEEPL_AUTH_KEY=None,
# CALLBACK_SET_DEEPL_AUTH_KEY=None,
# VAR_DEEPL_AUTH_KEY=StringVar(value=""),
VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value=i18n.t("config_window.deepl_auth_key.label")),
VAR_DESC_DEEPL_AUTH_KEY=None,
CALLBACK_SET_DEEPL_AUTH_KEY=None,
VAR_DEEPL_AUTH_KEY=StringVar(value=""),
# Transcription Tab (Mic)
@@ -435,7 +435,7 @@ class View():
# Translation Tab
# self.view_variable.CALLBACK_SET_DEEPL_AUTHKEY = config_window_registers.get("callback_set_deepl_authkey", None)
self.view_variable.CALLBACK_SET_DEEPL_AUTHKEY = config_window_registers.get("callback_set_deepl_authkey", None)
# Transcription Tab (Mic)
self.view_variable.CALLBACK_SET_MIC_HOST = config_window_registers.get("callback_set_mic_host", None)

View File

@@ -10,7 +10,7 @@ from .setting_box_containers.setting_box_appearance import createSettingBox_Appe
from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker
from .setting_box_containers.setting_box_others import createSettingBox_Others
from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings
# from .setting_box_containers.setting_box_translation import createSettingBox_Translation
from .setting_box_containers.setting_box_translation import createSettingBox_Translation
def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variable):
@@ -66,18 +66,18 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
]
},
},
# {
# "side_menu_tab_attr_name": "side_menu_tab_translation",
# "label_attr_name": "label_translation",
# "selected_mark_attr_name": "selected_mark_translation",
# "textvariable": view_variable.VAR_SIDE_MENU_LABEL_TRANSLATION,
# "setting_box_container_settings": {
# "setting_box_container_attr_name": "setting_box_container_translation",
# "setting_boxes": [
# { "var_section_title": None, "setting_box": createSettingBox_Translation },
# ]
# },
# },
{
"side_menu_tab_attr_name": "side_menu_tab_translation",
"label_attr_name": "label_translation",
"selected_mark_attr_name": "selected_mark_translation",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_TRANSLATION,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_translation",
"setting_boxes": [
{ "var_section_title": None, "setting_box": createSettingBox_Translation },
]
},
},
{
"side_menu_tab_attr_name": "side_menu_tab_transcription",
"label_attr_name": "label_transcription",

View File

@@ -3,4 +3,22 @@ from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_Translation(setting_box_wrapper, config_window, settings, view_variable):
pass
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBoxEntry = sbg.createSettingBoxEntry
def deepl_authkey_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_DEEPL_AUTHKEY, value)
row=0
config_window.sb__deepl_authkey = createSettingBoxEntry(
for_var_label_text=view_variable.VAR_LABEL_DEEPL_AUTH_KEY,
for_var_desc_text=view_variable.VAR_DESC_DEEPL_AUTH_KEY,
entry_attr_name="sb__entry_deepl_authkey",
entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300,
entry_bind__Any_KeyRelease=lambda value: deepl_authkey_callback(value),
entry_textvariable=view_variable.VAR_DEEPL_AUTH_KEY,
)
config_window.sb__deepl_authkey.grid(row=row, pady=0)
row+=1