fix:Worked around weird behavior of Mdlabel's with a background color

This commit is contained in:
Benedict Xavier Wanyonyi
2024-05-26 20:23:13 +03:00
parent e14fb076bd
commit 7e71cffb78
11 changed files with 69 additions and 85 deletions

View File

@@ -1,17 +1,5 @@
#:import get_hex_from_color kivy.utils.get_hex_from_color
<CharactersHeaderText@MDLabel>
adaptive_height:True
# halign:"center"
max_lines:0
shorten:False
md_bg_color:self.theme_cls.secondaryContainerColor
bold:True
markup:True
font_style: "Body"
role: "large"
padding:"10dp"
<CharactersContainer@MDBoxLayout>:
adaptive_height:True
md_bg_color:self.theme_cls.surfaceContainerLowColor
@@ -74,8 +62,9 @@
adaptive_height:True
container:container
orientation:"vertical"
CharactersHeaderText:
HeaderLabel:
text:"Characters"
halign:"left"
CharactersContainer:
id:container

View File

@@ -1,14 +1,15 @@
<DescriptionHeader@MDLabel>
adaptive_height:True
# halign:"center"
max_lines:0
shorten:False
bold:True
markup:True
font_style: "Body"
role: "large"
md_bg_color:self.theme_cls.secondaryContainerColor
padding:"10dp"
# <DescriptionHeader>
# adaptive_height:True
# md_bg_color:self.theme_cls.secondaryContainerColor
# MDLabel:
# text:root.text
# adaptive_height:True
# max_lines:0
# shorten:False
# bold:True
# font_style: "Body"
# role: "large"
# padding:"10dp"
<DescriptionContainer@MDBoxLayout>:
adaptive_height:True
@@ -25,7 +26,8 @@
<AnimeDescription>:
orientation:"vertical"
adaptive_height:True
DescriptionHeader:
HeaderLabel:
halign:"left"
text:"Description"
DescriptionContainer:
DescriptionText:

View File

@@ -2,16 +2,18 @@
adaptive_height:True
orientation: 'vertical'
# padding:"10dp"
MDLabel:
text: root.titles
MDBoxLayout:
adaptive_height:True
md_bg_color:self.theme_cls.secondaryContainerColor
padding:"5dp"
bold:True
shorten:False
max_lines:2
font_style:"Label"
role:"large"
MDLabel:
text: root.titles
adaptive_height:True
padding:"5dp"
bold:True
shorten:False
max_lines:2
font_style:"Label"
role:"large"
FitImage:
size_hint_y: None
height: dp(250)

View File

@@ -3,17 +3,15 @@
<RankingsLabel@MDLabel>:
max_lines:0
shorten:False
# padding:"10dp"
markup:True
font_style: "Label"
role: "medium"
<RankingsHeaderLabel@MDLabel>:
color:self.theme_cls.primaryColor
bold:True
# padding:"10dp"
max_lines:0
shorten:False
markup:True
font_style: "Label"
role: "large"
@@ -38,12 +36,15 @@
adaptive_width:True
MDBoxLayout:
adaptive_size:True
# spacing:"5dp"
pos_hint: {'center_y': .5}
MDIcon:
icon: "star"
color:yellow
disabled: not((root.rankings["AverageScore"]/100)*6>=2)
disabled: not((root.rankings["AverageScore"]/100)*6>=1)
MDIcon:
color:yellow
disabled: not(root.rankings["AverageScore"]/100*6>=2)
icon: "star"
MDIcon:
color:yellow
disabled: not(root.rankings["AverageScore"]/100*6>=3)
@@ -54,8 +55,8 @@
icon: "star"
MDIcon:
color:yellow
disabled: not(root.rankings["AverageScore"]/100*6>=5)
icon: "star"
disabled: not(root.rankings["AverageScore"]/100*6>=5)
MDIcon:
color:yellow
icon: "star"

View File

@@ -1,16 +1,5 @@
#:import get_hex_from_color kivy.utils.get_hex_from_color
<ReviewHeaderText@MDLabel>
adaptive_height:True
# halign:"center"
max_lines:0
shorten:False
md_bg_color:self.theme_cls.secondaryContainerColor
bold:True
markup:True
font_style: "Body"
role: "large"
padding:"10dp"
<ReviewContainer@MDBoxLayout>:
adaptive_height:True
@@ -54,7 +43,8 @@
container:container
adaptive_height:True
orientation:"vertical"
ReviewHeaderText:
HeaderLabel:
halign:"left"
text:"reviews"
ReviewContainer:
id:container

View File

@@ -16,17 +16,19 @@
markup:True
font_style: "Label"
role: "medium"
# pos_hint: {'center_x': 0.5}
<SideBarHeaderLabel>:
<HeaderLabel>:
adaptive_height:True
halign:"center"
max_lines:0
shorten:False
bold:True
font_style: "Label"
role: "large"
md_bg_color:self.theme_cls.secondaryContainerColor
padding:"10dp"
MDLabel:
text:root.text
adaptive_height:True
halign:root.halign
max_lines:0
shorten:False
bold:True
font_style: "Label"
role: "large"
padding:"10dp"
<AnimeSideBar>:
size_hint_x: None
@@ -51,7 +53,7 @@
MDButtonText:
text:"Watch on Animdl"
FitBoxLayout:
SideBarHeaderLabel:
HeaderLabel:
text:"Alternative Titles"
SideBarLabel:
text: "[color={}]Synonyms:[/color] {}".format(get_hex_from_color(self.theme_cls.primaryColor),root.alternative_titles["synonyms"])
@@ -60,7 +62,7 @@
SideBarLabel:
text: "[color={}]Japanese:[/color] {}".format(get_hex_from_color(self.theme_cls.primaryColor),root.alternative_titles["japanese"])
FitBoxLayout:
SideBarHeaderLabel:
HeaderLabel:
text:"Information"
SideBarLabel:
text: "[color={}]Episodes:[/color] {}".format(get_hex_from_color(self.theme_cls.primaryColor),root.information["episodes"])
@@ -87,17 +89,17 @@
SideBarLabel:
text: "[color={}]Genres:[/color] {}".format(get_hex_from_color(self.theme_cls.primaryColor),root.information["genres"])
SideBarLabel:
text: "[color={}]Duration:[/color] {}".format(get_hex_from_color(self.theme_cls.primaryColor),root.information["duration"])
text: "[color={}]Duration:[/color] {} minutes".format(get_hex_from_color(self.theme_cls.primaryColor),root.information["duration"])
FitBoxLayout:
id:statistics_container
SideBarHeaderLabel:
HeaderLabel:
text:"Rankings"
FitBoxLayout:
id:tags_container
SideBarHeaderLabel:
HeaderLabel:
text:"Tags"
FitBoxLayout:
id:external_links_container
SideBarHeaderLabel:
HeaderLabel:
text:"External Links"
BoxLayout:

View File

@@ -1,13 +1,16 @@
from kivy.properties import ObjectProperty,StringProperty,DictProperty,ListProperty
from kivy.utils import get_hex_from_color
from kivy.factory import Factory
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.label import MDLabel
class SideBarHeaderLabel(MDLabel):
pass
class HeaderLabel(MDBoxLayout):
text = StringProperty()
halign = StringProperty("center")
Factory.register("HeaderLabel", HeaderLabel)
class SideBarLabel(MDLabel):
pass
@@ -44,7 +47,7 @@ class AnimeSideBar(MDBoxLayout):
def on_statistics(self,instance,value):
self.statistics_container.clear_widgets()
header = SideBarHeaderLabel()
header = HeaderLabel()
header.text = "Rankings"
self.statistics_container.add_widget(header)
for stat in value:
@@ -58,7 +61,7 @@ class AnimeSideBar(MDBoxLayout):
def on_tags(self,instance,value):
self.tags_container.clear_widgets()
header = SideBarHeaderLabel()
header = HeaderLabel()
header.text = "Tags"
self.tags_container.add_widget(header)
for tag in value:
@@ -72,7 +75,7 @@ class AnimeSideBar(MDBoxLayout):
def on_external_links(self,instance,value):
self.external_links_container.clear_widgets()
header = SideBarHeaderLabel()
header = HeaderLabel()
header.text = "External Links"
self.external_links_container.add_widget(header)
for site in value:

View File

@@ -1,6 +1,6 @@
<TrendingAnimeSideBar>:
orientation: 'vertical'
adaptive_height:True
adaptive_height:True
md_bg_color:self.theme_cls.surfaceContainerLowColor
pos_hint: {'center_x': 0.5}
padding:"25dp","25dp","25dp","200dp"

View File

@@ -32,7 +32,7 @@
MDBoxLayout:
orientation: 'vertical'
size_hint_y:None
height:self.minimum_height
height:max(self.parent.parent.height,self.minimum_height)
MDGridLayout:
pos_hint: {'center_x': 0.5}
id:search_results_container
@@ -40,7 +40,7 @@
padding: "75dp","50dp","75dp","200dp"
cols:5
size_hint_y:None
height:self.minimum_height
height:max(self.parent.parent.height,self.minimum_height)
SearchResultsPagination:
id:search_results_pagination
search_view:root
@@ -49,17 +49,10 @@
size_hint_y:1
size_hint_x:None
width: dp(250)
MDLabel:
HeaderLabel:
text:"Trending"
adaptive_height:True
halign:"center"
max_lines:0
# md_bg_color:Stat
shorten:False
bold:True
font_style: "Label"
role: "large"
padding:"10dp"
MDScrollView:
TrendingAnimeSideBar:
id:trending_anime_sidebar
height:max(self.parent.parent.height,self.minimum_height)

View File

@@ -590,6 +590,7 @@ anime_query = """
query($id:Int){
Page{
media(id:$id) {
id
title {
romaji
english

View File

@@ -31,6 +31,7 @@ from libs.animdl.animdl_api import AnimdlApi
from Utility import themes_available, show_notification, user_data_helper
# Ensure the user data fields exist
if not (user_data_helper.user_data.exists("user_anime_list")):
user_data_helper.update_user_anime_list([])
@@ -129,7 +130,7 @@ class AniXStreamApp(MDApp):
self.theme_cls.primary_palette = value
else:
Logger.warning(
"Settings:An invalid theme has been entered and will be ignored"
"AniXStream Settings: An invalid theme has been entered and will be ignored"
)
config.set("Preferences", "theme_color", "Cyan")
config.write()