revamped colors and frontend .....

macdev
quadrismegistus 4 years ago
parent 28045b3533
commit a7443c0840

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

@ -1,13 +1,60 @@
## CONFIG
# change this to your external ip address for your server
#(needs to be external to allow tor routing)
DEFAULT_SCREEN='feed'
DEFAULT_SCREEN='profile'
import random
HORIZONTAL = random.choice([True,True,True,False])
HORIZONTAL = False #random.choice([True,True,True,False])
FACTOR=1
WINDOW_SIZE = (1136*FACTOR,640*FACTOR) if HORIZONTAL else (640*FACTOR,1136*FACTOR)
BG_IMG='assets/bg-russiangreen.png'
grass=(201,203,163)
russiangreen = (109,140,96)
huntergreen = (67,92,61)
kombugreen = (49,67,45)
pinetreegreen = (29,40,27)
junglegreen = (15, 21, 14)
browncoffee=(77, 42, 34)
rootbeer=(38, 7, 1)
blackbean=(61, 12, 2)
burntumber=(132, 55, 34)
brownsugar=(175, 110, 81)
antiquebrass= (198, 144, 118)
royalbrown=(94, 55, 46)
bole=(113, 65, 55)
liver= (110, 56, 31)
bistre=(58, 33, 14)
skin1=(89, 47, 42)
skin2=(80, 51, 53)
skin3=(40, 24, 26)
grullo=177, 158, 141
smokyblack=33, 14, 0
liverchestnut=148, 120, 96
ashgray=196, 199, 188
livchestnut2=156, 106, 73
beaver=165, 134, 110
rawumber=120, 95, 74
dutchwhite=229,219,181
COLOR_TOOLBAR= smokyblack #5,5,5 #russiangreen #pinetreegreen #kombugreen #(12,5,5) #russiangreen
COLOR_BG = (0,73,54)
# COLOR_ICON = (201,203,163)
COLOR_LOGO = grullo#russiangreen #(0,0,0) #(0,0,0) #(151,177,140) #(132,162,118) #(109,140,106)
COLOR_ICON = grullo#russiangreen #(0,0,0) #COLOR_LOGO
COLOR_TEXT =dutchwhite #(241,233,203) #COLOR_ICON #(207,219,204) #(239,235,206) # (194,211,187) # (171,189,163) # (222,224,198) # COLOR_LOGO #(223, 223, 212)
COLOR_CARD = smokyblack #skin2 #huntergreen #(30,23,20) #(51,73,45) # (67,92,61) #(12,9,10)
# COLOR_TOOLBAR = (8s9,59,43)
# COLOR_ICON = COLOR_LOGO = COLOR_TEXT
# COLOR_TEXT=tuple([x+50 for x in russiangreen]) #COLOR_TOOLBAR
# COLOR_ICON = COLOR_LOGO = grass
# COLOR_LOGO = junglegreen #(199,22,22)
# COLOR_ICON = COLOR_LOGO
COLOR_CARD_BORDER = rawumber
# monkeypatching the things that asyncio needs
import subprocess
@ -63,12 +110,16 @@ Window.size = WINDOW_SIZE
# with open('log.txt','w') as of:
# of.write('### LOG ###\n')
def rgb(r,g,b,a=1):
return (r/255,g/255,b/255,a)
class MyLayout(MDBoxLayout):
scr_mngr = ObjectProperty(None)
post_id = ObjectProperty()
def rgb(self,r,g,b,a=1):
return rgb(r,g,b,a=a)
def change_screen(self, screen, *args):
self.scr_mngr.current = screen
@ -80,6 +131,37 @@ class MyLayout(MDBoxLayout):
class MyBoxLayout(MDBoxLayout): pass
class MyLabel(MDLabel): pass
class MyToolbar(MDToolbar):
action_icon_color = ListProperty()
def update_action_bar(self, action_bar, action_bar_items):
action_bar.clear_widgets()
new_width = 0
for item in action_bar_items:
new_width += dp(48)
action_bar.add_widget(
MDIconButton(
icon=item[0],
on_release=item[1],
opposite_colors=True,
text_color=(self.specific_text_color if not self.action_icon_color else self.action_icon_color),
theme_text_color="Custom",
)
)
action_bar.width = new_width
def update_action_bar_text_colors(self, instance, value):
for child in self.ids["left_actions"].children:
if not self.action_icon_color:
child.text_color = self.specific_text_color
else:
child.text_color = self.action_icon_color
for child in self.ids["right_actions"].children:
if not self.action_icon_color:
child.text_color = self.specific_text_color
else:
child.text_color = self.action_icon_color
@ -145,6 +227,8 @@ class MainApp(MDApp):
# def connect(self):
# # connect to kad?
# self.node = p2p.connect()
def rgb(self,*_): return rgb(*_)
@property
def logger(self):
if not hasattr(self,'_logger'):
@ -206,10 +290,14 @@ class MainApp(MDApp):
draw_background(self.root)
# edit logo
logo=root.ids.toolbar.ids.label_title
toolbar=root.ids.toolbar
toolbar.md_bg_color = root.rgb(*COLOR_TOOLBAR)
toolbar.action_icon_color=root.rgb(*COLOR_ICON)
logo=toolbar.ids.label_title
logo.font_name='assets/Strengthen.ttf'
logo.font_size='58dp'
logo.pos_hint={'center_y':0.43}
logo.text_color=root.rgb(*COLOR_LOGO)
# logged in?
if not self.is_logged_in():

@ -13,8 +13,9 @@
#:import partial functools.partial
#:import NoTransition kivy.uix.screenmanager.NoTransition
# :import MDCarousel kivymd.uix.carousel.MDCarousel
#:import rgb main.rgb
#:import COLOR_BG main.COLOR_BG
#:import BG_IMG main.BG_IMG
## CLASS DEFS
@ -35,7 +36,7 @@
<MyLabel>:
theme_text_color: 'Custom'
text_color: (1,0,0,1)
text_color: rgb(201,203,163)
# pos_hint: {'center_y': 0.5}
halign: 'center'
height: self.texture_size[1]
@ -51,33 +52,40 @@ MyLayout:
scr_mngr: scr_mngr
orientation: 'vertical'
height: self.minimum_height
md_bg_color:0,0,0,1
md_bg_color:self.rgb(*COLOR_BG)
canvas:
Color:
rgba: 0.925,0.925,0.925,0.99 #get_color_from_hex(colors['Gray']['900'])
# rgba: 0,0,0,0.9 #get_color_from_hex(colors['Gray']['900'])
rgba: 1,1,1,1 #0.925,0.925,0.925,0.19 #get_color_from_hex(colors['Gray']['900'])
# rgba: 0.1,0.1,0.1,1 #get_color_from_hex(colors['Gray']['900'])
Rectangle:
pos: self.pos
size: self.size
source: 'assets/bg.png'
source: BG_IMG
# texture: app.texture
MDToolbar:
MyToolbar:
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'
theme_text_color:'Custom'
background_hue: '500'
specific_text_color: 1,0,0,1
right_action_items: [['card-text-outline', partial(root.change_screen, 'feed')], ['pencil-plus-outline', partial(root.change_screen, 'post')], ['message-outline', partial(root.change_screen, 'messages')], ['bell-outline', partial(root.change_screen, 'notifications')], ['account-circle-outline', partial(root.change_screen, 'profile')]]
#left_action_items: [[f"assets/fist2.png", partial(root.change_screen, 'feed')]]
font_context: None
font_name: f'assets/Strengthen.ttf'
# canvas:
# Color:
# rgb: rgb(67,92,61)
# Line:
# width: 1
# rectangle: (self.x, self.y, self.width, self.height)
ScreenManager:

@ -1,5 +1,9 @@
#:import FeedScreen screens.feed.feed.FeedScreen
#:import Window kivy.core.window.Window
#:import rgb main.rgb
#:import COLOR_CARD main.COLOR_CARD
#:import COLOR_TEXT main.COLOR_TEXT
#:import COLOR_CARD_BORDER main.COLOR_CARD_BORDER
<FeedScreen>:
name: 'feed'
@ -87,7 +91,7 @@
# padding:'10dp'
# canvas:
# Color:
# rgb: 1,0,0,1
# rgb: rgb(*COLOR_TEXT)
# Line:
# width: 1
# rectangle: (self.x, self.y, self.width, self.height)
@ -103,7 +107,7 @@
# height: '400'
size_hint_y: None
# size_hint_x: 100
text_color:1,0,0,1
text_color:rgb(*COLOR_TEXT)
theme_text_color: 'Custom'
halign: 'left'
padding: ('10dp','0dp')
@ -119,7 +123,7 @@
# height: '400'
size_hint_y: None
# size_hint_x: 100
text_color:1,0,0,1
text_color:rgb(*COLOR_TEXT)
theme_text_color: 'Custom'
halign: 'right'
padding: ('10dp','0dp')
@ -138,7 +142,7 @@
#font_name: "Strengthen"
# height: '400'
size_hint_y: None
text_color:1,0,0,1
text_color:rgb(*COLOR_TEXT)
theme_text_color: 'Custom'
halign: 'left'
@ -153,13 +157,13 @@
padding: "20dp"
size_hint: (0.9, None)
pos_hint: {"center_x": .5, "center_y": .5}
md_bg_color: (0,0,0,1)
md_bg_color: rgb(*COLOR_CARD)
height: self.minimum_height
radius:[20,]
border_radius:20
canvas:
Color:
rgba: 0,0,0,0.5
rgba: rgb(*COLOR_CARD_BORDER,a=0.5)
Line:
width: 1
rounded_rectangle: (self.x, self.y, self.width, self.height, 20, 20, 20, 20)

@ -6,6 +6,10 @@
#:import LoginButton screens.login.login.LoginButton
#:import RegisterButton screens.login.login.RegisterButton
#:import LoginStatus screens.login.login.LoginStatus
#:import rgb main.rgb
#:import COLOR_TEXT main.COLOR_TEXT
#:import COLOR_CARD main.COLOR_CARD
#:import COLOR_CARD_BORDER main.COLOR_CARD_BORDER
<LoginBoxLayout>:
@ -14,12 +18,20 @@
cols:1
size_hint:0.5,None
pos_hint: {'center_x':0.5,'center_y':0.5}
md_bg_color: 0,0,0,1
md_bg_color: rgb(*COLOR_CARD)
radius:[20,]
border_radius:20
spacing:'10dp'
padding:'25dp'
adaptive_height: True
# canvas:
# Color:
# rgba: rgb(*COLOR_CARD_BORDER)
# Line:
# width: 1
# rounded_rectangle: (self.x, self.y, self.width, self.height, 20, 20, 20, 20)
<UsernameLayout>:
cols:2
@ -33,11 +45,11 @@
<UsernameLabel>:
theme_text_color: 'Custom'
text_color: 1,0,0,1
text_color: rgb(*COLOR_TEXT)
# width:'100sp'
adaptive_width: True
size_hint:None,None
# md_bg_color:1,0,0,1
# md_bg_color:rgb(*COLOR_TEXT)
# pos_hint: {'y':1}
halign:'center'
@ -52,12 +64,13 @@
multiline: False
helper_text_mode: "persistent"
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
error_color:1,0,0,1
line_color_focus: rgb(*COLOR_TEXT)
line_color_normal: rgb(*COLOR_TEXT)
current_hint_text_color: rgb(*COLOR_TEXT)
error_color:rgb(*COLOR_TEXT)
pos_hint: {'center_x':0.5,'y':0.2}
size_hint:0.8,None
font_size:'24sp'
@ -71,10 +84,10 @@
multiline: False
helper_text_mode: "persistent"
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
text_color: 1,0,0,1
line_color_focus: rgb(*COLOR_TEXT)
line_color_normal: rgb(*COLOR_TEXT)
current_hint_text_color: rgb(*COLOR_TEXT)
text_color: rgb(*COLOR_TEXT)
pos_hint: {'center_x':0.5,'y':0.2}
size_hint:0.8,None
@ -97,18 +110,20 @@
app.login(self.parent.parent.parent.username_field.text, self.parent.parent.parent.password_field.text)
#app.root.change_screen("welcome")
theme_text_color: "Custom"
text_color: 1,0,0,1
text_color: rgb(*COLOR_TEXT)
md_bg_color: 0,0,0,1
size_hint:None,None
font_size:'24sp'
# pos_hint: {'center_x': .5, 'bottom':1}
<RegisterButton>:
text: "register"
text: "join"
on_release:
app.register(self.parent.parent.parent.username_field.text, self.parent.parent.parent.password_field.text)
theme_text_color: "Custom"
text_color: 1,0,0,1
text_color: rgb(*COLOR_TEXT)
md_bg_color: 0,0,0,1
font_size:'24sp'
# size_hint:1,None
<LoginStatus>:

@ -3,7 +3,7 @@ from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.textfield import MDTextField
from kivymd.uix.button import MDRectangleFlatButton
from kivymd.uix.label import MDLabel
from main import MyLabel
from main import MyLabel,rgb
class LoginBoxLayout(MDBoxLayout): pass
class LoginButtonLayout(MDBoxLayout): pass
@ -30,8 +30,8 @@ class LoginScreen(BaseScreen):
self.label_username = UsernameLabel(text="username:")
self.username_field = UsernameField()
self.username_field.line_color_focus=(1,0,0,1)
self.username_field.line_color_normal=(1,0,0,0.25)
self.username_field.line_color_focus=rgb(201,203,163)
self.username_field.line_color_normal=rgb(201,203,163,0.25)
self.username_field.font_name='assets/font.otf'
self.layout_username.add_widget(self.label_username)
@ -48,8 +48,8 @@ class LoginScreen(BaseScreen):
self.label_username.font_name='assets/font.otf'
self.password_field = PasswordField()
self.password_field.line_color_focus=(1,0,0,1)
self.password_field.line_color_normal=(1,0,0,0.25)
self.password_field.line_color_focus=rgb(201,203,163)
self.password_field.line_color_normal=rgb(201,203,163,0.25)
self.password_field.font_name='assets/font.otf'
self.layout_password.add_widget(self.label_password)
@ -73,6 +73,9 @@ class LoginScreen(BaseScreen):
self.layout.add_widget(self.login_status)
self.label_password.font_size='18sp'
self.label_username.font_size='18sp'
## add all
self.add_widget(self.layout)

@ -18,10 +18,11 @@
cols:1
orientation:'vertical'
size_hint:None,None
adaptive_height: True
# height:'200dp'
# width:'300dp'
# md_bg_color:1,1,0,1
pos_hint: {'center_x':0.5,'center_y':0.88}
# md_bg_color:0,0,0,1
pos_hint: {'center_x':0.5, 'y':0} #,'top':0.25}
# radius:[20,]
# border_radius:20
canvas:
@ -40,7 +41,7 @@
# width:'300dp'
md_bg_color:0,0,0,1
# height: '500dp'
pos_hint: {'center_x':0.5,'y':0.8}
pos_hint: {'center_x':0.5,'center_y':0.5} #,'y':0.8}
# radius:[20,]
# border_radius:20
@ -63,14 +64,14 @@
md_bg_color:0,0,0,1
# width: '300dp'
height: self.minimum_height
pos_hint: {'center_x':0.5}
pos_hint: {'center_x':0.5,'center_y':0.5}
spacing:'10sp'
radius:[20,]
border_radius:20
padding:'10sp'
canvas:
Color:
rgba: 1,0,0,0.5
rgba: 0,0,0,0.5
Line:
width: 1
rounded_rectangle: (self.x, self.y, self.width, self.height, 20, 20, 20, 20)
@ -114,9 +115,12 @@
cols:1
orientation:'vertical'
spacing:'10dp'
padding:'10dp'
size_hint:1,None
adaptive_height:True
# md_bg_color:1,0,0,1
pos_hint: {'center_x':0.5,'center_y':0.5}
# md_bg_color:1,1,0,1
<ProfileAvatar>:
size_hint:1,1

@ -16,7 +16,7 @@ from kivy.clock import Clock
from functools import partial
from copy import copy,deepcopy
from kivy.animation import Animation
from main import MyLabel
from main import MyLabel,COLOR_ICON
from misc import *
@ -102,7 +102,7 @@ def circularize_img(img_fn, width, im=None, do_crop=True,bw=False,resize=True,ci
fn = lambda x : 255 if x > thresh else 0
im = im.convert('L').point(fn, mode='1').convert('RGB')
orig_color = (255,255,255)
replacement_color = (255,0,0)
replacement_color = COLOR_ICON #(255,0,0)
# img = im.convert('RGB')
data = np.array(im)
data[(data == orig_color).all(axis = -1)] = replacement_color

@ -207,7 +207,7 @@ class Api(object):
return {'success':'Account created', 'username':name}
def load_private_key(self,password):
if not self.app_storage.exists('_keys'): return None
if not self.app_storage.exists('_keys'): return {'error':'No login keys present on this device'}
pem_private_key=self.app_storage.get('_keys').get('private')
try:
return {'success':load_private_key(pem_private_key.encode(),password)}

Loading…
Cancel
Save