diff --git a/screens/__init__.py b/screens/__init__.py index a961dd0..a2e44f1 100644 --- a/screens/__init__.py +++ b/screens/__init__.py @@ -7,3 +7,6 @@ ############### from screens.home import HomeScreen +from screens.profile import ProfileScreen +from screens.customization import CustomizationScreen +from screens.settings import SettingsScreen diff --git a/screens/custom_widgets/bottom_bar.kv b/screens/custom_widgets/bottom_bar.kv index 865d07e..56f5611 100644 --- a/screens/custom_widgets/bottom_bar.kv +++ b/screens/custom_widgets/bottom_bar.kv @@ -33,7 +33,7 @@ source: PATH_IMAGES + "home.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.125, "center_y":0.5} - # release_function: root.manager.current = "home" + release_function: root.open_home # Customization button ImageButton: @@ -41,7 +41,7 @@ source: PATH_IMAGES + "customization.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.375, "center_y":0.5} - # release_function: root.manager.current = "customization" + release_function: root.open_customization # Profile button ImageButton: @@ -49,7 +49,7 @@ source: PATH_IMAGES + "profile.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.625, "center_y":0.5} - # release_function: root.manager.current = "customization" + release_function: root.open_profile # Settings button ImageButton: @@ -57,4 +57,4 @@ source: PATH_IMAGES + "settings.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.875, "center_y":0.5} - # release_function: root.manager.current = "customization" + release_function: root.open_settings diff --git a/screens/custom_widgets/bottom_bar.py b/screens/custom_widgets/bottom_bar.py index c98fe42..167c982 100644 --- a/screens/custom_widgets/bottom_bar.py +++ b/screens/custom_widgets/bottom_bar.py @@ -43,3 +43,19 @@ def on_kv_post(self, base_widget): (self.ids[self.selected + "_button"].size_hint[0] * 1.2, self.ids[self.selected + "_button"].size_hint[1] * 1.2) return super().on_kv_post(base_widget) + + def open_home(self): + if self.selected != "home": + self.parent.manager.current = "home" + + def open_settings(self): + if self.selected != "settings": + self.parent.manager.current = "settings" + + def open_customization(self): + if self.selected != "customization": + self.parent.manager.current = "customization" + + def open_profile(self): + if self.selected != "profile": + self.parent.manager.current = "profile" diff --git a/screens/customization.kv b/screens/customization.kv index e69de29..e5e3f46 100644 --- a/screens/customization.kv +++ b/screens/customization.kv @@ -0,0 +1,26 @@ +#:kivy 2.2.1 +#:import PATH_IMAGES tools.path.PATH_IMAGES +#:import PATH_TITLE_FONT tools.path.PATH_TITLE_FONT +#:import TITLE_FONT_SIZE tools.constants.TITLE_FONT_SIZE +#:import TITLE_OUTLINE_WIDTH tools.constants.TITLE_OUTLINE_WIDTH +#:import TITLE_OUTLINE_COLOR tools.constants.TITLE_OUTLINE_COLOR +#:import PATH_TEXT_FONT tools.path.PATH_TEXT_FONT +#:import TEXT_FONT_COLOR tools.constants.TEXT_FONT_COLOR +#:import BOTTOM_BAR_HEIGHT tools.constants.BOTTOM_BAR_HEIGHT + + +: + Label: + text: "TO DO" + font_name: PATH_TITLE_FONT + font_size: TITLE_FONT_SIZE * root.font_ratio + pos_hint: {"center_x":0.5, "center_y":0.9} + outline_width: TITLE_OUTLINE_WIDTH + outline_color: TITLE_OUTLINE_COLOR + color: TEXT_FONT_COLOR + + BottomBar: + size_hint: (1, BOTTOM_BAR_HEIGHT) + pos_hint: {"bottom":0,"left":0} + selected: "customization" + diff --git a/screens/customization.py b/screens/customization.py index e69de29..cad53a8 100644 --- a/screens/customization.py +++ b/screens/customization.py @@ -0,0 +1,38 @@ +""" +Module to create the customization screen. +""" + +############### +### Imports ### +############### + +from tools.path import ( + PATH_BACKGROUNDS +) +from tools.constants import ( + USER_DATA, + THEMES_DICT +) +from screens.custom_widgets import ( + BottomBar, + CustomButton +) +from tools.kivy_tools import ( + ImprovedScreen, + ImageButton +) + + +############# +### Class ### +############# + + +class CustomizationScreen(ImprovedScreen): + + def __init__(self, **kwargs) -> None: + current_background_theme = USER_DATA.settings["current_background_theme"] + super().__init__( + back_image_path=PATH_BACKGROUNDS + + THEMES_DICT[current_background_theme]["image"], + **kwargs) diff --git a/screens/opening.py b/screens/opening.py index b113645..eb07dc1 100644 --- a/screens/opening.py +++ b/screens/opening.py @@ -56,7 +56,11 @@ def launch_thread(self, *_): def load_kv_files(self, *_): from screens import ( - HomeScreen) + HomeScreen, + SettingsScreen, + ProfileScreen, + CustomizationScreen + ) screen_files = [file for file in os.listdir( "screens") if file.endswith(".kv")] @@ -69,6 +73,9 @@ def load_kv_files(self, *_): f"screens/custom_widgets/{file}", encoding="utf-8") self.HomeScreen = HomeScreen + self.SettingsScreen = SettingsScreen + self.ProfileScreen = ProfileScreen + self.CustomizationScreen = CustomizationScreen Clock.schedule_once(self.load_other_screens) @@ -80,20 +87,10 @@ def load_other_screens(self, *args): ### Load the kv files of the screens ### home_screen = self.HomeScreen(name="home") self.manager.add_widget(home_screen) - # game_screen = self.GameScreen(name="game") - # self.manager.add_widget(game_screen) - # settings_screen = self.SettingsScreen(name="settings") - # self.manager.add_widget(settings_screen) - # game_over_screen = self.GameOverScreen(name="game_over") - # self.manager.add_widget(game_over_screen) - # achievements_screen = self.AchievementsScreen(name="achievements") - # self.manager.add_widget(achievements_screen) - # tutorial_screen = self.TutorialScreen(name="tutorial") - # self.manager.add_widget(tutorial_screen) - # help_screen = self.HelpScreen(name="help") - # self.manager.add_widget(help_screen) - # Preload screens - # Clock.schedule_once(self.manager.get_screen("game").preload) - # Clock.schedule_once(self.manager.get_screen("game_over").preload) - # self.manager.current = "menu" + settings_screen = self.SettingsScreen(name="settings") + self.manager.add_widget(settings_screen) + profile_screen = self.ProfileScreen(name="profile") + self.manager.add_widget(profile_screen) + customization_screen = self.CustomizationScreen(name="customization") + self.manager.add_widget(customization_screen) Clock.schedule_once(self.switch_to_menu) diff --git a/screens/profile.kv b/screens/profile.kv index e69de29..65d998a 100644 --- a/screens/profile.kv +++ b/screens/profile.kv @@ -0,0 +1,26 @@ +#:kivy 2.2.1 +#:import PATH_IMAGES tools.path.PATH_IMAGES +#:import PATH_TITLE_FONT tools.path.PATH_TITLE_FONT +#:import TITLE_FONT_SIZE tools.constants.TITLE_FONT_SIZE +#:import TITLE_OUTLINE_WIDTH tools.constants.TITLE_OUTLINE_WIDTH +#:import TITLE_OUTLINE_COLOR tools.constants.TITLE_OUTLINE_COLOR +#:import PATH_TEXT_FONT tools.path.PATH_TEXT_FONT +#:import TEXT_FONT_COLOR tools.constants.TEXT_FONT_COLOR +#:import BOTTOM_BAR_HEIGHT tools.constants.BOTTOM_BAR_HEIGHT + + +: + Label: + text: "TO DO" + font_name: PATH_TITLE_FONT + font_size: TITLE_FONT_SIZE * root.font_ratio + pos_hint: {"center_x":0.5, "center_y":0.9} + outline_width: TITLE_OUTLINE_WIDTH + outline_color: TITLE_OUTLINE_COLOR + color: TEXT_FONT_COLOR + + BottomBar: + size_hint: (1, BOTTOM_BAR_HEIGHT) + pos_hint: {"bottom":0,"left":0} + selected: "profile" + diff --git a/screens/profile.py b/screens/profile.py index e69de29..3002394 100644 --- a/screens/profile.py +++ b/screens/profile.py @@ -0,0 +1,38 @@ +""" +Module to create the profile screen. +""" + +############### +### Imports ### +############### + +from tools.path import ( + PATH_BACKGROUNDS +) +from tools.constants import ( + USER_DATA, + THEMES_DICT +) +from screens.custom_widgets import ( + BottomBar, + CustomButton +) +from tools.kivy_tools import ( + ImprovedScreen, + ImageButton +) + + +############# +### Class ### +############# + + +class ProfileScreen(ImprovedScreen): + + def __init__(self, **kwargs) -> None: + current_background_theme = USER_DATA.settings["current_background_theme"] + super().__init__( + back_image_path=PATH_BACKGROUNDS + + THEMES_DICT[current_background_theme]["image"], + **kwargs) diff --git a/screens/settings.kv b/screens/settings.kv index e69de29..2fac32e 100644 --- a/screens/settings.kv +++ b/screens/settings.kv @@ -0,0 +1,26 @@ +#:kivy 2.2.1 +#:import PATH_IMAGES tools.path.PATH_IMAGES +#:import PATH_TITLE_FONT tools.path.PATH_TITLE_FONT +#:import TITLE_FONT_SIZE tools.constants.TITLE_FONT_SIZE +#:import TITLE_OUTLINE_WIDTH tools.constants.TITLE_OUTLINE_WIDTH +#:import TITLE_OUTLINE_COLOR tools.constants.TITLE_OUTLINE_COLOR +#:import PATH_TEXT_FONT tools.path.PATH_TEXT_FONT +#:import TEXT_FONT_COLOR tools.constants.TEXT_FONT_COLOR +#:import BOTTOM_BAR_HEIGHT tools.constants.BOTTOM_BAR_HEIGHT + + +: + Label: + text: "TO DO" + font_name: PATH_TITLE_FONT + font_size: TITLE_FONT_SIZE * root.font_ratio + pos_hint: {"center_x":0.5, "center_y":0.9} + outline_width: TITLE_OUTLINE_WIDTH + outline_color: TITLE_OUTLINE_COLOR + color: TEXT_FONT_COLOR + + BottomBar: + size_hint: (1, BOTTOM_BAR_HEIGHT) + pos_hint: {"bottom":0,"left":0} + selected: "settings" + diff --git a/screens/settings.py b/screens/settings.py index e69de29..870a4be 100644 --- a/screens/settings.py +++ b/screens/settings.py @@ -0,0 +1,38 @@ +""" +Module to create the settings screen. +""" + +############### +### Imports ### +############### + +from tools.path import ( + PATH_BACKGROUNDS +) +from tools.constants import ( + USER_DATA, + THEMES_DICT +) +from screens.custom_widgets import ( + BottomBar, + CustomButton +) +from tools.kivy_tools import ( + ImprovedScreen, + ImageButton +) + + +############# +### Class ### +############# + + +class SettingsScreen(ImprovedScreen): + + def __init__(self, **kwargs) -> None: + current_background_theme = USER_DATA.settings["current_background_theme"] + super().__init__( + back_image_path=PATH_BACKGROUNDS + + THEMES_DICT[current_background_theme]["image"], + **kwargs)