diff --git a/resources/images/cursor.png b/resources/images/cursor.png new file mode 100644 index 0000000..1e1acd8 Binary files /dev/null and b/resources/images/cursor.png differ diff --git a/screens/custom_widgets/bottom_bar.kv b/screens/custom_widgets/bottom_bar.kv index de8245b..89d646e 100644 --- a/screens/custom_widgets/bottom_bar.kv +++ b/screens/custom_widgets/bottom_bar.kv @@ -1,6 +1,15 @@ #:kivy 2.2.1 #:import PATH_IMAGES tools.path.PATH_IMAGES +# : +# color: (0,0,0,1) +# canvas: +# Color: +# rgba: self.color +# Rectangle: +# pos: self.pos +# size: self.size + : canvas.before: @@ -18,8 +27,17 @@ pos: (0,self.height) size: (self.width, self.separation_height) + Image: + id: selected_cursor + source: PATH_IMAGES + "cursor.png" + pos_hint: root.selected_rect_pos + fit_mode: "contain" + size_hint: root.selected_rect_size + color: root.selected_color + # Home button ImageButton: + id: home_button source: PATH_IMAGES + "home.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.125, "center_y":0.5} @@ -27,6 +45,7 @@ # Customization button ImageButton: + id: customization_button source: PATH_IMAGES + "customization.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.375, "center_y":0.5} @@ -34,6 +53,7 @@ # Profile button ImageButton: + id: profile_button source: PATH_IMAGES + "profile.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.625, "center_y":0.5} @@ -41,6 +61,7 @@ # Settings button ImageButton: + id: settings_button source: PATH_IMAGES + "settings.png" size_hint: root.button_width, root.button_height pos_hint: {"center_x":0.875, "center_y":0.5} diff --git a/screens/custom_widgets/bottom_bar.py b/screens/custom_widgets/bottom_bar.py index e36cc8a..0f9c9cb 100644 --- a/screens/custom_widgets/bottom_bar.py +++ b/screens/custom_widgets/bottom_bar.py @@ -6,7 +6,11 @@ ### Imports ### ############### +### Kivy imports ### from kivy.uix.relativelayout import RelativeLayout +from kivy.properties import ListProperty, StringProperty, ObjectProperty + +### Local imports ### from tools.kivy_tools import ImageButton ############# @@ -17,6 +21,22 @@ class BottomBar(RelativeLayout): background_color = (0, 0, 0, 0.5) separation_color = (1, 1, 1, 1) + selected_color = (1, 0, 0, 1) separation_height = 3 button_width = 0.15 button_height = 0.7 + selected = StringProperty() + selected_rect_pos = ObjectProperty((0, 0)) + selected_rect_size = ObjectProperty((0, 0)) + + def __init__(self, **kw): + super().__init__(**kw) + + def on_kv_post(self, base_widget): + if self.selected + "_button" in self.ids.keys(): + self.selected_rect_pos = self.ids[self.selected + + "_button"].pos_hint + self.selected_rect_size = \ + (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) diff --git a/screens/home.kv b/screens/home.kv index 7db331a..e1f45c5 100644 --- a/screens/home.kv +++ b/screens/home.kv @@ -21,4 +21,5 @@ BottomBar: size_hint: (1, BOTTOM_BAR_HEIGHT) - pos_hint: {"bottom":0,"left":0} \ No newline at end of file + pos_hint: {"bottom":0,"left":0} + selected: "home" \ No newline at end of file