separate_pages
quadrismegistus 4 years ago
parent 963bad0e53
commit f095642831

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

@ -0,0 +1,138 @@
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import images_path kivymd.images_path
#:import colors kivymd.color_definitions.colors
#:import partial functools.partial
#:import NoTransition kivy.uix.screenmanager.NoTransition
# :import MDCarousel kivymd.uix.carousel.MDCarousel
MyLayout:
scr_mngr: scr_mngr
orientation: 'vertical'
height: self.minimum_height
canvas:
Color:
rgba: 0.925,0.925,0.925,1 #get_color_from_hex(colors['Gray']['900'])
Rectangle:
pos: self.pos
size: self.size
MDToolbar:
id: toolbar
title: app.title
pos_hint: {'center_x': .5, 'center_y': 0.95}
md_bg_color: 0.1,0.1,0.1,1
background_palette: 'Red'
background_hue: '500'
specific_text_color: 1,0,0,1
right_action_items: [['radio-tower', partial(root.change_screen, 'feed')], ['account-group', partial(root.change_screen, 'people')], ['calendar', partial(root.change_screen, 'events')], ['message-processing-outline', partial(root.change_screen, 'messages')], ['bell-outline', partial(root.change_screen, 'notifications')]]
left_action_items: [[f"assets/logo.png", partial(root.change_screen, 'welcome')]]
ScreenManager:
id: scr_mngr
# transition: NoTransition()
WelcomeScreen:
name: 'welcome'
MyLabel:
text: "Turning and turning in the widening gyre \nThe falcon cannot hear the falconer;\nThings fall apart; the centre cannot hold;\nMere anarchy is loosed upon the world,\nThe blood-dimmed tide is loosed, and everywhere \nThe ceremony of innocence is drowned;\nThe best lack all conviction, while the worst \nAre full of passionate intensity.\n\nSurely some revelation is at hand;\nSurely the Second Coming is at hand. \nThe Second Coming! Hardly are those words out \nWhen a vast image out of Spiritus Mundi\nTroubles my sight: somewhere in sands of the desert \nA shape with lion body and the head of a man, \nA gaze blank and pitiless as the sun, \nIs moving its slow thighs, while all about it \nReel shadows of the indignant desert birds. \nThe darkness drops again; but now I know \nThat twenty centuries of stony sleep\nWere vexed to nightmare by a rocking cradle, \nAnd what rough beast, its hour come round at last, \nSlouches towards Bethlehem to be born?"
PeopleScreen:
name: 'people'
ScrollView:
id: scroll
size_hint: (1, 1)
pos_hint: {'center_x': .5, 'y': 0}
do_scroll_x: False
bar_width: 0
scroll_type: ['content']
MDList:
id: container
# size_hint_y: None
# height: '100dp'
#padding: 0, self._list_vertical_padding
FeedScreen:
name: 'feed'
#MyLabel:
# text: "The falcon cannot hear the falconer..."
Carousel:
direction: 'right'
#AsyncImage:
# source:'avatar.jpg'
MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: 0.9, 0.9
# md_bg_color: 1,0,0,1
pos_hint: {"center_x": .5, "center_y": .5}
MDLabel:
text: "Counter culture is dead"
theme_text_color: "Secondary"
size_hint_y: None
height: self.texture_size[1]
font_style: 'H5'
halign: 'center'
AsyncImage:
source: 'avatar.jpg'
MDLabel:
text: "Resistance to popular music (Taylor Swift, etc) is culturally obsolete. It's no longer possible to 'counter' culture as 'bad' or aesthetically impoverished: music is good, TV is good, the internet is funny, and we're all just hooked up to the same cultural 'streams' and 'feeds'."
pos_hint: {'center_y':1}
font_style: 'Body1'
MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: 0.9, 0.9
# md_bg_color: 1,0,0,1
pos_hint: {"center_x": .5, "center_y": .5}
MDLabel:
text: "Can God compete with Adam?"
theme_text_color: "Secondary"
size_hint_y: None
height: self.texture_size[1]
font_style: 'H5'
halign: 'center'
AsyncImage:
source: 'spiral4.png'
MDLabel:
text: "The lines to break Tech up on are already there, just covered up: Amazon is both the infrastructure connecting all businesses & consumers, while at the same time competing with those businesses—using its omnipotent money and omniscient data like God 'competing' with Adam & Eve."
MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: 0.9, 0.9
pos_hint: {"center_x": .5, "center_y": .5}
AsyncImage:
source: 'spiral4.png'
MDLabel:
text: "The lines to break Tech up on are already there, just covered up: Amazon is both the infrastructure connecting all businesses & consumers, while at the same time competing with those businesses—using its omnipotent money and omniscient data like God 'competing' with Adam & Eve."
AsyncImage:
source:'spiral2.png'
AsyncImage:
source: 'spiral4.png'
EventsScreen:
name: 'events'
MessagesScreen:
name: 'messages'
NotificationsScreen:
name: 'notifications'

@ -0,0 +1,146 @@
from kivy.uix.screenmanager import Screen,ScreenManager
from kivymd.app import MDApp
from kivymd.uix.button import MDFillRoundFlatButton, MDIconButton
from kivymd.uix.toolbar import MDToolbar
from kivymd.uix.screen import MDScreen
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivymd.theming import ThemeManager
from kivy.properties import ObjectProperty,ListProperty
import time
from collections import OrderedDict
from functools import partial
from kivy.uix.screenmanager import NoTransition
from kivymd.uix.label import MDLabel
from kivy.uix.widget import Widget
from kivymd.uix.list import OneLineListItem
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, ILeftBody, IRightBody, ThreeLineAvatarListItem, TwoLineAvatarListItem, BaseListItem, ImageLeftWidget
from kivy.uix.image import Image, AsyncImage
root = None
app = None
def log(x):
with open('log.txt','a+') as of:
of.write(str(x)+'\n')
class MyLayout(BoxLayout):
scr_mngr = ObjectProperty(None)
def change_screen(self, screen, *args):
self.scr_mngr.current = screen
class MyLabel(MDLabel):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.theme_text_color='Custom'
self.text_color=(1,0,0,1)
self.pos_hint = {'center_y': 0.5}
self.halign='center'
self.height=self.texture_size[1]
for k,v in kwargs.items(): setattr(self,k,v)
class ContactPhoto(ILeftBody, AsyncImage):
pass
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)
avatar = ImageLeftWidget()
avatar.source = 'avatar.jpg'
self.add_widget(avatar)
#icon = ImageRightWidget()
# icon.icon = 'messages'
#self.add_widget(icon)
class PostWrapped(BaseListItem):
"""
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)
# avatar = ImageLeftWidget()
# avatar.source = 'avatar.jpg'
# self.add_widget(avatar)
self.size_hint_y=None
self.height='100dp'
avatar = ImageLeftWidget()
avatar.source = 'avatar.jpg'
self.add_widget(avatar)
# self.add_widget(MyLabel(text=title,pos_hint={'center_y': 0.85},halign='left'))
# self.add_widget(MyLabel(text=content,pos_hint={'center_y': 0.45},halign='left'))
class FeedScreen(MDScreen):
def on_enter(self):
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
class EventsScreen(MDScreen): pass
class MessagesScreen(MDScreen): pass
class NotificationsScreen(MDScreen): pass
class MainApp(MDApp):
title = 'Gyre'
def build(self):
global app,root
app = self
self.root = root = Builder.load_file('main.kv')
self.root.change_screen('feed')
return self.root
if __name__ == '__main__':
App = MainApp()
App.run()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

@ -26,7 +26,7 @@ MyLayout:
background_hue: '500'
specific_text_color: 1,0,0,1
right_action_items: [['radio-tower', partial(root.change_screen, 'feed')], ['account-group', partial(root.change_screen, 'people')], ['calendar', partial(root.change_screen, 'events')], ['message-processing-outline', partial(root.change_screen, 'messages')], ['bell-outline', partial(root.change_screen, 'notifications')]]
left_action_items: [[f"spiral3.png", partial(root.change_screen, 'welcome')]]
left_action_items: [[f"assets/logo.png", partial(root.change_screen, 'welcome')]]
ScreenManager:
id: scr_mngr
@ -66,66 +66,10 @@ MyLayout:
#MyLabel:
# text: "The falcon cannot hear the falconer..."
Carousel:
id: post_carousel
direction: 'right'
#AsyncImage:
# source:'avatar.jpg'
MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: 0.9, 0.9
# md_bg_color: 1,0,0,1
pos_hint: {"center_x": .5, "center_y": .5}
MDLabel:
text: "Counter culture is dead"
theme_text_color: "Secondary"
size_hint_y: None
height: self.texture_size[1]
font_style: 'H5'
halign: 'center'
AsyncImage:
source: 'avatar.jpg'
MDLabel:
text: "Resistance to popular music (Taylor Swift, etc) is culturally obsolete. It's no longer possible to 'counter' culture as 'bad' or aesthetically impoverished: music is good, TV is good, the internet is funny, and we're all just hooked up to the same cultural 'streams' and 'feeds'."
pos_hint: {'center_y':1}
font_style: 'Body1'
MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: 0.9, 0.9
# md_bg_color: 1,0,0,1
pos_hint: {"center_x": .5, "center_y": .5}
MDLabel:
text: "Can God compete with Adam?"
theme_text_color: "Secondary"
size_hint_y: None
height: self.texture_size[1]
font_style: 'H5'
halign: 'center'
AsyncImage:
source: 'spiral4.png'
MDLabel:
text: "The lines to break Tech up on are already there, just covered up: Amazon is both the infrastructure connecting all businesses & consumers, while at the same time competing with those businesses—using its omnipotent money and omniscient data like God 'competing' with Adam & Eve."
MDCard:
orientation: "vertical"
padding: "8dp"
size_hint: 0.9, 0.9
pos_hint: {"center_x": .5, "center_y": .5}
AsyncImage:
source: 'spiral4.png'
MDLabel:
text: "The lines to break Tech up on are already there, just covered up: Amazon is both the infrastructure connecting all businesses & consumers, while at the same time competing with those businesses—using its omnipotent money and omniscient data like God 'competing' with Adam & Eve."
AsyncImage:
source:'spiral2.png'
AsyncImage:
source: 'spiral4.png'
EventsScreen:

@ -47,80 +47,61 @@ class MyLabel(MDLabel):
class ContactPhoto(ILeftBody, AsyncImage):
pass
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)
avatar = ImageLeftWidget()
avatar.source = 'avatar.jpg'
self.add_widget(avatar)
#icon = ImageRightWidget()
# icon.icon = 'messages'
#self.add_widget(icon)
class PostWrapped(BaseListItem):
"""
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)
# avatar = ImageLeftWidget()
# avatar.source = 'avatar.jpg'
# self.add_widget(avatar)
self.size_hint_y=None
self.height='100dp'
avatar = ImageLeftWidget()
avatar.source = 'avatar.jpg'
self.add_widget(avatar)
# self.add_widget(MyLabel(text=title,pos_hint={'center_y': 0.85},halign='left'))
# self.add_widget(MyLabel(text=content,pos_hint={'center_y': 0.45},halign='left'))
class PostCard(MDCard):
def __init__(self, title = None, img_src = None, content = None):
super().__init__()
self.orientation="vertical"
self.padding="8dp"
self.size_hint=(0.9, 0.9)
# self.md_bg_color=(1,0,0,1)
self.pos_hint = {"center_x": .5, "center_y": .5}
if title:
sep = MDSeparator()
sep.height='25dp'
self.add_widget(sep)
title = MDLabel(text=title)
# title.theme_text_color="Secondary"
title.size_hint_y=None
title.height=title.texture_size[1]
title.font_style='H5'
title.halign='center'
self.add_widget(title)
# spacing?
sep = MDSeparator()
sep.height='25dp'
self.add_widget(sep)
if img_src:
image = AsyncImage(source=img_src)
self.add_widget(image)
if content:
content=MDLabel(text=content)
content.pos_hint={'center_y':1}
content.font_style='Body1'
self.add_widget(content)
class FeedScreen(MDScreen):
def on_enter(self):
lim=25
i=0
lim=5
with open('tweets.txt') as f:
for i,ln in enumerate(f):
for ln in f:
if ln.startswith('@') or ln.startswith('RT '): continue
i+=1
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)
#post = Post(title=f'Marx Zuckerberg', content=ln.strip())
post = PostCard(title='Marx Zuckerberg',img_src='avatar.jpg',content=ln.strip())
print(post)
root.ids.post_carousel.add_widget(post)
class WelcomeScreen(MDScreen): pass
class PeopleScreen(MDScreen): pass

Loading…
Cancel
Save