completed the basic ui and anilist module

This commit is contained in:
Benex254
2024-08-05 09:46:53 +03:00
commit a8b6695269
44 changed files with 3775 additions and 0 deletions

View File

View File

@@ -0,0 +1,80 @@
<SearchScreenView>
md_bg_color: self.theme_cls.backgroundColor
search_results_container:search_results_container
MDBoxLayout:
size_hint:1,1
MDNavigationRail:
anchor:"top"
type: "selected"
md_bg_color: self.theme_cls.secondaryContainerColor
MDNavigationRailFabButton:
icon: "home"
on_release:
root.manager_screens.current = "main screen"
CommonNavigationRailItem:
icon: "magnify"
text: "Search"
# on_release:
# root.manager_screens.current_screen = "search screen"
CommonNavigationRailItem:
icon: "bookmark-outline"
text: "My Anime List"
on_release:
root.manager_screens.current = "my list screen"
CommonNavigationRailItem:
icon: "library-outline"
text: "Library"
CommonNavigationRailItem:
icon: "cog"
text: "settings"
# ScreenManager:
# MDScreen:
# name:"main"
MDAnchorLayout:
anchor_y: 'top'
padding:"10dp"
size_hint:1,1
MDBoxLayout:
orientation: 'vertical'
id:p
size_hint:1,1
MDBoxLayout:
pos_hint: {'center_x': 0.5,'top': 1}
padding: "10dp"
size_hint_y:None
height: self.minimum_height
size_hint_x:.75
spacing: '20dp'
MDTextField:
size_hint_x:1
required:True
on_text_validate:
root.handle_search_for_anime(args[0])
MDTextFieldLeadingIcon:
icon: "magnify"
MDTextFieldHintText:
text: "Search for anime"
# MDTextFieldTrailingIcon:
# icon: "filter"
MDIconButton:
pos_hint: {'center_y': 0.5}
icon: "account-circle"
# size: 32,32
MDScrollView:
size_hint:1,1
MDGridLayout:
id:search_results_container
spacing: '10dp'
padding: "75dp","75dp","10dp","200dp"
cols:5
size_hint_y:None
height:self.minimum_height

View File

@@ -0,0 +1,31 @@
from kivy.properties import ObjectProperty,StringProperty,DictProperty
from View.base_screen import BaseScreenView
class SearchScreenView(BaseScreenView):
search_results_container = ObjectProperty()
search_term = StringProperty()
filters = DictProperty()
is_searching = False
def model_is_changed(self) -> None:
"""
Called whenever any change has occurred in the data model.
The view in this method tracks these changes and updates the UI
according to these changes.
"""
def handle_search_for_anime(self,search_widget):
search_term = search_widget.text
if search_term and not(self.is_searching):
self.search_term = search_term
self.search_results_container.clear_widgets()
if self.filters:
self.controller.requested_search_for_anime(search_term,**self.filters)
else:
self.controller.requested_search_for_anime(search_term)
def update_layout(self,widget):
self.search_results_container.add_widget(widget)
def add_pagination(self,pagination_info):
pass