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: canvas:
Color: 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: Rectangle:
pos: self.pos pos: self.pos
size: self.size size: self.size
@ -21,7 +21,7 @@ MyLayout:
id: toolbar id: toolbar
title: app.title title: app.title
pos_hint: {'center_x': .5, 'center_y': 0.95} 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_palette: 'Red'
background_hue: '500' background_hue: '500'
specific_text_color: 1,0,0,1 specific_text_color: 1,0,0,1
@ -42,20 +42,6 @@ MyLayout:
FeedScreen: FeedScreen:
name: 'feed' 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: ScrollView:
id: scroll id: scroll
@ -67,17 +53,7 @@ MyLayout:
MDList: MDList:
id: container 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.uix.gridlayout import GridLayout
from kivy.metrics import dp from kivy.metrics import dp
from kivy.properties import NumericProperty from kivy.properties import NumericProperty
from kivymd.uix.list import MDList, ThreeLineAvatarListItem from kivymd.uix.list import MDList, TwoLineAvatarListItem, ImageLeftWidget
root = None root = None
@ -45,67 +45,40 @@ class MyLabel(MDLabel):
for k,v in kwargs.items(): setattr(self,k,v) for k,v in kwargs.items(): setattr(self,k,v)
class ScrollCenterLayout(GridLayout): class Post(TwoLineAvatarListItem):
rel_max = NumericProperty(dp(800)) """
rel_min = NumericProperty(dp(400)) text: "Three-line item with avatar"
secondary_text: "Secondary text here"
def __init__(self, **kwargs): tertiary_text: "fit more text than usual"
super(ScrollCenterLayout, self).__init__(**kwargs) text_color: 1,0,0,1
theme_text_color: 'Custom'
self.rel_max = kwargs.get('rel_max', dp(800)) """
self.rel_min = kwargs.get('rel_min', dp(400)) def __init__(self, title, content, *args, **kwargs):
super().__init__() #*args, **kwargs)
def on_width(self, instance, value): self.text = title
if self.rel_max < value: self.secondary_text = content
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): # self.theme_text_color='Custom'
"""MDCard: # self.secondary_theme_text_color = 'Custom'
orientation: "vertical"
padding: "8dp"
size_hint: None, None
size: "280dp", "180dp"
pos_hint: {"center_x": .5, "center_y": .5}
MDLabel: # self.text_color=(1,0,0,1)
text: "Title" # self.secondary_text_color = (1,0,0,1)
theme_text_color: "Secondary"
size_hint_y: None
height: self.texture_size[1]
MDSeparator: avatar = ImageLeftWidget()
height: "1dp" avatar.source = 'avatar.jpg'
self.add_widget(avatar)
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): class FeedScreen(MDScreen):
def on_enter(self): def on_enter(self):
for i in range(25): lim=25
post = Post(title=f'Title {i}', author=f'Author {i}', content='This is the content') 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 = MDSeparator()
sep.height='1dp' sep.height='1dp'

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