Skip to content

Commit

Permalink
update and upload all code
Browse files Browse the repository at this point in the history
  • Loading branch information
WithSJ committed Jun 12, 2020
1 parent cb0ad70 commit 93f24b0
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
__pycache__
*.pyc
5 changes: 5 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set Global variables name
global APP_NAME
global COMPANY_NAME
APP_NAME = "Hamster"
COMPANY_NAME = "Hamster.org"
34 changes: 34 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Fixed Screen size as android screen
from kivy.config import Config
Config.set('graphics', 'width', '360')
Config.set('graphics', 'height', '740')
# remove both line when build App

from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.floatlayout import FloatLayout
from kivymd.uix.tab import MDTabsBase

class Tabs(FloatLayout, MDTabsBase):
'''Class implementing content for a tab on home screen'''


class MessageApp(MDApp):
def change_screen(self,name):
screen_manager.current = name

def build(self):
global screen_manager
screen_manager = ScreenManager()
screen_manager.add_widget(Builder.load_file("ui//login.kv"))
screen_manager.add_widget(Builder.load_file("ui//signup.kv"))
screen_manager.add_widget(Builder.load_file("ui//forgot.kv"))
screen_manager.add_widget(Builder.load_file("ui//verification.kv"))
screen_manager.add_widget(Builder.load_file("ui//home.kv"))
self.theme_cls.theme_style="Light"

return screen_manager

if __name__ == "__main__":
MessageApp().run()
49 changes: 49 additions & 0 deletions ui/forgot.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#:kivy 1.0
#:import APP_NAME config.APP_NAME
#:import COMPANY_NAME config.COMPANY_NAME
MDScreen:
name: "forgot"
MDLabel:
text: APP_NAME
halign: "center"
pos_hint: {"center_y": .8}
font_style: "H3"

MDLabel:
text: "Forgot Password"
halign: "center"
pos_hint: {"center_y":.73}
font_style: "Subtitle2"

MDTextField:
hint_text: "Username or Email"
pos_hint: {"center_x": 0.5, "center_y": 0.6}
size_hint: .75,0.08
# mode: "rectangle"

MDRaisedButton:
text: "Forgot Password"
pos_hint: {"center_x": 0.5, "center_y":0.5}
size_hint: .7,0.05
on_release: app.change_screen("verification")

MDTextButton:
text: f"[color=#000000]Don't have an account?[/color] Sign up"
markup: True
pos_hint: {"center_x":0.5, "center_y":0.4}
on_release: app.change_screen("signup")

MDTextButton:
text: f"[b][color=#000000]Back To[/color] Login[/b]"
markup: True
pos_hint: {"center_x":0.5, "center_y":0.33}
on_release: app.change_screen("login")

MDLabel:
text: f"[font=Icons] {md_icons['copyright']}[/font] [font=Roboto]{COMPANY_NAME} 2020[/font]"
markup: True
halign: "center"
pos_hint: {"center_y":0.05}



27 changes: 27 additions & 0 deletions ui/home.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#:kivy 1.0
#:import APP_NAME config.APP_NAME
#:import COMPANY_NAME config.COMPANY_NAME
<Tabs>:
MDIconButton:
id: icon
icon: 'account'
user_font_size: "48sp"
pos_hint: {"center_x": .5, "center_y": .5}


MDScreen:
name: "home"
BoxLayout:
orientation:'vertical'

MDToolbar:
title: APP_NAME
MDTabs:
id: android_tabs

Tabs:
text: f"Messages"
Tabs:
text: "Contacts"
font_style: 'Subtitle2'

56 changes: 56 additions & 0 deletions ui/login.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#:kivy 1.0
#:import APP_NAME config.APP_NAME
#:import COMPANY_NAME config.COMPANY_NAME
MDScreen:
name: "login"

MDLabel:
text: APP_NAME
halign: "center"
pos_hint: {"center_y": .8}
font_style: "H3"

MDLabel:
text: "Log in"
halign: "center"
pos_hint: {"center_y":.73}
font_style: "Subtitle2"

MDTextField:
hint_text: "Username or Email"
pos_hint: {"center_x": 0.5, "center_y": 0.65}
size_hint: .75,0.085
# mode: "rectangle"

MDTextField:
hint_text: "Password"
pos_hint: {"center_x":0.5, "center_y":0.57}
size_hint: .75,0.085
password: True
# mode: "rectangle"

MDRaisedButton:
text: "Login"
pos_hint: {"center_x": 0.5, "center_y":0.48}
size_hint: .7,0.05
on_release: app.change_screen("home")

MDTextButton:
text: "Forgot password?"
pos_hint: {"center_x":0.5, "center_y":0.4}
on_release: app.change_screen("forgot")

MDTextButton:
text: f"[color=#000000]Don't have an account?[/color] Sign up"
markup: True
pos_hint: {"center_x":0.5, "center_y":0.33}
on_release: app.change_screen("signup")

MDLabel:
text: f"[font=Icons] {md_icons['copyright']}[/font] [font=Roboto]{COMPANY_NAME} 2020[/font]"
markup: True
halign: "center"
pos_hint: {"center_y":0.05}



61 changes: 61 additions & 0 deletions ui/signup.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#:kivy 1.0
#:import APP_NAME config.APP_NAME
#:import COMPANY_NAME config.COMPANY_NAME
MDScreen:
name: "signup"
MDLabel:
text: APP_NAME
halign: "center"
pos_hint: {"center_y": .8}
font_style: "H3"

MDLabel:
text: "Sign up"
halign: "center"
pos_hint: {"center_y":.73}
font_style: "Subtitle2"

MDTextField:
hint_text: "Email"
pos_hint: {"center_x": 0.5, "center_y": 0.65}
size_hint: .75,0.08
# mode: "rectangle"

MDTextField:
hint_text: "Fullname"
pos_hint: {"center_x":0.5, "center_y":0.57}
size_hint: .75,0.08
# mode: "rectangle"

MDTextField:
hint_text: "Username"
pos_hint: {"center_x":0.5, "center_y":0.49}
size_hint: .75,0.08
# mode: "rectangle"

MDTextField:
hint_text: "Password"
pos_hint: {"center_x":0.5, "center_y":0.41}
size_hint: .75,0.08
password: True
# mode: "rectangle"

MDRaisedButton:
text: "Sign up"
pos_hint: {"center_x": 0.5, "center_y":0.31}
size_hint: .7,0.05

MDTextButton:
text: f"[color=#000000]Have an account?[/color] Log in"
markup: True
pos_hint: {"center_x":0.5, "center_y":0.22}
on_release: app.change_screen("login")

MDLabel:
text: f"[font=Icons] {md_icons['copyright']}[/font] [font=Roboto]{COMPANY_NAME} 2020[/font]"
markup: True
halign: "center"
pos_hint: {"center_y":0.05}



54 changes: 54 additions & 0 deletions ui/verification.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#:kivy 1.0
#:import APP_NAME config.APP_NAME
#:import COMPANY_NAME config.COMPANY_NAME
MDScreen:
name: "verification"
MDLabel:
text: APP_NAME
halign: "center"
pos_hint: {"center_y": .8}
font_style: "H3"

MDLabel:
text: "Account verification"
halign: "center"
pos_hint: {"center_y":.73}
font_style: "Subtitle2"

MDLabel:
text: "We've sent a verification code to your email."
halign: "center"
pos_hint: {"center_y":.67}
font_style: "Body2"

MDTextField:
hint_text: "Enter your verification Code"
pos_hint: {"center_x": 0.5, "center_y": 0.6}
size_hint: .75,0.08
max_text_length: 6
# mode: "rectangle"

MDRaisedButton:
text: "Submit"
pos_hint: {"center_x": 0.5, "center_y":0.52}
size_hint: .7,0.05

MDTextButton:
text: "Resend code"
pos_hint: {"center_x": 0.5, "center_y":0.45}
on_release: app.change_screen("verification")

MDLabel:
text: "Never share your verification code to anyone."
halign: "center"
pos_hint: {"center_y":.4}
font_style: "Caption"

MDLabel:
text: f"[font=Icons] {md_icons['copyright']}[/font] [font=Roboto]{COMPANY_NAME} 2020[/font]"
markup: True
halign: "center"
pos_hint: {"center_y":0.05}



0 comments on commit 93f24b0

Please sign in to comment.