[Update] Main Window: Language Settings.言語選択時のドロップダウンメニューを既存のものからカスタムしたものに変更。とりあえず機能する状態。
This commit is contained in:
@@ -28,8 +28,8 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
switchActiveAndPassivePresetsTabsColor(target_active_widget)
|
||||
switchActiveTabAndPassiveTab(target_active_widget, main_window.current_active_preset_tab, main_window.current_active_preset_tab.passive_function, settings.ctm.SLS__PRESETS_TAB_BG_HOVERED_COLOR, settings.ctm.SLS__PRESETS_TAB_BG_CLICKED_COLOR, settings.ctm.SLS__PRESETS_TAB_BG_PASSIVE_COLOR)
|
||||
|
||||
main_window.sls__optionmenu_your_language.set(view_variable.VAR_YOUR_LANGUAGE.get())
|
||||
main_window.sls__optionmenu_target_language.set(view_variable.VAR_TARGET_LANGUAGE.get())
|
||||
# main_window.sls__optionmenu_your_language.set(view_variable.VAR_YOUR_LANGUAGE.get())
|
||||
# main_window.sls__optionmenu_target_language.set(view_variable.VAR_TARGET_LANGUAGE.get())
|
||||
main_window.current_active_preset_tab = target_active_widget
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
|
||||
|
||||
|
||||
def createLanguageSettingBox(parent_widget, var_title_text, title_text_attr_name, optionmenu_attr_name, dropdown_menu_values, command, variable):
|
||||
def createLanguageSettingBox(parent_widget, var_title_text, title_text_attr_name, optionmenu_attr_name, dropdown_menu_values, open_selectable_language_window_command, variable):
|
||||
sls__box = CTkFrame(parent_widget, corner_radius=0, fg_color=settings.ctm.SLS__BOX_BG_COLOR, width=0, height=0)
|
||||
|
||||
sls__box.columnconfigure((0,2), weight=1)
|
||||
@@ -97,19 +97,37 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
|
||||
|
||||
|
||||
createOption_DropdownMenu_for_languageSettings(
|
||||
main_window,
|
||||
sls__box_wrapper,
|
||||
optionmenu_attr_name,
|
||||
dropdown_menu_values=dropdown_menu_values,
|
||||
command=command,
|
||||
width=settings.uism.SLS__BOX_DROPDOWN_MENU_WIDTH,
|
||||
font_size=settings.uism.SLS__BOX_DROPDOWN_MENU_FONT_SIZE,
|
||||
text_color=settings.ctm.LABELS_TEXT_COLOR,
|
||||
variable=variable,
|
||||
# variable=StringVar(value="Chinese, Cantonese\n(Traditional Hong Kong)"),
|
||||
|
||||
sls__selected_language_box = CTkFrame(sls__box_wrapper, corner_radius=0, fg_color=settings.ctm.SLS__DROPDOWN_MENU_BG_COLOR, width=200, height=30)
|
||||
sls__selected_language_box.grid(row=1, column=0)
|
||||
|
||||
|
||||
sls__selected_language_box.columnconfigure(0, minsize=200)
|
||||
sls__selected_language_box.rowconfigure(0, minsize=30)
|
||||
sls__selected_language_label = CTkFrame(sls__selected_language_box, corner_radius=0, fg_color=settings.ctm.SLS__DROPDOWN_MENU_BG_COLOR)
|
||||
sls__selected_language_label.grid(row=0, column=0)
|
||||
|
||||
sls__selected_language_label = CTkLabel(
|
||||
sls__selected_language_label,
|
||||
textvariable=variable,
|
||||
height=0,
|
||||
# anchor="center",
|
||||
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SLS__BOX_DROPDOWN_MENU_FONT_SIZE, weight="normal"),
|
||||
text_color=settings.ctm.SLS__BOX_SECTION_TITLE_TEXT_COLOR
|
||||
)
|
||||
getattr(main_window, optionmenu_attr_name).grid(row=1, column=0, padx=0, pady=0)
|
||||
sls__selected_language_label.grid(row=0, column=0, pady=2)
|
||||
setattr(main_window, title_text_attr_name, sls__selected_language_label)
|
||||
open_selectable_language_window_command
|
||||
|
||||
|
||||
|
||||
|
||||
# bindEnterAndLeaveColor([self.wrapper, label_widget], self.settings.ctm.LANGUAGE_BUTTON_BG_HOVERED_COLOR, self.settings.ctm.LANGUAGE_BUTTON_BG_COLOR)
|
||||
# bindButtonPressColor([self.wrapper, label_widget], self.settings.ctm.LANGUAGE_BUTTON_BG_CLICKED_COLOR, self.settings.ctm.LANGUAGE_BUTTON_BG_COLOR)
|
||||
|
||||
|
||||
|
||||
bindButtonReleaseFunction([sls__selected_language_box, sls__selected_language_label], open_selectable_language_window_command)
|
||||
|
||||
return sls__box
|
||||
|
||||
@@ -204,12 +222,12 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
column+=1
|
||||
|
||||
|
||||
def selectYourLanguageCommand(value):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SELECTED_YOUR_LANGUAGE, value)
|
||||
def callbackOpenSelectableYourLanguageWindow(value):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_OPEN_SELECTABLE_YOUR_LANGUAGE_WINDOW, value)
|
||||
|
||||
|
||||
def selectTargetLanguageCommand(value):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SELECTED_TARGET_LANGUAGE, value)
|
||||
def callbackOpenSelectableTargetLanguageWindow(value):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_OPEN_SELECTABLE_TARGET_LANGUAGE_WINDOW, value)
|
||||
|
||||
# Language Settings BOX
|
||||
main_window.sls__box_frame = CTkFrame(main_window.sls__container, corner_radius=0, fg_color=settings.ctm.SLS__BG_COLOR, width=0, height=0)
|
||||
@@ -223,7 +241,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
title_text_attr_name="sls__title_text_your_language",
|
||||
optionmenu_attr_name="sls__optionmenu_your_language",
|
||||
dropdown_menu_values=view_variable.LIST_SELECTABLE_LANGUAGES,
|
||||
command=selectYourLanguageCommand,
|
||||
open_selectable_language_window_command=callbackOpenSelectableYourLanguageWindow,
|
||||
variable=view_variable.VAR_YOUR_LANGUAGE
|
||||
)
|
||||
main_window.sls__box_your_language.grid(row=2, column=0, padx=0, pady=(settings.uism.SLS__BOX_TOP_PADY,0),sticky="ew")
|
||||
@@ -271,7 +289,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
title_text_attr_name="sls__title_text_target_language",
|
||||
optionmenu_attr_name="sls__optionmenu_target_language",
|
||||
dropdown_menu_values=view_variable.LIST_SELECTABLE_LANGUAGES,
|
||||
command=selectTargetLanguageCommand,
|
||||
open_selectable_language_window_command=callbackOpenSelectableTargetLanguageWindow,
|
||||
variable=view_variable.VAR_TARGET_LANGUAGE
|
||||
)
|
||||
main_window.sls__box_target_language.grid(row=4, column=0, padx=0, pady=(0,0),sticky="ew")
|
||||
Reference in New Issue
Block a user