feat: gui with placeholders

This commit is contained in:
AGawde05 2020-11-02 16:49:12 -06:00
parent e3bda8e656
commit b1e0e377c9
2 changed files with 148 additions and 78 deletions

171
design.kv
View File

@ -1,46 +1,135 @@
<HomeScreen>: BoxLayout:
GridLayout: orientation: "vertical"
cols: 1
NavigationLayout:
ScreenManager:
id: screen_manager
HomeScreen:
name: "Home"
BoxLayout:
orientation: "vertical"
MDToolbar:
title: screen_manager.current
elevation: 10
left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
GridLayout: GridLayout:
cols: 1 cols: 1
padding: 15, 15 padding: 15, 15
spacing: 20, 20 spacing: 20, 20
Label: MDTextFieldRect:
text: "User Login" hint_text: "Console Log"
font_size: "20sp" # size_hint: .8, None
TextInput: # align: 'center'
id: username # Widget:
hint_text: "Username" SettingsScreen:
TextInput: name: "Settings"
id: password BoxLayout:
password: True orientation: 'vertical'
hint_text: "Password" MDToolbar:
RelativeLayout: title: screen_manager.current
Button: elevation: 10
text: "Login" left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
on_press: root.login(root.ids.username.text, root.ids.password.text) Widget:
size_hint: 0.3, 0.5 InfoScreen:
pos_hint: {"center_x": 0.5, "center_y": 0.6} name: "Info"
Label: BoxLayout:
id: login_wrong orientation: 'vertical'
text: "" MDToolbar:
GridLayout: title: screen_manager.current
cols: 2 elevation: 10
size_hint: 0.2, 0.2 left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
padding: 10, 10 # GridLayout:
spacing: 10, 0 # cols: 2
Button: # padding: 15, 15
text: "Forgot Password?" # spacing: 20, 20
background_color: 1, 1, 1, 0 BoxLayout:
opacity: 1 if self.state == "normal" else 0.5 orientation: "horizontal"
color: 0.1, 0.7, 1, 1 MDLabel:
Button: text: "DB Key:"
text: "Sign Up" halign: 'center'
on_press: root.sign_up() MDTextField:
background_color: 1, 1, 1 , 0 hint_text: "placeholder"
opacity: 1 if self.state == "normal" else 0.5 pos_hint: {"center_y": .5}
color: 0.1, 0.7, 1, 1 BoxLayout:
orientation: "horizontal"
MDLabel:
text: "TBA Key:"
halign: 'center'
MDTextField:
hint_text: "placeholder"
pos_hint: {"center_y": .5}
BoxLayout:
orientation: "horizontal"
MDLabel:
text: "CPU Use:"
halign: 'center'
MDLabel:
text: "placeholder"
halign: 'center'
BoxLayout:
orientation: "horizontal"
MDLabel:
text: "Network:"
halign: 'center'
MDLabel:
text: "placeholder"
halign: 'center'
Widget:
BoxLayout:
orientation: "horizontal"
MDLabel:
text: "Progress"
halign: 'center'
MDProgressBar:
id: progress
value: 50
<RootWidget>:
HomeScreen:
name: "home_screen" MDNavigationDrawer:
id: nav_drawer
BoxLayout:
orientation: "vertical"
padding: "8dp"
spacing: "8dp"
MDLabel:
text: "Titan Scouting"
font_style: "Button"
size_hint_y: None
height: self.texture_size[1]
MDLabel:
text: "Data Analysis"
font_style: "Caption"
size_hint_y: None
height: self.texture_size[1]
ScrollView:
MDList:
OneLineAvatarListItem:
text: "Home"
on_press:
# nav_drawer.set_state("close")
# screen_manager.transition.direction = "left"
screen_manager.current = "Home"
IconLeftWidget:
icon: "home"
OneLineAvatarListItem:
text: "Settings"
on_press:
# nav_drawer.set_state("close")
# screen_manager.transition.direction = "right"
# screen_manager.fade
screen_manager.current = "Settings"
IconLeftWidget:
icon: "cog"
OneLineAvatarListItem:
text: "Info"
on_press:
# nav_drawer.set_state("close")
# screen_manager.transition.direction = "right"
# screen_manager.fade
screen_manager.current = "Info"
IconLeftWidget:
icon: "cog"

45
main.py
View File

@ -1,41 +1,22 @@
from kivy.app import App
from kivy.lang import Builder from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.animation import Animation from kivymd.app import MDApp
from hoverable import HoverBehavior # import superscript as ss
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavior
import json
from datetime import datetime
import glob
from pathlib import Path
import random
import superscript as ss
Builder.load_file('design.kv')
class HomeScreen(Screen): class HomeScreen(Screen):
# def sign_up(self): pass
# self.manager.transition.direction = "left" class SettingsScreen(Screen):
# self.manager.current = "sign_up_screen" pass
class InfoScreen(Screen):
# def login(self, uname, pword):
# with open ("users.json") as file:
# users = json.load(file)
# if uname in users and users[uname]["password"] == pword:
# self.manager.transition.direction = "left"
# self.manager.current = "login_screen_success"
# else:
# self.ids.login_wrong.text = "Incorrect Username or Password"
class RootWidget(ScreenManager):
pass pass
class MainApp(App): class MyApp(MDApp):
def build(self): def build(self):
return RootWidget() self.theme_cls.primary_palette = "Red"
return Builder.load_file("design.kv")
if __name__ == "__main__": if __name__ == "__main__":
MainApp().run() MyApp().run()