diff --git a/img/about_vrct/arrow_left.png b/img/about_vrct/arrow_left.png new file mode 100644 index 00000000..a1c4b35e Binary files /dev/null and b/img/about_vrct/arrow_left.png differ diff --git a/img/about_vrct/arrow_right.png b/img/about_vrct/arrow_right.png new file mode 100644 index 00000000..69e005ba Binary files /dev/null and b/img/about_vrct/arrow_right.png differ diff --git a/img/about_vrct/contributors_github_icon.png b/img/about_vrct/contributors_github_icon.png new file mode 100644 index 00000000..1c6e0727 Binary files /dev/null and b/img/about_vrct/contributors_github_icon.png differ diff --git a/img/about_vrct/contributors_members.png b/img/about_vrct/contributors_members.png new file mode 100644 index 00000000..61305751 Binary files /dev/null and b/img/about_vrct/contributors_members.png differ diff --git a/img/about_vrct/contributors_section_title.png b/img/about_vrct/contributors_section_title.png new file mode 100644 index 00000000..641a535a Binary files /dev/null and b/img/about_vrct/contributors_section_title.png differ diff --git a/img/about_vrct/contributors_x_icon.png b/img/about_vrct/contributors_x_icon.png new file mode 100644 index 00000000..c17fb57d Binary files /dev/null and b/img/about_vrct/contributors_x_icon.png differ diff --git a/img/about_vrct/dev_github_icon.png b/img/about_vrct/dev_github_icon.png new file mode 100644 index 00000000..8cbaaff7 Binary files /dev/null and b/img/about_vrct/dev_github_icon.png differ diff --git a/img/about_vrct/dev_misya.png b/img/about_vrct/dev_misya.png new file mode 100644 index 00000000..4f5c2702 Binary files /dev/null and b/img/about_vrct/dev_misya.png differ diff --git a/img/about_vrct/dev_section_title.png b/img/about_vrct/dev_section_title.png new file mode 100644 index 00000000..4f1da8a2 Binary files /dev/null and b/img/about_vrct/dev_section_title.png differ diff --git a/img/about_vrct/dev_shiina.png b/img/about_vrct/dev_shiina.png new file mode 100644 index 00000000..1be39941 Binary files /dev/null and b/img/about_vrct/dev_shiina.png differ diff --git a/img/about_vrct/dev_x_icon.png b/img/about_vrct/dev_x_icon.png new file mode 100644 index 00000000..dfd6d109 Binary files /dev/null and b/img/about_vrct/dev_x_icon.png differ diff --git a/img/about_vrct/poster_images_authors.png b/img/about_vrct/poster_images_authors.png new file mode 100644 index 00000000..83c4086a Binary files /dev/null and b/img/about_vrct/poster_images_authors.png differ diff --git a/img/about_vrct/poster_showcase_pagination_button.png b/img/about_vrct/poster_showcase_pagination_button.png new file mode 100644 index 00000000..917879e5 Binary files /dev/null and b/img/about_vrct/poster_showcase_pagination_button.png differ diff --git a/img/about_vrct/poster_showcase_pagination_button_chato.png b/img/about_vrct/poster_showcase_pagination_button_chato.png new file mode 100644 index 00000000..a4df1d52 Binary files /dev/null and b/img/about_vrct/poster_showcase_pagination_button_chato.png differ diff --git a/img/about_vrct/poster_showcase_section_title.png b/img/about_vrct/poster_showcase_section_title.png new file mode 100644 index 00000000..5a4b00fa Binary files /dev/null and b/img/about_vrct/poster_showcase_section_title.png differ diff --git a/img/about_vrct/poster_tell_us_message_en.png b/img/about_vrct/poster_tell_us_message_en.png new file mode 100644 index 00000000..1078b42f Binary files /dev/null and b/img/about_vrct/poster_tell_us_message_en.png differ diff --git a/img/about_vrct/poster_tell_us_message_ja.png b/img/about_vrct/poster_tell_us_message_ja.png new file mode 100644 index 00000000..8e2b096d Binary files /dev/null and b/img/about_vrct/poster_tell_us_message_ja.png differ diff --git a/img/about_vrct/project_link_booth.png b/img/about_vrct/project_link_booth.png new file mode 100644 index 00000000..14af933a Binary files /dev/null and b/img/about_vrct/project_link_booth.png differ diff --git a/img/about_vrct/project_link_contact_us.png b/img/about_vrct/project_link_contact_us.png new file mode 100644 index 00000000..c21bc7ef Binary files /dev/null and b/img/about_vrct/project_link_contact_us.png differ diff --git a/img/about_vrct/project_link_documents.png b/img/about_vrct/project_link_documents.png new file mode 100644 index 00000000..cd9723e4 Binary files /dev/null and b/img/about_vrct/project_link_documents.png differ diff --git a/img/about_vrct/project_link_vrct_github.png b/img/about_vrct/project_link_vrct_github.png new file mode 100644 index 00000000..eb05f15f Binary files /dev/null and b/img/about_vrct/project_link_vrct_github.png differ diff --git a/img/about_vrct/showcased_worlds/ehon_no_heikousekai_jimusho.png b/img/about_vrct/showcased_worlds/ehon_no_heikousekai_jimusho.png new file mode 100644 index 00000000..0d791d41 Binary files /dev/null and b/img/about_vrct/showcased_worlds/ehon_no_heikousekai_jimusho.png differ diff --git a/img/about_vrct/showcased_worlds/ikoiba.png b/img/about_vrct/showcased_worlds/ikoiba.png new file mode 100644 index 00000000..887e38a7 Binary files /dev/null and b/img/about_vrct/showcased_worlds/ikoiba.png differ diff --git a/img/about_vrct/showcased_worlds/ippaidou.png b/img/about_vrct/showcased_worlds/ippaidou.png new file mode 100644 index 00000000..32fcf8f6 Binary files /dev/null and b/img/about_vrct/showcased_worlds/ippaidou.png differ diff --git a/img/about_vrct/showcased_worlds/japanese_culture_osenbeito.png b/img/about_vrct/showcased_worlds/japanese_culture_osenbeito.png new file mode 100644 index 00000000..89cf6cdc Binary files /dev/null and b/img/about_vrct/showcased_worlds/japanese_culture_osenbeito.png differ diff --git a/img/about_vrct/showcased_worlds/kimodameshi.png b/img/about_vrct/showcased_worlds/kimodameshi.png new file mode 100644 index 00000000..8edc40ab Binary files /dev/null and b/img/about_vrct/showcased_worlds/kimodameshi.png differ diff --git a/img/about_vrct/showcased_worlds/kokekkopiyopiyo.png b/img/about_vrct/showcased_worlds/kokekkopiyopiyo.png new file mode 100644 index 00000000..8d14c615 Binary files /dev/null and b/img/about_vrct/showcased_worlds/kokekkopiyopiyo.png differ diff --git a/img/about_vrct/showcased_worlds/kuroinu_work_room.png b/img/about_vrct/showcased_worlds/kuroinu_work_room.png new file mode 100644 index 00000000..fb07e680 Binary files /dev/null and b/img/about_vrct/showcased_worlds/kuroinu_work_room.png differ diff --git a/img/about_vrct/showcased_worlds/language_exchange_tervern.png b/img/about_vrct/showcased_worlds/language_exchange_tervern.png new file mode 100644 index 00000000..b014157c Binary files /dev/null and b/img/about_vrct/showcased_worlds/language_exchange_tervern.png differ diff --git a/img/about_vrct/showcased_worlds/nihongokurabu.png b/img/about_vrct/showcased_worlds/nihongokurabu.png new file mode 100644 index 00000000..35c2516a Binary files /dev/null and b/img/about_vrct/showcased_worlds/nihongokurabu.png differ diff --git a/img/about_vrct/showcased_worlds/parallel_collar.png b/img/about_vrct/showcased_worlds/parallel_collar.png new file mode 100644 index 00000000..696f8257 Binary files /dev/null and b/img/about_vrct/showcased_worlds/parallel_collar.png differ diff --git a/img/about_vrct/showcased_worlds/re_yatuha_room.png b/img/about_vrct/showcased_worlds/re_yatuha_room.png new file mode 100644 index 00000000..cf3de080 Binary files /dev/null and b/img/about_vrct/showcased_worlds/re_yatuha_room.png differ diff --git a/img/about_vrct/showcased_worlds/silakan_datang_ke_rumahku.png b/img/about_vrct/showcased_worlds/silakan_datang_ke_rumahku.png new file mode 100644 index 00000000..6af82d4b Binary files /dev/null and b/img/about_vrct/showcased_worlds/silakan_datang_ke_rumahku.png differ diff --git a/img/about_vrct/showcased_worlds/study_japanese_world_japanichijou.png b/img/about_vrct/showcased_worlds/study_japanese_world_japanichijou.png new file mode 100644 index 00000000..308cbcb1 Binary files /dev/null and b/img/about_vrct/showcased_worlds/study_japanese_world_japanichijou.png differ diff --git a/img/about_vrct/showcased_worlds/uj_club.png b/img/about_vrct/showcased_worlds/uj_club.png new file mode 100644 index 00000000..4f893ba3 Binary files /dev/null and b/img/about_vrct/showcased_worlds/uj_club.png differ diff --git a/img/about_vrct/showcased_worlds/usanezumi_shrine2.png b/img/about_vrct/showcased_worlds/usanezumi_shrine2.png new file mode 100644 index 00000000..1daf3be4 Binary files /dev/null and b/img/about_vrct/showcased_worlds/usanezumi_shrine2.png differ diff --git a/img/about_vrct/showcased_worlds/yuttari_eikaiwa.png b/img/about_vrct/showcased_worlds/yuttari_eikaiwa.png new file mode 100644 index 00000000..3b87da74 Binary files /dev/null and b/img/about_vrct/showcased_worlds/yuttari_eikaiwa.png differ diff --git a/img/about_vrct/special_thanks_members.png b/img/about_vrct/special_thanks_members.png new file mode 100644 index 00000000..75e98aa4 Binary files /dev/null and b/img/about_vrct/special_thanks_members.png differ diff --git a/img/about_vrct/special_thanks_message_and_you.png b/img/about_vrct/special_thanks_message_and_you.png new file mode 100644 index 00000000..f006ff15 Binary files /dev/null and b/img/about_vrct/special_thanks_message_and_you.png differ diff --git a/img/about_vrct/special_thanks_message_en.png b/img/about_vrct/special_thanks_message_en.png new file mode 100644 index 00000000..58db5a87 Binary files /dev/null and b/img/about_vrct/special_thanks_message_en.png differ diff --git a/img/about_vrct/special_thanks_message_ja.png b/img/about_vrct/special_thanks_message_ja.png new file mode 100644 index 00000000..493a6bf0 Binary files /dev/null and b/img/about_vrct/special_thanks_message_ja.png differ diff --git a/img/about_vrct/special_thanks_section_title.png b/img/about_vrct/special_thanks_section_title.png new file mode 100644 index 00000000..ea64a970 Binary files /dev/null and b/img/about_vrct/special_thanks_section_title.png differ diff --git a/img/about_vrct/special_thanks_tell_us_message_en.png b/img/about_vrct/special_thanks_tell_us_message_en.png new file mode 100644 index 00000000..c213e5bc Binary files /dev/null and b/img/about_vrct/special_thanks_tell_us_message_en.png differ diff --git a/img/about_vrct/special_thanks_tell_us_message_ja.png b/img/about_vrct/special_thanks_tell_us_message_ja.png new file mode 100644 index 00000000..f3274966 Binary files /dev/null and b/img/about_vrct/special_thanks_tell_us_message_ja.png differ diff --git a/img/about_vrct/vrchat_disclaimer.png b/img/about_vrct/vrchat_disclaimer.png new file mode 100644 index 00000000..c6e3dbb0 Binary files /dev/null and b/img/about_vrct/vrchat_disclaimer.png differ diff --git a/img/about_vrct/vrct_logo_for_about_vrct.png b/img/about_vrct/vrct_logo_for_about_vrct.png new file mode 100644 index 00000000..4f461409 Binary files /dev/null and b/img/about_vrct/vrct_logo_for_about_vrct.png differ diff --git a/img/about_vrct/vrct_posters/iya_vrct_poster_cn.png b/img/about_vrct/vrct_posters/iya_vrct_poster_cn.png new file mode 100644 index 00000000..c2780f3a Binary files /dev/null and b/img/about_vrct/vrct_posters/iya_vrct_poster_cn.png differ diff --git a/img/about_vrct/vrct_posters/iya_vrct_poster_en.png b/img/about_vrct/vrct_posters/iya_vrct_poster_en.png new file mode 100644 index 00000000..fe1865d5 Binary files /dev/null and b/img/about_vrct/vrct_posters/iya_vrct_poster_en.png differ diff --git a/img/about_vrct/vrct_posters/iya_vrct_poster_ja.png b/img/about_vrct/vrct_posters/iya_vrct_poster_ja.png new file mode 100644 index 00000000..4fb2596e Binary files /dev/null and b/img/about_vrct/vrct_posters/iya_vrct_poster_ja.png differ diff --git a/utils.py b/utils.py index 6add2b43..c2af3568 100644 --- a/utils.py +++ b/utils.py @@ -1,3 +1,4 @@ +import random from typing import Union from os import path as os_path, rename as os_rename from PIL.Image import open as Image_open @@ -55,4 +56,12 @@ def isUniqueStrings(unique_strings:Union[str, list], input_string:str, require=F def renameWeightFolder(path): weight_path = os_path.join(path, "weight") if os_path.exists(weight_path): - os_rename(weight_path, os_path.join(path, "weights")) \ No newline at end of file + os_rename(weight_path, os_path.join(path, "weights")) + +def splitListRandomly(lst, split_count): + random.shuffle(lst) + split_lists = [] + for i in range(0, len(lst), split_count): + sub_list = lst[i:i+split_count] + split_lists.append(sub_list) + return split_lists \ No newline at end of file diff --git a/view.py b/view.py index 840a2774..ad46b892 100644 --- a/view.py +++ b/view.py @@ -6,7 +6,7 @@ import webbrowser import i18n from customtkinter import StringVar, IntVar, BooleanVar, get_appearance_mode -from vrct_gui.ui_managers import ColorThemeManager, UiScalingManager +from vrct_gui.ui_managers import ColorThemeManager, UiScalingManager, AboutVrctManager from vrct_gui import vrct_gui from utils import callFunctionIfCallable, intToPctStr @@ -62,9 +62,11 @@ class View(): **common_args ) + about_vrct = AboutVrctManager(config.UI_SCALING, config.UI_LANGUAGE, all_ctm.config_window) self.settings.config_window = SimpleNamespace( ctm=all_ctm.config_window, uism=all_uism.config_window, + about_vrct=about_vrct, **common_args ) @@ -198,7 +200,8 @@ class View(): # Config Window - ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_appearance", + ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_about_vrct", + # ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_appearance", CALLBACK_SELECTED_SETTING_BOX_TAB=None, VAR_ERROR_MESSAGE=StringVar(value=""), VAR_VERSION=StringVar(value=VERSION_TEXT), @@ -219,6 +222,9 @@ class View(): VAR_SIDE_MENU_LABEL_OTHERS=StringVar(value=i18n.t("config_window.side_menu_labels.others")), VAR_SIDE_MENU_LABEL_ADVANCED_SETTINGS=StringVar(value=i18n.t("config_window.side_menu_labels.advanced_settings")), + VAR_SIDE_MENU_LABEL_ABOUT_VRCT=StringVar(value="About VRCT"), + # VAR_SIDE_MENU_LABEL_ABOUT_VRCT=StringVar(value=i18n.t("config_window.side_menu_labels.advanced_settings")), + VAR_CURRENT_ACTIVE_CONFIG_TITLE=StringVar(value=""), # Appearance Tab @@ -521,6 +527,14 @@ class View(): VAR_LABEL_OPEN_CONFIG_FILEPATH=StringVar(value=i18n.t("config_window.open_config_filepath.label")), VAR_DESC_OPEN_CONFIG_FILEPATH=None, + + + # About VRCT Tab + CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT=self.openWebPage_AboutVrct, + CALLBACK_ABOUT_VRCT_POSTER_NEXT_BUTTON=None, + CALLBACK_ABOUT_VRCT_POSTER_PREV_BUTTON=None, + CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_WORLD_LIST=None, + CALLBACK_ABOUT_VRCT_POSTER_SHOWCASE_CURRENT_PAGE_NUM=0, ) @@ -985,6 +999,53 @@ class View(): def openWebPage_DeepL_Auth_Key(self): self.openWebPage(config.DEEPL_AUTH_KEY_PAGE_URL) + def openWebPage_AboutVrct(self, target_type:str): + url = "" + match (target_type): + case ("X_MISYA"): + url = "https://twitter.com/misya_ai" + case ("GITHUB_MISYA"): + url = "https://github.com/misyaguziya" + + case ("X_SHIINA"): + url = "https://twitter.com/Shiina_12siy" + + case ("X_DONE_SAN"): + url = "https://twitter.com/done_vrc" + + case ("X_IYA"): + url = "https://twitter.com/IYAA_HHHH" + + case ("X_RERA"): + url = "https://twitter.com/rerassi" + case ("GITHUB_RERA"): + url = "https://github.com/soumt-r" + + case ("X_POPOSUKE"): + url = "https://twitter.com/sig_popo" + + case ("X_KUMAGUMA"): + url = "https://twitter.com/K_kumaguma_A" + + + case ("BOOTH"): + url = "https://misyaguziya.booth.pm/items/5155325" + case ("VRCT_DOCUMENTS"): + url = config.DOCUMENTS_URL + case ("VRCT_GITHUB"): + url = "https://github.com/misyaguziya/VRCT" + case ("CONTACT_US"): + url = "https://docs.google.com/forms/d/e/1FAIpQLSei-xoydOY60ivXqhOjaTzNN8PiBQIDcNhzfy6cw2sjYkcg_g/viewform" + case ("SUPPORTER_REGISTRATION"): + url = "https://docs.google.com/forms/d/e/1FAIpQLSepLzdEOTJQFVHdOOxAA0dix3zCmnNBlmH4XWon5FldXkIiqw/viewform" + + case "TEMP": + print("here is still under construction.") + return + case (_): + raise ValueError(f"No matching case for target_type: {target_type}") + + self.openWebPage(url) # Widget Control # Common diff --git a/vrct_gui/_PrintToTextbox.py b/vrct_gui/_PrintToTextbox.py index 6d68cfdc..5d5d7419 100644 --- a/vrct_gui/_PrintToTextbox.py +++ b/vrct_gui/_PrintToTextbox.py @@ -163,6 +163,6 @@ class _PrintToTextbox(): case "RECEIVED": target_textbox = self.vrct_gui.textbox_received case (_): - raise ValueError(f"No matching case for target_type: {target_type}") + raise ValueError(f"No matching case for target_type: {target_type}") return target_textbox \ No newline at end of file diff --git a/vrct_gui/config_window/ConfigWindow.py b/vrct_gui/config_window/ConfigWindow.py index fc56daec..42272110 100644 --- a/vrct_gui/config_window/ConfigWindow.py +++ b/vrct_gui/config_window/ConfigWindow.py @@ -41,9 +41,9 @@ class ConfigWindow(CTkToplevel): self.side_menu_bg_container.grid_columnconfigure(0, weight=0, minsize=l_width+1) # for fixing 1px bug - self.side_menu_bg_container.grid_rowconfigure(2, weight=1) - sls__box_optionmenu_wrapper_fix_1px_bug = CTkFrame(self.side_menu_bg_container, corner_radius=0, width=0, height=0) - sls__box_optionmenu_wrapper_fix_1px_bug.grid(row=3, column=0, sticky="sew") + # self.side_menu_bg_container.grid_rowconfigure(2, weight=1) + # sls__box_optionmenu_wrapper_fix_1px_bug = CTkFrame(self.side_menu_bg_container, corner_radius=0, width=0, height=0) + # sls__box_optionmenu_wrapper_fix_1px_bug.grid(row=3, column=0, sticky="sew") # for fixing 1px bug l_width = getLatestWidth(self.side_menu_bg_container) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py index 97859e3a..28b7c552 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/_createSettingBoxContainer.py @@ -30,7 +30,13 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b setting_box_row=0 for setting_box_setting in setting_box_container_settings["setting_boxes"]: # Top-Padding that can be container the section title - setting_box_top_padding = CTkFrame(setting_box_container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=settings.uism.SB__TOP_PADY) + if setting_box_setting.get("about_vrct", False) is True: + setting_box_top_padding = CTkFrame(setting_box_container_widget, corner_radius=0, fg_color=settings.ctm.ABOUT_VRCT_BG, width=0, height=settings.uism.ABOUT_VRCT_SB__TOP_PADY) + setting_box_wrapper = CTkFrame(setting_box_container_widget, fg_color=settings.ctm.MAIN_BG_COLOR, corner_radius=0, width=0, height=0) + else: + setting_box_top_padding = CTkFrame(setting_box_container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=settings.uism.SB__TOP_PADY) + setting_box_wrapper = CTkFrame(setting_box_container_widget, fg_color=settings.ctm.SB__WRAPPER_BG_COLOR, corner_radius=0, width=0, height=0) + setting_box_top_padding.grid(row=setting_box_row, column=0, sticky="ew", padx=0, pady=0) setting_box_top_padding.grid_columnconfigure(0, weight=1) setting_box_row+=1 @@ -47,7 +53,6 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b setting_box_wrapper_section_title.place(relx=0, rely=0.4, anchor="nw") - setting_box_wrapper = CTkFrame(setting_box_container_widget, fg_color=settings.ctm.SB__WRAPPER_BG_COLOR, corner_radius=0, width=0, height=0) setting_box_wrapper.grid(row=setting_box_row, column=0, sticky="ew") setting_box_wrapper.grid_columnconfigure(0, weight=1) setting_box_row+=1 diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index 49272afc..b0649e4c 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -12,6 +12,8 @@ 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_about_vrct import createSettingBox_AboutVrct + def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variable): @@ -30,9 +32,9 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl config_window.side_menu_bg_container = CTkFrame(config_window, corner_radius=0, fg_color=settings.ctm.SIDE_MENU_BG_COLOR, width=0, height=0) config_window.side_menu_bg_container.grid(row=1, column=0, sticky="nsew") config_window.side_menu_bg_container.grid_columnconfigure(0, weight=1) - + config_window.side_menu_bg_container.grid_rowconfigure(0, weight=1) config_window.side_menu_container = CTkFrame(config_window.side_menu_bg_container, corner_radius=0, fg_color=settings.ctm.SIDE_MENU_LABELS_BG_FOR_FAKE_BORDER_COLOR, width=0, height=0) - config_window.side_menu_container.grid(row=0, column=0, padx=settings.uism.TOP_BAR_SIDE__TITLE_PADX, pady=(settings.uism.SIDE_MENU_TOP_PADY, 0), sticky="nsew") + config_window.side_menu_container.grid(row=0, column=0, padx=settings.uism.TOP_BAR_SIDE__TITLE_PADX, pady=settings.uism.SIDE_MENU_TOP_PADY, sticky="nsew") @@ -128,12 +130,36 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl ] }, }, + + # About VRCT. It is separated from the others. + { + "side_menu_tab_attr_name": "side_menu_tab_about_vrct", + "label_attr_name": "label_about_vrct", + "selected_mark_attr_name": "selected_mark_about_vrct", + "textvariable": view_variable.VAR_SIDE_MENU_LABEL_ABOUT_VRCT, + "setting_box_container_settings": { + "setting_box_container_attr_name": "setting_box_container_about_vrct", + "setting_boxes": [ + { "var_section_title": None, "setting_box": createSettingBox_AboutVrct, "about_vrct": True }, + ] + }, + }, ] + SEPARATE_ROW_COUNT=1 # It's just count the row and separate from below. + SEPARATE_ROW_NUMBER = len(side_menu_and_setting_box_containers_settings) - SEPARATE_ROW_COUNT all_side_menu_tab_attr_name = [item["side_menu_tab_attr_name"] for item in side_menu_and_setting_box_containers_settings] side_menu_row=0 for sm_and_sbc_setting in side_menu_and_setting_box_containers_settings: + + if side_menu_row == SEPARATE_ROW_NUMBER: + side_menu_separator = CTkFrame(config_window.side_menu_container, corner_radius=0, fg_color=settings.ctm.SIDE_MENU_LABELS_BG_COLOR, width=0, height=0) + config_window.side_menu_container.grid_rowconfigure(side_menu_row, weight=1, minsize=settings.uism.SIDE_MENU_LABELS_SEPARATE_MIN_HEIGHT) + side_menu_separator.grid(row=side_menu_row, column=0, sticky="nsew") + side_menu_row+=1 + + _addConfigSideMenuItem( config_window=config_window, settings=settings, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/__init__.py new file mode 100644 index 00000000..61b104ec --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/__init__.py @@ -0,0 +1 @@ +from .createSettingBox_AboutVrct import createSettingBox_AboutVrct \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py new file mode 100644 index 00000000..6b097984 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py @@ -0,0 +1,578 @@ +from types import SimpleNamespace +from customtkinter import CTkFrame, CTkLabel, CTkImage, CTkFont + +from utils import callFunctionIfCallable, splitListRandomly +from ......ui_utils import bindButtonFunctionAndColor, animateRotation, bindEnterAndLeaveFunction + +def createSettingBox_AboutVrct(setting_box_wrapper, config_window, settings, view_variable): + setting_box_wrapper.grid_columnconfigure(0, weight=1, minsize=settings.uism.MAIN_AREA_MIN_WIDTH) + about_vrct_uism = settings.about_vrct.uism + ABOUT_VRCT_BG = settings.ctm.ABOUT_VRCT_BG + + + # For padding left. without this, setting_box_wrapper's bg shows... + about_vrct_container_wrapper = CTkFrame(setting_box_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + about_vrct_container_wrapper.grid(column=0, row=0, padx=0, pady=0, sticky="nsew") + about_vrct_container_wrapper.grid_columnconfigure(0, weight=1) + + + about_vrct_container = CTkFrame(about_vrct_container_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + about_vrct_container.grid(column=0, row=0, padx=about_vrct_uism.ABOUT_VRCT_CONTAINER_LEFT_PADX, pady=0, sticky="nsew") + about_vrct_container.grid_columnconfigure(0, weight=1) + + + def createSectionContainer(section_row, section_title_image_file_name:str=None, section_bottom_padding:int=0, section_title_bottom_padding:int=0): + section_container = CTkFrame(about_vrct_container, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + section_container.grid(column=0, row=section_row, padx=0, pady=(0, section_bottom_padding), sticky="nsew") + section_container.grid_columnconfigure(0, weight=1) + + contents_row=0 + if section_title_image_file_name is not None: + section_title_frame = settings.about_vrct.embedImageCTkLabel(section_container, section_title_image_file_name) + section_title_frame.grid(column=0, row=contents_row, padx=0, pady=(0,section_title_bottom_padding), sticky="nw") + contents_row = 1 + + + + section_contents_wrapper = CTkFrame(section_container, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + section_contents_wrapper.grid(column=0, row=contents_row, padx=0, pady=0, sticky="nsew") + section_contents_wrapper.grid_columnconfigure(0, weight=1) + + return (section_container, section_contents_wrapper) + + + + def createImageButtonRows(parent_frame, image_buttons_settings:list, bottom_pady, directly_type:str=None, corner_radius:int=0, ipadx:int=0, ipady:int=0): + button_row=0 + setting_length = len(image_buttons_settings) + for index, each_setting in enumerate(image_buttons_settings): + each_button = settings.about_vrct.embedImageButtonCTkLabel( + parent_frame=parent_frame, + image_file_name=each_setting["image_file_name"], + callback=each_setting["callback"], + directly_type=directly_type, + corner_radius=corner_radius, + ) + each_button.grid(column=0, row=button_row, padx=0, pady=(0, bottom_pady), sticky="nsew") + each_button.img_label.grid(padx=ipadx, pady=ipady, sticky="nsew") + if index == setting_length-1: + each_button.grid(pady=0) + button_row+=1 + + def createContactButton(parent_frame, image_file_name, callback_arg, fg_color=ABOUT_VRCT_BG): + frame = settings.about_vrct.embedImageButtonCTkLabel( + parent_frame=parent_frame, + image_file_name=image_file_name, + callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, callback_arg), + fg_color=fg_color, + hovered_color=fg_color, + clicked_color=fg_color, + ) + return frame + + def createTellUsButton(parent_frame, image_file_name, callback): + tell_us_button_frame = settings.about_vrct.embedImageButtonCTkLabel( + parent_frame=parent_frame, + image_file_name=image_file_name, + callback=callback, + corner_radius=about_vrct_uism.TELL_US_BUTTON_CORNER_RADIUS, + ) + tell_us_button_frame.img_label.grid(padx=about_vrct_uism.TELL_US_BUTTON_PADX, pady=about_vrct_uism.TELL_US_BUTTON_PADY, sticky="nsew") + + tell_us_button_frame.configure(border_width=about_vrct_uism.TELL_US_BUTTON_BORDER_WIDTH, border_color=settings.ctm.ABOUT_VRCT_TELL_US_BUTTON_BORDER_COLOR) + + return tell_us_button_frame + + + + + section_row=0 + # The Developers ---------------------------------- + _the_developers, the_developers_contents_wrapper = createSectionContainer( + section_row=section_row, + section_title_image_file_name="dev_section_title.png", + section_bottom_padding=about_vrct_uism.SECTION_BOTTOM_PADY, + section_title_bottom_padding=about_vrct_uism.THE_DEVELOPERS_SECTION_TITLE_BOTTOM_PADY + ) + + dev_misya_label = settings.about_vrct.embedImageCTkLabel(the_developers_contents_wrapper, "dev_misya.png") + dev_misya_label.grid(column=0, row=0, padx=0, pady=0, sticky="nsw") + + dev_misya_x = createContactButton( + parent_frame=dev_misya_label, + image_file_name="dev_x_icon.png", + callback_arg="X_MISYA", + fg_color=settings.ctm.ABOUT_VRCT_DEV_BG + ) + dev_misya_x.place(x=about_vrct_uism.DEVS_MISYA_X_X, y=about_vrct_uism.DEVS_CONTACTS_Y1, anchor="nw") + + dev_misya_github = createContactButton( + parent_frame=dev_misya_label, + image_file_name="dev_github_icon.png", + callback_arg="GITHUB_MISYA", + fg_color=settings.ctm.ABOUT_VRCT_DEV_BG + ) + dev_misya_github.place(x=about_vrct_uism.DEVS_MISYA_GITHUB_X, y=about_vrct_uism.DEVS_CONTACTS_Y1, anchor="nw") + + + + dev_shiina_label = settings.about_vrct.embedImageCTkLabel(the_developers_contents_wrapper, "dev_shiina.png") + dev_shiina_label.grid(column=1, row=0, padx=0, pady=0, sticky="nse") + + dev_shiina_x = createContactButton( + parent_frame=dev_shiina_label, + image_file_name="dev_x_icon.png", + callback_arg="X_SHIINA", + fg_color=settings.ctm.ABOUT_VRCT_DEV_BG + ) + dev_shiina_x.place(x=about_vrct_uism.DEVS_SHIINA_X_X, y=about_vrct_uism.DEVS_CONTACTS_Y1, anchor="nw") + + + section_row+=1 + # Project Links And Logo ---------------------------------- + _project_links_and_logo, project_links_and_logo_contents_wrapper = createSectionContainer( + section_bottom_padding=about_vrct_uism.PROJECT_LINKS_SECTION_BOTTOM_PADDING, + section_row=section_row, + ) + + project_links_and_logo_wrapper = CTkFrame(project_links_and_logo_contents_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + project_links_and_logo_wrapper.grid(column=0, row=0, padx=about_vrct_uism.PROJECT_LINK_CONTENTS_PADX, pady=0, sticky="nsew") + project_links_and_logo_wrapper.grid_columnconfigure(1, weight=1) + + + vrct_logo_label = settings.about_vrct.embedImageCTkLabel(project_links_and_logo_wrapper, "vrct_logo_for_about_vrct.png") + vrct_logo_label.grid(column=0, row=0, padx=0, pady=0, sticky="nsw") + + + project_links_wrapper = CTkFrame(project_links_and_logo_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + project_links_wrapper.grid(column=2, row=0, padx=0, pady=0, sticky="nse") + + project_link_settings = [ + { + "image_file_name": "project_link_booth.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "BOOTH") + }, + { + "image_file_name": "project_link_documents.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "VRCT_DOCUMENTS") + }, + { + "image_file_name": "project_link_vrct_github.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "VRCT_GITHUB") + }, + { + "image_file_name": "project_link_contact_us.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "CONTACT_US") + }, + ] + + createImageButtonRows( + parent_frame=project_links_wrapper, + image_buttons_settings=project_link_settings, + bottom_pady=about_vrct_uism.PROJECT_LINK_BOTTOM_PADY, + corner_radius=about_vrct_uism.PROJECT_LINK_CORNER_RADIUS, + ipadx=about_vrct_uism.PROJECT_LINK_ITEM_IPADX, + ipady=about_vrct_uism.PROJECT_LINK_ITEM_IPADY, + ) + + + + + + + section_row+=1 + # Contributors ---------------------------------- + _contributors, contributors_contents_wrapper = createSectionContainer( + section_row=section_row, + section_title_image_file_name="contributors_section_title.png", + section_bottom_padding=about_vrct_uism.SECTION_BOTTOM_PADY, + section_title_bottom_padding=about_vrct_uism.CONTRIBUTORS_SECTION_TITLE_BOTTOM_PADY + ) + + contributors_members = settings.about_vrct.embedImageCTkLabel(contributors_contents_wrapper, "contributors_members.png") + contributors_members.grid(column=0, row=0, padx=0, pady=0, sticky="nsew") + + + + # done_san + contributors_done_san_x = createContactButton( + parent_frame=contributors_members, + image_file_name="contributors_x_icon.png", + callback_arg="X_DONE_SAN", + ) + contributors_done_san_x.place(x=about_vrct_uism.CONTRIBUTORS_DONE_SAN_X_X, y=about_vrct_uism.CONTRIBUTORS_CONTACTS_Y1, anchor="nw") + + # IYA + contributors_iya_x = createContactButton( + parent_frame=contributors_members, + image_file_name="contributors_x_icon.png", + callback_arg="X_IYA", + ) + contributors_iya_x.place(x=about_vrct_uism.CONTRIBUTORS_IYA_X_X, y=about_vrct_uism.CONTRIBUTORS_CONTACTS_Y1, anchor="nw") + + # RERA + contributors_rera_x = createContactButton( + parent_frame=contributors_members, + image_file_name="contributors_x_icon.png", + callback_arg="X_RERA", + ) + contributors_rera_x.place(x=about_vrct_uism.CONTRIBUTORS_RERA_X_X, y=about_vrct_uism.CONTRIBUTORS_CONTACTS_Y1, anchor="nw") + + contributors_rera_github = createContactButton( + parent_frame=contributors_members, + image_file_name="contributors_github_icon.png", + callback_arg="GITHUB_RERA", + ) + contributors_rera_github.place(x=about_vrct_uism.CONTRIBUTORS_RERA_GITHUB_X, y=about_vrct_uism.CONTRIBUTORS_CONTACTS_Y1, anchor="nw") + + + # POPOSUKE + contributors_poposuke_x = createContactButton( + parent_frame=contributors_members, + image_file_name="contributors_x_icon.png", + callback_arg="X_POPOSUKE", + ) + contributors_poposuke_x.place(x=about_vrct_uism.CONTRIBUTORS_POPOSUKE_X_X, y=about_vrct_uism.CONTRIBUTORS_CONTACTS_Y2, anchor="nw") + + # KUMAGUMA + contributors_kumaguma_x = createContactButton( + parent_frame=contributors_members, + image_file_name="contributors_x_icon.png", + callback_arg="X_KUMAGUMA", + ) + contributors_kumaguma_x.place(x=about_vrct_uism.CONTRIBUTORS_KUMAGUMA_X_X, y=about_vrct_uism.CONTRIBUTORS_CONTACTS_Y2, anchor="nw") + + + + + + section_row+=1 + # Special Thanks & Supporters ---------------------------------- + _special_thanks, special_thanks_contents_wrapper = createSectionContainer( + section_row=section_row, + section_title_image_file_name="special_thanks_section_title.png", + section_bottom_padding=about_vrct_uism.SECTION_BOTTOM_PADY, + section_title_bottom_padding=about_vrct_uism.SPECIAL_THANKS_SECTION_TITLE_BOTTOM_PADY + ) + + special_thanks_members = settings.about_vrct.embedImageCTkLabel(special_thanks_contents_wrapper, "special_thanks_members.png") + special_thanks_members.grid(column=0, row=0, padx=0, pady=(0,about_vrct_uism.SPECIAL_THANKS_MEMBERS_BOTTOM_PADY), sticky="nsew") + + special_thanks_message = settings.about_vrct.embedImageCTkLabel(special_thanks_contents_wrapper, settings.about_vrct.image_file.SPECIAL_THANKS_MESSAGE) + special_thanks_message.grid(column=0, row=1, padx=0, pady=(0,about_vrct_uism.SPECIAL_THANKS_MESSAGE_BOTTOM_PADY), sticky="nsew") + + special_thanks_message_and_you = settings.about_vrct.embedImageCTkLabel(special_thanks_contents_wrapper, "special_thanks_message_and_you.png") + special_thanks_message_and_you.grid(column=0, row=2, padx=0, pady=(0,about_vrct_uism.SPECIAL_THANKS_MESSAGE_AND_YOU_BOTTOM_PADY), sticky="nsw") + + special_thanks_tell_us_message = createTellUsButton( + parent_frame=special_thanks_contents_wrapper, + image_file_name=settings.about_vrct.image_file.SPECIAL_THANKS_TELL_US_MESSAGE, + callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "SUPPORTER_REGISTRATION"), + ) + special_thanks_tell_us_message.grid(column=0, row=3) + + + + + section_row+=1 + # Special Thanks & Supporters ---------------------------------- + _poster_showcase, poster_showcase_contents_wrapper = createSectionContainer( + section_row=section_row, + section_title_image_file_name="poster_showcase_section_title.png", + section_bottom_padding=about_vrct_uism.SECTION_BOTTOM_PADY, + section_title_bottom_padding=about_vrct_uism.POSTER_SHOWCASE_SECTION_TITLE_BOTTOM_PADY + ) + + poster_showcase_worlds_wrapper = CTkFrame(poster_showcase_contents_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_showcase_worlds_wrapper.grid(column=0, row=0, padx=0, pady=0, sticky="nsew") + poster_showcase_worlds_wrapper.grid_columnconfigure(0, weight=1) + + + poster_showcase_worlds = CTkFrame(poster_showcase_worlds_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_showcase_worlds.grid(column=0, row=0, padx=0, pady=(0,about_vrct_uism.POSTER_SHOWCASE_WORLD_BOTTOM_PADY), sticky="nsew") + poster_showcase_worlds.grid_columnconfigure(0, weight=1) + + + poster_showcase_worlds_settings = [ + { + "image_file_name": "ehon_no_heikousekai_jimusho.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "ikoiba.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "ippaidou.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "japanese_culture_osenbeito.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "kimodameshi.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "kokekkopiyopiyo.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "kuroinu_work_room.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "language_exchange_tervern.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "nihongokurabu.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "parallel_collar.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "re_yatuha_room.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "silakan_datang_ke_rumahku.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "study_japanese_world_japanichijou.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "uj_club.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "usanezumi_shrine2.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + { + "image_file_name": "yuttari_eikaiwa.png", + "callback": lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP") + }, + ] + + result = splitListRandomly(poster_showcase_worlds_settings, 8) + poster_showcase_worlds_frame_list = [] + for split_poster_showcase_worlds_settings in result: + poster_showcase_worlds_frame = CTkFrame(poster_showcase_worlds_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_showcase_worlds_frame.grid_columnconfigure(0, weight=1) + + createImageButtonRows( + parent_frame=poster_showcase_worlds_frame, + image_buttons_settings=split_poster_showcase_worlds_settings, + bottom_pady=about_vrct_uism.POSTER_SHOWCASE_WORLD_ITEM_BOTTOM_PADY, + directly_type="showcased_worlds", + corner_radius=about_vrct_uism.POSTER_SHOWCASE_WORLD_CORNER_RADIUS, + ipadx=about_vrct_uism.POSTER_SHOWCASE_WORLD_ITEM_IPADX, + ipady=about_vrct_uism.POSTER_SHOWCASE_WORLD_ITEM_IPADY, + ) + + poster_showcase_worlds_frame_list.append(poster_showcase_worlds_frame) + + + pagination_button_settings = settings.about_vrct.image_file.POSTER_SHOWCASE_WORLD_PAGINATION_BUTTON + + def toNextPagePosterShowcase(current_function_index): + view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_WORLD_LIST=None + poster_showcase_worlds_frame_list[current_function_index].grid_remove() + current_function_index = (current_function_index + 1) % len(poster_showcase_worlds_frame_list) + poster_showcase_worlds_frame_list[current_function_index].grid(column=0, row=0, padx=0, pady=(0,about_vrct_uism.POSTER_SHOWCASE_WORLD_BOTTOM_PADY), sticky="nsew") + view_variable.CALLBACK_ABOUT_VRCT_POSTER_SHOWCASE_CURRENT_PAGE_NUM = current_function_index + + start_angle = 0 + goal_angle = 180 + if current_function_index == 0: + start_angle = 180 + goal_angle = 360 + + animateRotation( + tk_root=config_window, + img_frame=config_window.poster_showcase_pagination_button.img_label, + img=pagination_button_settings.img, + img_width=pagination_button_settings.width, + img_height=pagination_button_settings.height, + start_angle=start_angle, + goal_angle=goal_angle, + duration=0.5, + ) + + view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_WORLD_LIST=toNextPagePosterShowcase + + # Initialize + view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_WORLD_LIST=toNextPagePosterShowcase + + + poster_showcase_worlds_frame_list[0].grid(column=0, row=0, padx=0, pady=(0,about_vrct_uism.POSTER_SHOWCASE_WORLD_BOTTOM_PADY), sticky="nsew") + + poster_showcase_worlds_wrapper.grid_rowconfigure(1, weight=1) + + poster_showcase_pagination_button_wrapper = CTkFrame(poster_showcase_worlds_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_showcase_pagination_button_wrapper.grid(column=0, row=2, padx=0, pady=0, sticky="nsew") + + + poster_showcase_pagination_button_wrapper.grid_columnconfigure((0,2), weight=1) + config_window.poster_showcase_pagination_button = settings.about_vrct.embedImageButtonCTkLabel( + parent_frame=poster_showcase_pagination_button_wrapper, + image_file_name="poster_showcase_pagination_button.png", + callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_WORLD_LIST, view_variable.CALLBACK_ABOUT_VRCT_POSTER_SHOWCASE_CURRENT_PAGE_NUM), + hovered_color="transparent", + clicked_color="transparent", + ) + config_window.poster_showcase_pagination_button.grid(column=1, row=0, padx=0, pady=0, sticky="nsew") + + + # poster_showcase_pagination_button_wrapper.grid_columnconfigure((0,2), weight=1) + poster_showcase_pagination_button_chato = settings.about_vrct.embedImageButtonCTkLabel( + parent_frame=poster_showcase_pagination_button_wrapper, + image_file_name="poster_showcase_pagination_button_chato.png", + callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_WORLD_LIST, view_variable.CALLBACK_ABOUT_VRCT_POSTER_SHOWCASE_CURRENT_PAGE_NUM), + hovered_color="transparent", + clicked_color="transparent", + ) + poster_showcase_pagination_button_chato.place(relx=0.5, rely=0.5, anchor="center") + + pagination_button_chato_settings = settings.about_vrct.image_file.POSTER_SHOWCASE_WORLD_PAGINATION_BUTTON_CHATO + + def rotateChatoAnimation(): + view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_BUTTON_HOVERED = None + + animateRotation( + tk_root=config_window, + img_frame=poster_showcase_pagination_button_chato.img_label, + img=pagination_button_chato_settings.img, + img_width=pagination_button_chato_settings.width, + img_height=pagination_button_chato_settings.height, + start_angle=0, + goal_angle=360, + duration=0.5, + ) + view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_BUTTON_HOVERED = rotateChatoAnimation + + + view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_BUTTON_HOVERED = rotateChatoAnimation + + bindEnterAndLeaveFunction( + target_widgets=[config_window.poster_showcase_pagination_button.img_label,poster_showcase_pagination_button_chato.img_label], + enterFunction=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_ABOUT_VRCT_CHANGE_POSTER_SHOWCASE_BUTTON_HOVERED), + leaveFunction=None, + ) + + + + + poster_container = CTkFrame(poster_showcase_contents_wrapper, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_container.grid(column=1, row=0, padx=0, pady=0, sticky="nsew") + poster_container.grid_columnconfigure(1, weight=1) + + + poster_images_wrapper = CTkFrame(poster_container, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_images_wrapper.grid(column=0, row=0, padx=0, pady=(0,about_vrct_uism.POSTER_SHOWCASE_POSTER_IMAGES_BOTTOM_PADY), sticky="nsew") + poster_images_wrapper.grid_columnconfigure(1, weight=1) + + + + + poster_image_arrow_left = settings.about_vrct.embedImageButtonCTkLabel(poster_images_wrapper, "arrow_left.png", lambda _e: callFunctionIfCallable(view_variable.CALLBACK_ABOUT_VRCT_POSTER_PREV_BUTTON)) + poster_image_arrow_left.grid(column=0, row=0, padx=0, pady=0, sticky="nsew") + poster_image_arrow_left.configure(corner_radius=about_vrct_uism.POSTER_CHANGE_BUTTON_CORNER_RADIUS) + + bindButtonFunctionAndColor( + target_widgets=[poster_image_arrow_left], + enter_color=settings.ctm.ABOUT_VRCT_BUTTON_HOVERED_BG_COLOR, + leave_color=ABOUT_VRCT_BG, + clicked_color=settings.ctm.ABOUT_VRCT_BUTTON_CLICKED_BG_COLOR, + buttonReleasedFunction=None, + ) + + + # For change the image, register to config_window + config_window.poster_image_frame__iya_vrct_poster_ja = settings.about_vrct.embedImageCTkLabel(poster_images_wrapper, "iya_vrct_poster_ja.png", directly_type="vrct_posters") + config_window.poster_image_frame__iya_vrct_poster_en = settings.about_vrct.embedImageCTkLabel(poster_images_wrapper, "iya_vrct_poster_en.png", directly_type="vrct_posters") + config_window.poster_image_frame__iya_vrct_poster_cn = settings.about_vrct.embedImageCTkLabel(poster_images_wrapper, "iya_vrct_poster_cn.png", directly_type="vrct_posters") + + config_window.poster_image_frame_dict = { + "iya_vrct_poster_ja": config_window.poster_image_frame__iya_vrct_poster_ja, + "iya_vrct_poster_en": config_window.poster_image_frame__iya_vrct_poster_en, + "iya_vrct_poster_cn": config_window.poster_image_frame__iya_vrct_poster_cn, + } + def vrctPostersGridRemove(): + for poster_frame in config_window.poster_image_frame_dict.values(): + poster_frame.grid_remove() + + + def gridVrctPoster_Ja(): + vrctPostersGridRemove() + config_window.poster_image_frame_dict["iya_vrct_poster_ja"].grid(column=1, row=0, padx=0, pady=0, sticky="nsew") + view_variable.CALLBACK_ABOUT_VRCT_POSTER_PREV_BUTTON=gridVrctPoster_Cn + view_variable.CALLBACK_ABOUT_VRCT_POSTER_NEXT_BUTTON=gridVrctPoster_En + + def gridVrctPoster_En(): + vrctPostersGridRemove() + config_window.poster_image_frame_dict["iya_vrct_poster_en"].grid(column=1, row=0, padx=0, pady=0, sticky="nsew") + view_variable.CALLBACK_ABOUT_VRCT_POSTER_PREV_BUTTON=gridVrctPoster_Ja + view_variable.CALLBACK_ABOUT_VRCT_POSTER_NEXT_BUTTON=gridVrctPoster_Cn + + def gridVrctPoster_Cn(): + vrctPostersGridRemove() + config_window.poster_image_frame_dict["iya_vrct_poster_cn"].grid(column=1, row=0, padx=0, pady=0, sticky="nsew") + view_variable.CALLBACK_ABOUT_VRCT_POSTER_PREV_BUTTON=gridVrctPoster_En + view_variable.CALLBACK_ABOUT_VRCT_POSTER_NEXT_BUTTON=gridVrctPoster_Ja + + gridVrctPoster_Ja() + + poster_image_arrow_right = settings.about_vrct.embedImageButtonCTkLabel(poster_images_wrapper, "arrow_right.png", lambda _e: callFunctionIfCallable(view_variable.CALLBACK_ABOUT_VRCT_POSTER_NEXT_BUTTON)) + poster_image_arrow_right.grid(column=2, row=0, padx=0, pady=0, sticky="nsew") + poster_image_arrow_right.configure(corner_radius=about_vrct_uism.POSTER_CHANGE_BUTTON_CORNER_RADIUS) + + + bindButtonFunctionAndColor( + target_widgets=[poster_image_arrow_right], + enter_color=settings.ctm.ABOUT_VRCT_BUTTON_HOVERED_BG_COLOR, + leave_color=ABOUT_VRCT_BG, + clicked_color=settings.ctm.ABOUT_VRCT_BUTTON_CLICKED_BG_COLOR, + buttonReleasedFunction=None, + ) + + + poster_images_authors_wrapper = CTkFrame(poster_container, fg_color=ABOUT_VRCT_BG, corner_radius=0, width=0, height=0) + poster_images_authors_wrapper.grid(column=0, row=1, padx=0, pady=0, sticky="nsew") + + poster_images_authors = settings.about_vrct.embedImageCTkLabel(poster_images_authors_wrapper, "poster_images_authors.png") + poster_images_authors.grid(column=0, row=0, padx=0, pady=0, sticky="nsew") + + + poster_tell_us_message = createTellUsButton( + parent_frame=poster_showcase_contents_wrapper, + image_file_name=settings.about_vrct.image_file.POSTER_TELL_US_MESSAGE, + callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP"), + ) + poster_tell_us_message.grid(column=0, row=1, columnspan=2, padx=0, pady=(about_vrct_uism.POSTER_TELL_US_MESSAGE_TOP_PADY,0), sticky="nse") + + + + + + + + + + + + section_row+=1 + # VRChat disclaimer ---------------------------------- + vrchat_disclaimer, vrchat_disclaimer_contents_wrapper = createSectionContainer( + section_row=section_row, + ) + + + vrchat_disclaimer_label = settings.about_vrct.embedImageCTkLabel(vrchat_disclaimer_contents_wrapper, "vrchat_disclaimer.png") + vrchat_disclaimer_label.grid(column=0, row=0, padx=0, pady=(about_vrct_uism.VRCHAT_DISCLAIMER_SECTION_TOP_PADDING, 0), sticky="nsew") \ No newline at end of file diff --git a/vrct_gui/ui_managers/AboutVrctManager.py b/vrct_gui/ui_managers/AboutVrctManager.py new file mode 100644 index 00000000..1856487d --- /dev/null +++ b/vrct_gui/ui_managers/AboutVrctManager.py @@ -0,0 +1,179 @@ +from types import SimpleNamespace + +from ..ui_utils import calculateUiSize, getImageFileFromUiUtils_AboutVrct, bindButtonReleaseFunction, createButtonWithImage, bindButtonFunctionAndColor +from customtkinter import CTkFrame, CTkLabel, CTkImage, CTkFont + +IMAGE_STANDARD_SCALING = 2 +class AboutVrctManager(): + def __init__(self, scaling_percentage, ui_language, ctm): + self.ctm = ctm + scaling_float = int(scaling_percentage.replace("%", "")) / 100 + self.SCALING_FLOAT = max(scaling_float, 0.4) + + self.uism = SimpleNamespace() + + self.uism.ABOUT_VRCT_CONTAINER_LEFT_PADX = self.dupTuple(self._calculateUiSize(32)) + + self.uism.SECTION_BOTTOM_PADY = self._calculateUiSize(22) + self.uism.PROJECT_LINKS_SECTION_BOTTOM_PADDING = self._calculateUiSize(18) # Exception pady + + self.uism.VRCHAT_DISCLAIMER_SECTION_TOP_PADDING = self._calculateUiSize(80) # Exception pady + + self.uism.THE_DEVELOPERS_SECTION_TITLE_BOTTOM_PADY = self._calculateUiSize(8) + self.uism.DEVS_CONTACTS_Y1 = self._calculateUiSize(118) + self.uism.DEVS_MISYA_X_X = self._calculateUiSize(269) + self.uism.DEVS_MISYA_GITHUB_X = self._calculateUiSize(297) + self.uism.DEVS_SHIINA_X_X = self._calculateUiSize(298) + + self.uism.PROJECT_LINK_BOTTOM_PADY = self._calculateUiSize(2) + self.uism.PROJECT_LINK_CORNER_RADIUS = self._calculateUiSize(4) + self.uism.PROJECT_LINK_CONTENTS_PADX = self._calculateUiSize(55) + self.uism.PROJECT_LINK_ITEM_IPADX = self._calculateUiSize(10) + self.uism.PROJECT_LINK_ITEM_IPADY = self._calculateUiSize(4) + + self.uism.CONTRIBUTORS_SECTION_TITLE_BOTTOM_PADY = self._calculateUiSize(10) + + self.uism.CONTRIBUTORS_CONTACTS_Y1 = self._calculateUiSize(66) + self.uism.CONTRIBUTORS_DONE_SAN_X_X = self._calculateUiSize(25) + self.uism.CONTRIBUTORS_IYA_X_X = self._calculateUiSize(281) + self.uism.CONTRIBUTORS_RERA_X_X = self._calculateUiSize(530) + self.uism.CONTRIBUTORS_RERA_GITHUB_X = self._calculateUiSize(554) + + self.uism.CONTRIBUTORS_CONTACTS_Y2 = self._calculateUiSize(170) + self.uism.CONTRIBUTORS_POPOSUKE_X_X = self._calculateUiSize(154) + self.uism.CONTRIBUTORS_KUMAGUMA_X_X = self._calculateUiSize(413) + + + self.uism.TELL_US_BUTTON_CORNER_RADIUS = self._calculateUiSize(6) + self.uism.TELL_US_BUTTON_PADX = self._calculateUiSize(8) + self.uism.TELL_US_BUTTON_PADY = self._calculateUiSize(8) + self.uism.TELL_US_BUTTON_BORDER_WIDTH = self._calculateUiSize(1) + + + self.uism.SPECIAL_THANKS_SECTION_TITLE_BOTTOM_PADY = self._calculateUiSize(6) + self.uism.SPECIAL_THANKS_MEMBERS_BOTTOM_PADY = self._calculateUiSize(4) + self.uism.SPECIAL_THANKS_MESSAGE_BOTTOM_PADY = self._calculateUiSize(0) + self.uism.SPECIAL_THANKS_MESSAGE_AND_YOU_BOTTOM_PADY = self._calculateUiSize(8) + + self.uism.POSTER_SHOWCASE_SECTION_TITLE_BOTTOM_PADY = self._calculateUiSize(6) + self.uism.POSTER_SHOWCASE_POSTER_IMAGES_BOTTOM_PADY = self._calculateUiSize(18) + self.uism.POSTER_SHOWCASE_WORLD_ITEM_BOTTOM_PADY = self._calculateUiSize(4) + self.uism.POSTER_SHOWCASE_WORLD_ITEM_IPADX = self._calculateUiSize(12) + self.uism.POSTER_SHOWCASE_WORLD_ITEM_IPADY = self._calculateUiSize(4) + self.uism.POSTER_SHOWCASE_WORLD_BOTTOM_PADY = self._calculateUiSize(4) + self.uism.POSTER_SHOWCASE_WORLD_CORNER_RADIUS = self._calculateUiSize(4) + self.uism.POSTER_TELL_US_MESSAGE_TOP_PADY = self._calculateUiSize(20) + self.uism.POSTER_CHANGE_BUTTON_CORNER_RADIUS = self._calculateUiSize(6) + + + self.image_file = SimpleNamespace() + + + if ui_language == "ja": + self.image_file.SPECIAL_THANKS_MESSAGE = "special_thanks_message_ja.png" + self.image_file.SPECIAL_THANKS_TELL_US_MESSAGE = "special_thanks_tell_us_message_ja.png" + self.image_file.POSTER_TELL_US_MESSAGE = "poster_tell_us_message_ja.png" + else: + self.image_file.SPECIAL_THANKS_MESSAGE = "special_thanks_message_en.png" + self.image_file.SPECIAL_THANKS_TELL_US_MESSAGE = "special_thanks_tell_us_message_en.png" + self.image_file.POSTER_TELL_US_MESSAGE = "poster_tell_us_message_en.png" + + poster_showcase_pagination_button_image = getImageFileFromUiUtils_AboutVrct("poster_showcase_pagination_button.png") + self.image_file.POSTER_SHOWCASE_WORLD_PAGINATION_BUTTON = SimpleNamespace( + img = poster_showcase_pagination_button_image, + width = calculateUiSize( + default_size = int(poster_showcase_pagination_button_image.width / IMAGE_STANDARD_SCALING), + scaling_float=self.SCALING_FLOAT, + is_allowed_odd=True, + ), + height = calculateUiSize( + default_size = int(poster_showcase_pagination_button_image.height / IMAGE_STANDARD_SCALING), + scaling_float=self.SCALING_FLOAT, + is_allowed_odd=True, + ), + ) + + + poster_showcase_pagination_button_chato_image = getImageFileFromUiUtils_AboutVrct("poster_showcase_pagination_button_chato.png") + self.image_file.POSTER_SHOWCASE_WORLD_PAGINATION_BUTTON_CHATO = SimpleNamespace( + img = poster_showcase_pagination_button_chato_image, + width = calculateUiSize( + default_size = int(poster_showcase_pagination_button_chato_image.width / IMAGE_STANDARD_SCALING), + scaling_float=self.SCALING_FLOAT, + is_allowed_odd=True, + ), + height = calculateUiSize( + default_size = int(poster_showcase_pagination_button_chato_image.height / IMAGE_STANDARD_SCALING), + scaling_float=self.SCALING_FLOAT, + is_allowed_odd=True, + ), + ) + + + + + def _calculateUiSize(self, default_size, is_allowed_odd:bool=True, is_zero_allowed:bool=False): + size = calculateUiSize(default_size, self.SCALING_FLOAT, is_allowed_odd, is_zero_allowed) + return size + + + def embedImageCTkLabel(self, parent_frame, image_file_name, image_scaling=IMAGE_STANDARD_SCALING, directly_type:str=None, fg_color:str="transparent", anchor:str="w"): + + img = getImageFileFromUiUtils_AboutVrct(image_file_name, directly_type) + + image_width = calculateUiSize( + default_size = int(img.width / image_scaling), + scaling_float=self.SCALING_FLOAT, + is_allowed_odd=True, + ) + image_height = calculateUiSize( + default_size = int(img.height / image_scaling), + scaling_float=self.SCALING_FLOAT, + is_allowed_odd=True, + ) + + img_label = CTkLabel( + parent_frame, + text=None, + corner_radius=0, + height=image_height, + fg_color=fg_color, + anchor=anchor, + image=CTkImage((img), size=(image_width, image_height)) + ) + + return img_label + + def embedImageButtonCTkLabel(self, parent_frame, image_file_name, callback, image_scaling=IMAGE_STANDARD_SCALING, directly_type:str=None, fg_color:str=None, hovered_color:str=None, clicked_color:str=None, anchor:str="w", corner_radius:int=0): + + fg_color = self.ctm.ABOUT_VRCT_BG if fg_color is None else fg_color + + if hovered_color is None: + hovered_color = self.ctm.ABOUT_VRCT_BUTTON_HOVERED_BG_COLOR + if clicked_color is None: + clicked_color = self.ctm.ABOUT_VRCT_BUTTON_CLICKED_BG_COLOR + + img_label_frame = CTkFrame(parent_frame, fg_color=fg_color, corner_radius=corner_radius, width=0, height=0) + + img_label = self.embedImageCTkLabel(img_label_frame, image_file_name, image_scaling, directly_type, fg_color, anchor) + + img_label_frame.configure(cursor="hand2") + img_label.configure(cursor="hand2") + img_label._canvas.configure(cursor="hand2") + bindButtonFunctionAndColor( + target_widgets=[img_label_frame, img_label], + enter_color=hovered_color, + leave_color=fg_color, + clicked_color=clicked_color, + buttonReleasedFunction=callback, + ) + + img_label.grid() + img_label_frame.img_label = img_label + + return img_label_frame + + + @staticmethod + def dupTuple(value): + return (value, value) \ No newline at end of file diff --git a/vrct_gui/ui_managers/Themes/_darkTheme.py b/vrct_gui/ui_managers/Themes/_darkTheme.py index 71cbc292..7cfe6890 100644 --- a/vrct_gui/ui_managers/Themes/_darkTheme.py +++ b/vrct_gui/ui_managers/Themes/_darkTheme.py @@ -296,6 +296,16 @@ def _darkTheme(base_color): SB__ERROR_MESSAGE_BG_COLOR = "#bb4448", SB__SUCCESS_MESSAGE_BG_COLOR = "#368777", SB__ERROR_MESSAGE_TEXT_COLOR = "#fff", + + + + # About VRCT + ABOUT_VRCT_BG = base_color.DARK_950_COLOR, + ABOUT_VRCT_DEV_BG = base_color.DARK_888_COLOR, + ABOUT_VRCT_BUTTON_HOVERED_BG_COLOR = base_color.DARK_900_COLOR, + ABOUT_VRCT_BUTTON_CLICKED_BG_COLOR = base_color.DARK_925_COLOR, + + ABOUT_VRCT_TELL_US_BUTTON_BORDER_COLOR = base_color.DARK_888_COLOR, ), diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 798f3412..be1cfa56 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -6,6 +6,7 @@ class UiScalingManager(): def __init__(self, scaling_percentage): scaling_float = int(scaling_percentage.replace("%", "")) / 100 self.SCALING_FLOAT = max(scaling_float, 0.4) + self.common = SimpleNamespace() self.main = SimpleNamespace() self.config_window = SimpleNamespace() @@ -222,7 +223,8 @@ class UiScalingManager(): # Side menu - self.config_window.SIDE_MENU_TOP_PADY = self._calculateUiSize(54) + self.config_window.SIDE_MENU_TOP_PADY = (self._calculateUiSize(54), self._calculateUiSize(60)) + self.config_window.SIDE_MENU_LABELS_SEPARATE_MIN_HEIGHT = self._calculateUiSize(40) self.config_window.SIDE_MENU_LABELS_IPADX = self._calculateUiSize(20) self.config_window.SIDE_MENU_LABELS_IPADY = self._calculateUiSize(8) self.config_window.SIDE_MENU_LABELS_FONT_SIZE = self._calculateUiSize(18) @@ -237,7 +239,10 @@ class UiScalingManager(): # Setting Box self.config_window.MAIN_AREA_MIN_WIDTH = self._calculateUiSize(720) - self.config_window.SB__TOP_PADY = (self._calculateUiSize(60)) + + self.config_window.ABOUT_VRCT_SB__TOP_PADY = self._calculateUiSize(42) # Exception + self.config_window.SB__TOP_PADY = self._calculateUiSize(60) + self.config_window.SB__IPADX = self._calculateUiSize(20) self.config_window.SB__IPADY = self._calculateUiSize(12) self.config_window.SB__BOTTOM_MARGIN = (0, self._calculateUiSize(60)) diff --git a/vrct_gui/ui_managers/__init__.py b/vrct_gui/ui_managers/__init__.py index 6304cb9e..06adde02 100644 --- a/vrct_gui/ui_managers/__init__.py +++ b/vrct_gui/ui_managers/__init__.py @@ -1,2 +1,4 @@ from .ColorThemeManager import ColorThemeManager -from .UiScalingManager import UiScalingManager \ No newline at end of file +from .UiScalingManager import UiScalingManager + +from .AboutVrctManager import AboutVrctManager \ No newline at end of file diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index 94f9adae..fc4b35e7 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -1,6 +1,7 @@ from os import path as os_path from PIL.Image import open as Image_open, LANCZOS -from time import sleep +from time import sleep, time +import math from customtkinter import CTkFrame, CTkLabel, CTkImage, CTkFont @@ -10,8 +11,17 @@ def getImagePath(file_name): def getImageFileFromUiUtils(file_name): # root\img\file_name - img = Image_open(os_path.join(os_path.dirname(os_path.dirname(os_path.dirname(__file__))), "img", file_name)) - return img + return Image_open(os_path.join(os_path.dirname(os_path.dirname(os_path.dirname(__file__))), "img", file_name)) + +def getImageFileFromUiUtils_AboutVrct(file_name, directly_type:str=None): + # root\img\about_vrct\file_name or directly_name... + directly_path = ["img", "about_vrct"] + if directly_type == "showcased_worlds": + directly_path.append("showcased_worlds") + elif directly_type == "vrct_posters": + directly_path.append("vrct_posters") + + return Image_open(os_path.join(os_path.dirname(os_path.dirname(os_path.dirname(__file__))), *directly_path, file_name)) def openImageKeepAspectRatio(image_file, desired_width): wpercent = (desired_width/float(image_file.size[0])) @@ -54,12 +64,12 @@ def getLongestText_Dict(text_dict:dict): return longest_text def calculateUiSize(default_size, scaling_float, is_allowed_odd:bool=False, is_zero_allowed:bool=False): - size = int(default_size * scaling_float) - size += 1 if not is_allowed_odd and size % 2 != 0 else 0 - if size <= 0: - size = 0 if is_zero_allowed else 1 + size = int(default_size * scaling_float) + size += 1 if not is_allowed_odd and size % 2 != 0 else 0 + if size <= 0: + size = 0 if is_zero_allowed else 1 - return size + return size def bindEnterAndLeaveColor(target_widgets, enter_color, leave_color): for target_widget in target_widgets: @@ -372,4 +382,29 @@ def fadeInAnimation(root_widget, steps:int=10, interval:float=0.1, max_alpha:flo root_widget.update() sleep(interval) num += step_size - root_widget.attributes("-alpha", max_alpha) \ No newline at end of file + root_widget.attributes("-alpha", max_alpha) + + +def rotateImage(image, angle, to_expand=False): + rotated_image = image.rotate(angle, expand=to_expand) + return rotated_image + +def animateRotation(tk_root, img_frame, img, img_width, img_height, start_angle:int, goal_angle:int, duration=0.5, to_expand:bool=False): + start_time = time() + while True: + elapsed_time = time() - start_time + progress = min(elapsed_time / duration, 1.0) + eased_progress = 1 - math.pow(1 - progress, 4) + + angle = start_angle + (goal_angle - start_angle) * eased_progress + angle = -angle + + rotated_img = rotateImage(img, angle, to_expand) + img_frame.configure(image=CTkImage(rotated_img, size=(img_width, img_height))) + + tk_root.update() + + if elapsed_time >= duration: + break + + sleep(0.01)