separate_pages
quadrismegistus 4 years ago
parent d4d2f6534d
commit 49400afd9e

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

@ -12,7 +12,7 @@ MyLayout:
canvas:
Color:
rgba: 1,1,1,1 #get_color_from_hex(colors['Gray']['900'])
rgba: 0.925,0.925,0.925,1 #get_color_from_hex(colors['Gray']['900'])
Rectangle:
pos: self.pos
size: self.size
@ -21,7 +21,7 @@ MyLayout:
id: toolbar
title: app.title
pos_hint: {'center_x': .5, 'center_y': 0.95}
md_bg_color: 0,0,0,1
md_bg_color: 0.1,0.1,0.1,1
background_palette: 'Red'
background_hue: '500'
specific_text_color: 1,0,0,1
@ -42,20 +42,6 @@ MyLayout:
FeedScreen:
name: 'feed'
# md_bg_color: 1,0,0,1
# ScrollView:
# pos_hint: {'center_x': .5}
# size_hint_x: None
# width: container.width
# # size_hint_y: None
# #
# # do_scroll_x: False
# # bar_width: 10
# # bar_color: app.theme_cls.primary_color
# # bar_color_acrive: app.theme_cls.accent_color
# # effect_cls: "DampedScrollEffect"
# # scroll_type: ['bars']
ScrollView:
id: scroll
@ -67,17 +53,7 @@ MyLayout:
MDList:
id: container
#cols: 1
ThreeLineAvatarListItem:
text: "Three-line item with avatar"
secondary_text: "Secondary text here"
tertiary_text: "fit more text than usual"
text_color: 1,0,0,1
theme_text_color: 'Custom'
ImageLeftWidget:
source: "spiral2.png"

@ -18,7 +18,7 @@ from kivymd.uix.card import MDCard, MDSeparator
from kivy.uix.gridlayout import GridLayout
from kivy.metrics import dp
from kivy.properties import NumericProperty
from kivymd.uix.list import MDList, ThreeLineAvatarListItem
from kivymd.uix.list import MDList, TwoLineAvatarListItem, ImageLeftWidget
root = None
@ -45,73 +45,46 @@ class MyLabel(MDLabel):
for k,v in kwargs.items(): setattr(self,k,v)
class ScrollCenterLayout(GridLayout):
rel_max = NumericProperty(dp(800))
rel_min = NumericProperty(dp(400))
def __init__(self, **kwargs):
super(ScrollCenterLayout, self).__init__(**kwargs)
self.rel_max = kwargs.get('rel_max', dp(800))
self.rel_min = kwargs.get('rel_min', dp(400))
def on_width(self, instance, value):
if self.rel_max < value:
padding = max(value * .125, (value - self.rel_max) / 2)
elif self.rel_min < value:
padding = min(value * .125, (value - self.rel_min) / 2)
elif self.rel_min < value:
padding = (value - self.rel_min) / 2
else:
padding = 0
self.padding[0] = self.padding[2] = padding
class Post(MDCard):
"""MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: None, None
size: "280dp", "180dp"
pos_hint: {"center_x": .5, "center_y": .5}
class Post(TwoLineAvatarListItem):
"""
text: "Three-line item with avatar"
secondary_text: "Secondary text here"
tertiary_text: "fit more text than usual"
text_color: 1,0,0,1
theme_text_color: 'Custom'
"""
def __init__(self, title, content, *args, **kwargs):
super().__init__() #*args, **kwargs)
self.text = title
self.secondary_text = content
# self.theme_text_color='Custom'
# self.secondary_theme_text_color = 'Custom'
# self.text_color=(1,0,0,1)
# self.secondary_text_color = (1,0,0,1)
MDLabel:
text: "Title"
theme_text_color: "Secondary"
size_hint_y: None
height: self.texture_size[1]
avatar = ImageLeftWidget()
avatar.source = 'avatar.jpg'
self.add_widget(avatar)
MDSeparator:
height: "1dp"
MDLabel:
text: "Body"
"""
def __init__(self, title, author, content):
super().__init__()
self.orientation='vertical'
self.padding=dp(15)
self.size_hint = (1, None)
self.pos_hint = {"center_x": .5, "center_y": .5}
self.md_bg_color = (0.1,0.1,0.1,1)
self.halign = 'center'
self.add_widget(MyLabel(text=title, halign='left', size_hint_y=None)) #, size_hint_y=None, height='10dp'))
# self.add_widget(MyLabel(text=author, halign='left')) #, size_hint_y=None, height='10dp'))
self.add_widget(MyLabel(text=content, halign='left')) #, size_hint_y=None, height='50dp'))
class FeedScreen(MDScreen):
def on_enter(self):
for i in range(25):
post = Post(title=f'Title {i}', author=f'Author {i}', content='This is the content')
sep = MDSeparator()
sep.height='1dp'
root.ids.container.add_widget(post)
root.ids.container.add_widget(sep)
lim=25
with open('tweets.txt') as f:
for i,ln in enumerate(f):
if i>lim: break
post = Post(title=f'Marx Zuckerberg', content=ln.strip())
sep = MDSeparator()
sep.height='1dp'
root.ids.container.add_widget(post)
root.ids.container.add_widget(sep)
class WelcomeScreen(MDScreen): pass
class PeopleScreen(MDScreen): pass

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save