変数名変更: Prefixにしていたsqlsをslsに。Sidebar Quick Languages Settingsの意だったけど、メイン画面にあるとはいえQuickでもなんでもないのでsls(Sidebar Languages Settings)と変更。

This commit is contained in:
Sakamoto Shiina
2023-09-02 19:19:35 +09:00
parent 01245d9c63
commit 63b220a2d0
7 changed files with 140 additions and 140 deletions

View File

@@ -62,26 +62,26 @@ def createSidebar(settings, main_window):
def switchActiveAndPassivePresetsTabsColor(target_active_widget):
quick_setting_tabs = [
getattr(main_window, "sqls__presets_button_1"),
getattr(main_window, "sqls__presets_button_2"),
getattr(main_window, "sqls__presets_button_3")
getattr(main_window, "sls__presets_button_1"),
getattr(main_window, "sls__presets_button_2"),
getattr(main_window, "sls__presets_button_3")
]
switchTabsColor(
target_widget=target_active_widget,
tab_buttons=quick_setting_tabs,
active_bg_color=settings.ctm.SQLS__PRESETS_TAB_BG_ACTIVE_COLOR,
active_text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR,
active_bg_color=settings.ctm.SLS__PRESETS_TAB_BG_ACTIVE_COLOR,
active_text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR,
passive_bg_color=settings.ctm.SIDEBAR_BG_COLOR,
passive_text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE
passive_text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE
)
def switchPresetTabFunction(target_active_widget):
switchActiveAndPassivePresetsTabsColor(target_active_widget)
switchActiveTabAndPassiveTab(target_active_widget, main_window.current_active_preset_tab, main_window.current_active_preset_tab.passive_function, settings.ctm.SQLS__PRESETS_TAB_BG_HOVERED_COLOR, settings.ctm.SQLS__PRESETS_TAB_BG_CLICKED_COLOR, settings.ctm.SQLS__PRESETS_TAB_BG_PASSIVE_COLOR)
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.sqls__optionmenu_your_language.set(main_window.view_variable.VAR_YOUR_LANGUAGE.get())
main_window.sqls__optionmenu_target_language.set(main_window.view_variable.VAR_TARGET_LANGUAGE.get())
main_window.sls__optionmenu_your_language.set(main_window.view_variable.VAR_YOUR_LANGUAGE.get())
main_window.sls__optionmenu_target_language.set(main_window.view_variable.VAR_TARGET_LANGUAGE.get())
main_window.current_active_preset_tab = target_active_widget
@@ -89,19 +89,19 @@ def createSidebar(settings, main_window):
def switchToPreset1(e):
print("1")
callFunctionIfCallable(main_window.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "1")
target_active_widget = getattr(main_window, "sqls__presets_button_1")
target_active_widget = getattr(main_window, "sls__presets_button_1")
switchPresetTabFunction(target_active_widget)
def switchToPreset2(e):
print("2")
callFunctionIfCallable(main_window.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "2")
target_active_widget = getattr(main_window, "sqls__presets_button_2")
target_active_widget = getattr(main_window, "sls__presets_button_2")
switchPresetTabFunction(target_active_widget)
def switchToPreset3(e):
print("3")
callFunctionIfCallable(main_window.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "3")
target_active_widget = getattr(main_window, "sqls__presets_button_3")
target_active_widget = getattr(main_window, "sls__presets_button_3")
switchPresetTabFunction(target_active_widget)
@@ -114,8 +114,8 @@ def createSidebar(settings, main_window):
height=30,
width=width,
values=dropdown_menu_values,
button_color=settings.ctm.SQLS__DROPDOWN_MENU_BG_COLOR,
fg_color=settings.ctm.SQLS__DROPDOWN_MENU_BG_COLOR,
button_color=settings.ctm.SLS__DROPDOWN_MENU_BG_COLOR,
fg_color=settings.ctm.SLS__DROPDOWN_MENU_BG_COLOR,
text_color=text_color,
font=CTkFont(family=settings.FONT_FAMILY, size=font_size, weight="normal"),
variable=variable,
@@ -128,42 +128,42 @@ def createSidebar(settings, main_window):
def createQuickLanguageSettingBox(parent_widget, title_text, title_text_attr_name, optionmenu_attr_name, dropdown_menu_attr_name, dropdown_menu_values, variable):
sqls__box = CTkFrame(parent_widget, corner_radius=0, fg_color=settings.ctm.SQLS__BOX_BG_COLOR, width=0, height=0)
sls__box = CTkFrame(parent_widget, corner_radius=0, fg_color=settings.ctm.SLS__BOX_BG_COLOR, width=0, height=0)
sqls__box.columnconfigure((0,2), weight=1)
sls__box.columnconfigure((0,2), weight=1)
sqls__box_wrapper = CTkFrame(sqls__box, corner_radius=0, fg_color=settings.ctm.SQLS__BOX_BG_COLOR, width=0, height=0)
sqls__box_wrapper.grid(row=2, column=1, padx=0, pady=settings.uism.SQLS__BOX_IPADY)
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)
sqls__label = CTkLabel(
sqls__box_wrapper,
sls__label = CTkLabel(
sls__box_wrapper,
text=title_text,
height=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SQLS__BOX_SECTION_TITLE_FONT_SIZE, weight="normal"),
text_color=settings.ctm.SQLS__BOX_SECTION_TITLE_TEXT_COLOR
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SLS__BOX_SECTION_TITLE_FONT_SIZE, weight="normal"),
text_color=settings.ctm.SLS__BOX_SECTION_TITLE_TEXT_COLOR
)
sqls__label.grid(row=0, column=0, pady=(0,settings.uism.SQLS__BOX_SECTION_TITLE_BOTTOM_PADY))
setattr(main_window, title_text_attr_name, sqls__label)
sls__label.grid(row=0, column=0, pady=(0,settings.uism.SLS__BOX_SECTION_TITLE_BOTTOM_PADY))
setattr(main_window, title_text_attr_name, sls__label)
createOption_DropdownMenu_for_quickSettings(
main_window,
sqls__box_wrapper,
sls__box_wrapper,
optionmenu_attr_name,
dropdown_menu_attr_name,
dropdown_menu_values=dropdown_menu_values,
# command=self.fakeCommand,
width=settings.uism.SQLS__BOX_DROPDOWN_MENU_WIDTH,
font_size=settings.uism.SQLS__BOX_DROPDOWN_MENU_FONT_SIZE,
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)"),
)
getattr(main_window, optionmenu_attr_name).grid(row=1, column=0, padx=0, pady=0)
return sqls__box
return sls__box
@@ -384,46 +384,46 @@ def createSidebar(settings, main_window):
# Sidebar Quick Language Settings, SQLS
main_window.sqls__container = CTkFrame(main_window.sidebar_bg_container, corner_radius=0, fg_color=settings.ctm.SIDEBAR_BG_COLOR, width=0, height=0)
main_window.sls__container = CTkFrame(main_window.sidebar_bg_container, corner_radius=0, fg_color=settings.ctm.SIDEBAR_BG_COLOR, width=0, height=0)
if settings.IS_SIDEBAR_COMPACT_MODE is False:
main_window.sqls__container.grid(row=2, column=0, sticky="new")
main_window.sls__container.grid(row=2, column=0, sticky="new")
main_window.sqls__container.grid_columnconfigure(0, weight=1)
main_window.sls__container.grid_columnconfigure(0, weight=1)
main_window.sqls__container_title = CTkLabel(main_window.sqls__container,
main_window.sls__container_title = CTkLabel(main_window.sls__container,
# text="言語設定",
text="Language Settings",
height=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SQLS__TITLE_FONT_SIZE, weight="normal"),
text_color=settings.ctm.SQLS__TITLE_TEXT_COLOR
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SLS__TITLE_FONT_SIZE, weight="normal"),
text_color=settings.ctm.SLS__TITLE_TEXT_COLOR
)
main_window.sqls__container_title.grid(row=0, column=0, pady=settings.uism.SQLS__TITLE_PADY, sticky="nsew")
main_window.sls__container_title.grid(row=0, column=0, pady=settings.uism.SLS__TITLE_PADY, sticky="nsew")
# Presets buttons
main_window.sidebar_bg_container.grid_rowconfigure(2, weight=1)
main_window.sqls__presets_buttons_box = CTkFrame(main_window.sqls__container, corner_radius=0, fg_color=settings.ctm.SIDEBAR_BG_COLOR, width=0, height=0)
main_window.sqls__presets_buttons_box.grid(row=1, column=0, sticky="ew")
main_window.sls__presets_buttons_box = CTkFrame(main_window.sls__container, corner_radius=0, fg_color=settings.ctm.SIDEBAR_BG_COLOR, width=0, height=0)
main_window.sls__presets_buttons_box.grid(row=1, column=0, sticky="ew")
main_window.sqls__presets_buttons_box.grid_columnconfigure((0,1,2), weight=1)
main_window.sls__presets_buttons_box.grid_columnconfigure((0,1,2), weight=1)
preset_tabs_settings = [
{
"preset_tab_attr_name": "sqls__presets_button_1",
"preset_tab_attr_name": "sls__presets_button_1",
"command": switchToPreset1,
"text": "1",
},
{
"preset_tab_attr_name": "sqls__presets_button_2",
"preset_tab_attr_name": "sls__presets_button_2",
"command": switchToPreset2,
"text": "2",
},
{
"preset_tab_attr_name": "sqls__presets_button_3",
"preset_tab_attr_name": "sls__presets_button_3",
"command": switchToPreset3,
"text": "3",
},
@@ -439,9 +439,9 @@ def createSidebar(settings, main_window):
main_window,
preset_tab_attr_name,
CTkFrame(
main_window.sqls__presets_buttons_box,
main_window.sls__presets_buttons_box,
corner_radius=0,
fg_color=settings.ctm.SQLS__PRESETS_TAB_BG_PASSIVE_COLOR,
fg_color=settings.ctm.SLS__PRESETS_TAB_BG_PASSIVE_COLOR,
width=0,
height=30,
cursor="hand2",
@@ -454,17 +454,17 @@ def createSidebar(settings, main_window):
parent_widget,
text=text,
height=0,
fg_color=settings.ctm.SQLS__PRESETS_TAB_BG_PASSIVE_COLOR,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SQLS__PRESET_TAB_NUMBER_FONT_SIZE, weight="bold"),
fg_color=settings.ctm.SLS__PRESETS_TAB_BG_PASSIVE_COLOR,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SLS__PRESET_TAB_NUMBER_FONT_SIZE, weight="bold"),
anchor="center",
text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE
text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE
)
label_widget.place(relx=0.5, rely=0.5, anchor="center")
bindEnterAndLeaveColor([parent_widget, label_widget], settings.ctm.SQLS__PRESETS_TAB_BG_HOVERED_COLOR, settings.ctm.SQLS__PRESETS_TAB_BG_PASSIVE_COLOR)
bindButtonPressColor([parent_widget, label_widget], settings.ctm.SQLS__PRESETS_TAB_BG_CLICKED_COLOR, settings.ctm.SQLS__PRESETS_TAB_BG_PASSIVE_COLOR)
bindEnterAndLeaveColor([parent_widget, label_widget], settings.ctm.SLS__PRESETS_TAB_BG_HOVERED_COLOR, settings.ctm.SLS__PRESETS_TAB_BG_PASSIVE_COLOR)
bindButtonPressColor([parent_widget, label_widget], settings.ctm.SLS__PRESETS_TAB_BG_CLICKED_COLOR, settings.ctm.SLS__PRESETS_TAB_BG_PASSIVE_COLOR)
parent_widget.passive_function = command
bindButtonReleaseFunction([parent_widget, label_widget], command)
@@ -473,72 +473,72 @@ def createSidebar(settings, main_window):
# Quick Language settings BOX
main_window.sqls__box_frame = CTkFrame(main_window.sqls__container, corner_radius=0, fg_color=settings.ctm.SQLS__BG_COLOR, width=0, height=0)
main_window.sqls__box_frame.grid(row=2, column=0, sticky="ew")
main_window.sqls__box_frame.grid_columnconfigure(0, weight=1)
main_window.sls__box_frame = CTkFrame(main_window.sls__container, corner_radius=0, fg_color=settings.ctm.SLS__BG_COLOR, width=0, height=0)
main_window.sls__box_frame.grid(row=2, column=0, sticky="ew")
main_window.sls__box_frame.grid_columnconfigure(0, weight=1)
# Your language
main_window.sqls__box_your_language = createQuickLanguageSettingBox(
parent_widget=main_window.sqls__box_frame,
main_window.sls__box_your_language = createQuickLanguageSettingBox(
parent_widget=main_window.sls__box_frame,
# title_text="あなたの言語",
title_text="Your Language",
title_text_attr_name="sqls__title_text_your_language",
optionmenu_attr_name="sqls__optionmenu_your_language",
dropdown_menu_attr_name="sqls__dropdown_menu_your_language",
title_text_attr_name="sls__title_text_your_language",
optionmenu_attr_name="sls__optionmenu_your_language",
dropdown_menu_attr_name="sls__dropdown_menu_your_language",
dropdown_menu_values=["1""2","pppp\npppp"],
variable=main_window.view_variable.VAR_YOUR_LANGUAGE
)
main_window.sqls__box_your_language.grid(row=2, column=0, padx=0, pady=(settings.uism.SQLS__BOX_TOP_PADY,0),sticky="ew")
main_window.sls__box_your_language.grid(row=2, column=0, padx=0, pady=(settings.uism.SLS__BOX_TOP_PADY,0),sticky="ew")
# Both direction arrow icon
main_window.sqls__arrow_direction_box = CTkFrame(main_window.sqls__box_frame, corner_radius=0, fg_color=settings.ctm.SQLS__BG_COLOR, width=0, height=0)
main_window.sqls__arrow_direction_box.grid(row=3, column=0, padx=0, pady=settings.uism.SQLS__BOX_ARROWS_PADY,sticky="ew")
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.sqls__arrow_direction_box.grid_columnconfigure((0,4), weight=1)
main_window.sls__arrow_direction_box.grid_columnconfigure((0,4), weight=1)
main_window.sqls__both_direction_up = CTkLabel(
main_window.sqls__arrow_direction_box,
main_window.sls__both_direction_up = CTkLabel(
main_window.sls__arrow_direction_box,
text=None,
height=0,
image=CTkImage(getImageFileFromUiUtils(settings.image_filename.NARROW_ARROW_DOWN).rotate(180),size=settings.uism.SQLS__BOX_ARROWS_IMAGE_SIZE)
image=CTkImage(getImageFileFromUiUtils(settings.image_filename.NARROW_ARROW_DOWN).rotate(180),size=settings.uism.SLS__BOX_ARROWS_IMAGE_SIZE)
)
main_window.sqls__both_direction_up.grid(row=0, column=1, pady=0)
main_window.sls__both_direction_up.grid(row=0, column=1, pady=0)
main_window.sqls__both_direction_desc = CTkLabel(
main_window.sqls__arrow_direction_box,
main_window.sls__both_direction_desc = CTkLabel(
main_window.sls__arrow_direction_box,
# text="双方向に翻訳",
text="Translate Each Other",
height=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SQLS__BOX_ARROWS_DESC_FONT_SIZE, weight="normal"),
text_color=settings.ctm.SQLS__BOX_ARROWS_TEXT_COLOR,
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.sqls__both_direction_desc.grid(row=0, column=2, padx=settings.uism.SQLS__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, pady=0)
main_window.sqls__both_direction_label_down = CTkLabel(
main_window.sqls__arrow_direction_box,
main_window.sls__both_direction_label_down = CTkLabel(
main_window.sls__arrow_direction_box,
text=None,
height=0,
image=CTkImage(getImageFileFromUiUtils(settings.image_filename.NARROW_ARROW_DOWN).rotate(0),size=settings.uism.SQLS__BOX_ARROWS_IMAGE_SIZE)
image=CTkImage(getImageFileFromUiUtils(settings.image_filename.NARROW_ARROW_DOWN).rotate(0),size=settings.uism.SLS__BOX_ARROWS_IMAGE_SIZE)
)
main_window.sqls__both_direction_label_down.grid(row=0, column=3, pady=0)
main_window.sls__both_direction_label_down.grid(row=0, column=3, pady=0)
# Target language
main_window.sqls__box_target_language = createQuickLanguageSettingBox(
parent_widget=main_window.sqls__box_frame,
main_window.sls__box_target_language = createQuickLanguageSettingBox(
parent_widget=main_window.sls__box_frame,
# title_text="相手の言語",
title_text="Target Language",
title_text_attr_name="sqls__title_text_target_language",
optionmenu_attr_name="sqls__optionmenu_target_language",
dropdown_menu_attr_name="sqls__dropdown_menu_target_language",
title_text_attr_name="sls__title_text_target_language",
optionmenu_attr_name="sls__optionmenu_target_language",
dropdown_menu_attr_name="sls__dropdown_menu_target_language",
dropdown_menu_values=["1""2","pppp\npppp2"],
variable=main_window.view_variable.VAR_TARGET_LANGUAGE
)
main_window.sqls__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, padx=0, pady=(0,0),sticky="ew")

View File

@@ -52,7 +52,7 @@ def createTextbox(settings, main_window):
target_widget=target_active_widget,
tab_buttons=textbox_tabs,
active_bg_color=settings.ctm.TEXTBOX_BG_COLOR,
active_text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR,
active_text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR,
passive_bg_color=settings.ctm.TEXTBOX_TAB_BG_PASSIVE_COLOR,
passive_text_color=settings.ctm.TEXTBOX_TAB_TEXT_PASSIVE_COLOR
)