[Update] Config Window: Localization. 各項目のタイトルを変数化、多言語対応。(それに合わせて切り替え処理も)
This commit is contained in:
@@ -51,8 +51,8 @@ def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_set
|
||||
config_window.main_setting_box_scrollable_container._parent_canvas.yview_moveto("0")
|
||||
|
||||
|
||||
def switchToTargetSettingBoxContainer(e, text, target_active_tab_widget_attr_name, target_setting_box_container_attr_name):
|
||||
config_window.main_current_active_config_title.configure(text=text)
|
||||
def switchToTargetSettingBoxContainer(textvariable, target_active_tab_widget_attr_name, target_setting_box_container_attr_name):
|
||||
view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(textvariable.get())
|
||||
target_active_tab_widget = getattr(config_window, target_active_tab_widget_attr_name)
|
||||
switchSettingBoxContainerTabFunction(target_active_tab_widget)
|
||||
switchSettingBoxContainer(target_setting_box_container_attr_name)
|
||||
@@ -65,11 +65,10 @@ def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_set
|
||||
side_menu_tab_attr_name = side_menu_settings["side_menu_tab_attr_name"]
|
||||
label_attr_name = side_menu_settings["label_attr_name"]
|
||||
selected_mark_attr_name = side_menu_settings["selected_mark_attr_name"]
|
||||
text = side_menu_settings["text"]
|
||||
textvariable = side_menu_settings["textvariable"]
|
||||
setting_box_container_attr_name = side_menu_settings["setting_box_container_settings"]["setting_box_container_attr_name"]
|
||||
command = lambda e: switchToTargetSettingBoxContainer(
|
||||
e=e,
|
||||
text=text,
|
||||
command = lambda _e: switchToTargetSettingBoxContainer(
|
||||
textvariable=textvariable,
|
||||
target_active_tab_widget_attr_name=side_menu_tab_attr_name,
|
||||
target_setting_box_container_attr_name=setting_box_container_attr_name,
|
||||
)
|
||||
@@ -84,7 +83,7 @@ def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_set
|
||||
|
||||
label_widget = CTkLabel(
|
||||
frame_widget,
|
||||
text=text,
|
||||
textvariable=textvariable,
|
||||
height=0,
|
||||
corner_radius=0,
|
||||
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SIDE_MENU_LABELS_FONT_SIZE, weight="normal"),
|
||||
|
||||
@@ -4,12 +4,12 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel
|
||||
def _createSettingBoxContainer(config_window, settings, view_variable, setting_box_container_settings):
|
||||
|
||||
|
||||
def createSectionTitle(container_widget, section_title):
|
||||
def createSectionTitle(container_widget, var_section_title):
|
||||
setting_box_wrapper_section_title_frame = CTkFrame(container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0)
|
||||
|
||||
setting_box_wrapper_section_title = CTkLabel(
|
||||
setting_box_wrapper_section_title_frame,
|
||||
text=section_title,
|
||||
textvariable=var_section_title,
|
||||
anchor="w",
|
||||
height=0,
|
||||
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SB__SECTION_TITLE_FONT_SIZE, weight="normal"),
|
||||
@@ -35,10 +35,10 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b
|
||||
|
||||
setting_box_and_section_title_wrapper = CTkFrame(setting_box_container_widget, fg_color=settings.ctm.SB__WRAPPER_BG_COLOR, corner_radius=0, width=0, height=0)
|
||||
|
||||
if setting_box_setting["section_title"] is not None:
|
||||
if setting_box_setting["var_section_title"] is not None:
|
||||
setting_box_wrapper_section_title_frame= createSectionTitle(
|
||||
container_widget=setting_box_and_section_title_wrapper,
|
||||
section_title=setting_box_setting["section_title"],
|
||||
var_section_title=setting_box_setting["var_section_title"],
|
||||
)
|
||||
setting_box_wrapper_section_title_frame.grid(row=0, column=0, sticky="ew", padx=0, pady=0)
|
||||
if i == 0: SB__TOP_PADY = settings.uism.SB__TOP_PADY_IF_WITH_SECTION_TITLE
|
||||
|
||||
@@ -52,11 +52,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
"side_menu_tab_attr_name": "side_menu_tab_appearance",
|
||||
"label_attr_name": "label_appearance",
|
||||
"selected_mark_attr_name": "selected_mark_appearance",
|
||||
"text": "Appearance",
|
||||
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_APPEARANCE,
|
||||
"setting_box_container_settings": {
|
||||
"setting_box_container_attr_name": "setting_box_container_appearance",
|
||||
"setting_boxes": [
|
||||
{ "section_title": None, "setting_box": createSettingBox_Appearance },
|
||||
{ "var_section_title": None, "setting_box": createSettingBox_Appearance },
|
||||
]
|
||||
},
|
||||
},
|
||||
@@ -64,11 +64,11 @@ 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",
|
||||
"text": "Translation",
|
||||
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_TRANSLATION,
|
||||
"setting_box_container_settings": {
|
||||
"setting_box_container_attr_name": "setting_box_container_translation",
|
||||
"setting_boxes": [
|
||||
{ "section_title": None, "setting_box": createSettingBox_Translation },
|
||||
{ "var_section_title": None, "setting_box": createSettingBox_Translation },
|
||||
]
|
||||
},
|
||||
},
|
||||
@@ -76,12 +76,18 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
"side_menu_tab_attr_name": "side_menu_tab_transcription",
|
||||
"label_attr_name": "label_transcription",
|
||||
"selected_mark_attr_name": "selected_mark_transcription",
|
||||
"text": "Transcription",
|
||||
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_TRANSCRIPTION,
|
||||
"setting_box_container_settings": {
|
||||
"setting_box_container_attr_name": "setting_box_container_transcription",
|
||||
"setting_boxes": [
|
||||
{ "section_title": "Mic", "setting_box": createSettingBox_Mic },
|
||||
{ "section_title": "Speaker", "setting_box": createSettingBox_Speaker },
|
||||
{
|
||||
"var_section_title": view_variable.VAR_SECOND_TITLE_TRANSCRIPTION_MIC,
|
||||
"setting_box": createSettingBox_Mic
|
||||
},
|
||||
{
|
||||
"var_section_title": view_variable.VAR_SECOND_TITLE_TRANSCRIPTION_SPEAKER,
|
||||
"setting_box": createSettingBox_Speaker
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
@@ -89,11 +95,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
"side_menu_tab_attr_name": "side_menu_tab_others",
|
||||
"label_attr_name": "label_others",
|
||||
"selected_mark_attr_name": "selected_mark_others",
|
||||
"text": "Others",
|
||||
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_OTHERS,
|
||||
"setting_box_container_settings": {
|
||||
"setting_box_container_attr_name": "setting_box_container_others",
|
||||
"setting_boxes": [
|
||||
{ "section_title": None, "setting_box": createSettingBox_Others },
|
||||
{ "var_section_title": None, "setting_box": createSettingBox_Others },
|
||||
]
|
||||
},
|
||||
},
|
||||
@@ -101,11 +107,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
"side_menu_tab_attr_name": "side_menu_tab_advanced",
|
||||
"label_attr_name": "label_advanced",
|
||||
"selected_mark_attr_name": "selected_mark_advanced",
|
||||
"text": "Advanced Settings",
|
||||
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_ADVANCED_SETTINGS,
|
||||
"setting_box_container_settings": {
|
||||
"setting_box_container_attr_name": "setting_box_container_advanced",
|
||||
"setting_boxes": [
|
||||
{ "section_title": None, "setting_box": createSettingBox_AdvancedSettings },
|
||||
{ "var_section_title": None, "setting_box": createSettingBox_AdvancedSettings },
|
||||
]
|
||||
},
|
||||
},
|
||||
@@ -138,7 +144,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
|
||||
if sm_and_sbc_setting["side_menu_tab_attr_name"] == view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME:
|
||||
# Set default active side menu tab
|
||||
config_window.main_current_active_config_title.configure(text=sm_and_sbc_setting["text"])
|
||||
view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(sm_and_sbc_setting["textvariable"].get())
|
||||
config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"])
|
||||
_setDefaultActiveTab(
|
||||
active_tab_widget=config_window.current_active_side_menu_tab,
|
||||
|
||||
Reference in New Issue
Block a user