[Add] Main Window: Language Settings. 言語選択ボタンを押して言語選択ウィンドウ開閉時に、矢印の向きが反転するように。

[Bugfix] 根本的な解決ではないけれど、言語選択ウィンドウの開く位置が固定されてしまうのでその修正(サイドバーの幅は可変なので、それに合わせてウィンドウ生成時に毎回位置を指定)
This commit is contained in:
Sakamoto Shiina
2023-09-09 11:35:24 +09:00
parent 5222f7cc68
commit 9f9cd1e64c
3 changed files with 49 additions and 24 deletions

View File

@@ -73,13 +73,14 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
def createLanguageSettingBox(parent_widget, var_title_text, title_text_attr_name, optionmenu_attr_name, dropdown_menu_values, open_selectable_language_window_command, variable):
def createLanguageSettingBox(parent_widget, var_title_text, title_text_attr_name, arrow_img_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)
sls__box_wrapper = CTkFrame(sls__box, corner_radius=0, fg_color=settings.ctm.SLS__BOX_BG_COLOR, width=0, height=0)
sls__box_wrapper.grid(row=2, column=1, padx=0, pady=settings.uism.SLS__BOX_IPADY)
sls__box_wrapper.grid(row=2, column=1, padx=10, pady=settings.uism.SLS__BOX_IPADY)
sls__label = CTkLabel(
sls__box_wrapper,
@@ -95,7 +96,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
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 = CTkFrame(sls__box_wrapper, corner_radius=0, fg_color=settings.ctm.SLS__DROPDOWN_MENU_BG_COLOR)
sls__selected_language_box.grid(row=1, column=0)
@@ -110,11 +111,24 @@ def createSidebarLanguagesSettings(settings, main_window, view_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
text_color=settings.ctm.LABELS_TEXT_COLOR
)
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
sls__selected_language_arrow_img = CTkLabel(
sls__selected_language_box,
text=None,
corner_radius=0,
height=0,
image=CTkImage((settings.image_file.ARROW_LEFT).rotate(180),size=(20,20))
)
setattr(main_window, arrow_img_attr_name, sls__selected_language_arrow_img)
sls__selected_language_arrow_img.grid(row=0, column=1, padx=0, pady=0)
@@ -124,7 +138,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
bindButtonReleaseFunction([sls__selected_language_box, sls__selected_language_label], open_selectable_language_window_command)
bindButtonReleaseFunction([sls__selected_language_box, sls__selected_language_label, sls__selected_language_arrow_img], open_selectable_language_window_command)
return sls__box
@@ -236,17 +250,17 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
parent_widget=main_window.sls__box_frame,
var_title_text=view_variable.VAR_LABEL_YOUR_LANGUAGE,
title_text_attr_name="sls__title_text_your_language",
optionmenu_attr_name="sls__optionmenu_your_language",
arrow_img_attr_name="sls__arrow_img_your_language",
dropdown_menu_values=view_variable.LIST_SELECTABLE_LANGUAGES,
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")
main_window.sls__box_your_language.grid(row=2, column=0, pady=(settings.uism.SLS__BOX_TOP_PADY,0),sticky="ew")
# Both direction arrow icon
main_window.sls__arrow_direction_box = CTkFrame(main_window.sls__box_frame, corner_radius=0, fg_color=settings.ctm.SLS__BG_COLOR, width=0, height=0)
main_window.sls__arrow_direction_box.grid(row=3, column=0, padx=0, pady=settings.uism.SLS__BOX_ARROWS_PADY,sticky="ew")
main_window.sls__arrow_direction_box.grid(row=3, column=0, pady=settings.uism.SLS__BOX_ARROWS_PADY,sticky="ew")
main_window.sls__arrow_direction_box.grid_columnconfigure((0,4), weight=1)
@@ -266,7 +280,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SLS__BOX_ARROWS_DESC_FONT_SIZE, weight="normal"),
text_color=settings.ctm.SLS__BOX_ARROWS_TEXT_COLOR,
)
main_window.sls__both_direction_desc.grid(row=0, column=2, padx=settings.uism.SLS__BOX_ARROWS_DESC_PADX, pady=0)
main_window.sls__both_direction_desc.grid(row=0, column=2, padx=settings.uism.SLS__BOX_ARROWS_DESC_PADX)
main_window.sls__both_direction_label_down = CTkLabel(
main_window.sls__arrow_direction_box,
@@ -275,7 +289,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
image=CTkImage((settings.image_file.NARROW_ARROW_DOWN).rotate(0),size=settings.uism.SLS__BOX_ARROWS_IMAGE_SIZE)
)
main_window.sls__both_direction_label_down.grid(row=0, column=3, pady=0)
main_window.sls__both_direction_label_down.grid(row=0, column=3)
@@ -284,9 +298,9 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
parent_widget=main_window.sls__box_frame,
var_title_text=view_variable.VAR_LABEL_TARGET_LANGUAGE,
title_text_attr_name="sls__title_text_target_language",
optionmenu_attr_name="sls__optionmenu_target_language",
arrow_img_attr_name="sls__arrow_img_target_language",
dropdown_menu_values=view_variable.LIST_SELECTABLE_LANGUAGES,
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")
main_window.sls__box_target_language.grid(row=4, column=0, sticky="ew")