You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
243 lines
6.7 KiB
Plaintext
243 lines
6.7 KiB
Plaintext
#: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
|
|
|
|
|
|
|
|
|
|
|
|
## CLASS DEFS
|
|
|
|
<MyBoxLayout>:
|
|
orientation: "vertical"
|
|
pos_hint: {'center_x':0.5, 'center_y':0.5}
|
|
size_hint:0.5,0.5
|
|
padding:'10dp'
|
|
md_bg_color:0,0,0,1
|
|
canvas:
|
|
Color:
|
|
rgb: 1,0,0,2
|
|
Line:
|
|
width: 1
|
|
rectangle: (self.x, self.y, self.width, self.height)
|
|
|
|
|
|
<MyLabel>:
|
|
theme_text_color: 'Custom'
|
|
text_color: (1,0,0,1)
|
|
pos_hint: {'center_y': 0.5}
|
|
halign: 'center'
|
|
height: self.texture_size[1]
|
|
font_family: 'Courier'
|
|
|
|
|
|
|
|
|
|
<PostCard>:
|
|
id: post
|
|
orientation: "vertical"
|
|
padding: "8dp"
|
|
size_hint: (0.9, 0.9)
|
|
pos_hint: {"center_x": .5, "center_y": .5}
|
|
|
|
MDSeparator:
|
|
id: post_title_sep
|
|
height: '0dp'
|
|
|
|
MDLabel:
|
|
id: post_title
|
|
text: self.title
|
|
size_hint_y: None
|
|
height: self.texture_size[1]
|
|
font_style: 'H5'
|
|
halign: 'center'
|
|
|
|
MDSeparator:
|
|
id: post_title_sep2
|
|
height: '25dp'
|
|
|
|
AsyncImage:
|
|
id: post_img
|
|
|
|
MDLabel:
|
|
id: post_content
|
|
text: self.content
|
|
pos_hint: {'center_y':1}
|
|
font_style: 'Body1'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### LAYOUT
|
|
|
|
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
|
|
source: 'assets/komrade.png'
|
|
|
|
|
|
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')]]
|
|
right_action_items: [['post-outline', partial(root.change_screen, 'feed')], ['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, 'feed')]]
|
|
|
|
ScreenManager:
|
|
id: scr_mngr
|
|
# transition: NoTransition()
|
|
|
|
|
|
|
|
|
|
###
|
|
# LOGIN SCREEN
|
|
###
|
|
|
|
LoginScreen:
|
|
name: "login"
|
|
# text: "Login"
|
|
# icon: "login"
|
|
|
|
MyBoxLayout:
|
|
id: loginbox
|
|
size_hint:0.5,0.2
|
|
|
|
MDTextField:
|
|
id: username
|
|
hint_text: "username"
|
|
required: True
|
|
write_tab: False
|
|
multiline: False
|
|
helper_text_mode: "on_error"
|
|
color_mode: 'custom'
|
|
line_color_focus: 1,0,0,1
|
|
line_color_normal: 1,0,0,1
|
|
current_hint_text_color: 1,0,0,1
|
|
|
|
MDTextField:
|
|
id: password
|
|
password: True
|
|
hint_text: "password"
|
|
required: True
|
|
write_tab: False
|
|
multiline: False
|
|
helper_text_mode: "on_error"
|
|
color_mode: 'custom'
|
|
line_color_focus: 1,0,0,1
|
|
line_color_normal: 1,0,0,1
|
|
current_hint_text_color: 1,0,0,1
|
|
|
|
|
|
MDBoxLayout:
|
|
id: buttonbox
|
|
size_hint_y: None
|
|
adaptive_width: True
|
|
height: dp(56)
|
|
spacing: '10dp'
|
|
pos_hint: {'center_x': .5}
|
|
|
|
MDRectangleFlatButton:
|
|
text: "login"
|
|
on_release:
|
|
app.login(username.text, password.text)
|
|
#app.root.change_screen("welcome")
|
|
theme_text_color: "Custom"
|
|
text_color: 1,0,0,1
|
|
md_bg_color: 0,0,0,1
|
|
|
|
|
|
MDRectangleFlatButton:
|
|
text: "register"
|
|
on_release:
|
|
app.register(username.text, password.text)
|
|
theme_text_color: "Custom"
|
|
text_color: 1,0,0,1
|
|
md_bg_color: 0,0,0,1
|
|
|
|
MDLabel:
|
|
id: login_status
|
|
text:""
|
|
theme_text_color: 'Error'
|
|
pos_hint:{'center_x':.5}
|
|
|
|
|
|
|
|
WelcomeScreen:
|
|
name: 'welcome'
|
|
|
|
MyBoxLayout:
|
|
size_hint:0.666,0.666
|
|
|
|
#MyLabel:
|
|
# text: "Welcome!"
|
|
# font_style: "H3"
|
|
# pos_hint: {'center_y':0.85}
|
|
|
|
MyLabel:
|
|
text: "\n\nTurning 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..."
|
|
|
|
|
|
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:
|
|
id: post_carousel
|
|
direction: 'right'
|
|
|
|
|
|
|
|
|
|
EventsScreen:
|
|
name: 'events'
|
|
|
|
MessagesScreen:
|
|
name: 'messages'
|
|
|
|
NotificationsScreen:
|
|
name: 'notifications'
|
|
|