-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapstone.py
95 lines (72 loc) · 2.59 KB
/
capstone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# from adodbapi.examples.db_print import db
import adodbapi.ado_consts as adc
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import ObjectProperty
from kivy.uix.popup import Popup
from kivy.uix.label import Label
from app import sm, invalidForm
from database import DataBase
class CreateAccountWindow(Screen): #create an account window.
name = ObjectProperty(None)
email = ObjectProperty(None)
password = ObjectProperty(None)
def submit(self):
if self.name.text != "" and self.email.text != "" and self.email.text.count("@") == 1 and self.email.text.count(".") > 0:
if self.password != "":
db.add_user(self.email.text, self.password.text, self.name.text)
self.reset()
sm.current = "login"
else:
invalidForm()
else:
invalidForm()
def login(self):
self.reset()
sm.current = "login"
def reset(self):
self.email.text = ""
self.password.text = ""
self.namee.text = ""
class LoginWindow(Screen): # create login window
email = ObjectProperty(None)
password = ObjectProperty(None)
def loginBotton(self):
if db.validate(self.email.text, self.password.text):
MainWindow.current = self.email.text
self.reset()
sm.current = "main"
else:
invalidLogin()
def createBotton(self):
self.reset()
sm.current = "create"
def reset(self):
self.email.text = ""
self.password.text = ""
class KivyApp(App):
def build(self):
self.title = "Login Screen"
Window.size = (400, 200)
layout = GridLayout(cols=2, rows=2, padding=10, spacing=10, row_default_height=30)
usernameinput = TextInput()
print(usernameinput.text)
passwordinput = TextInput(password=True)
usernamelbl = Label(text="Username", size_hint_x=None, width=100)
passwordlbl = Label(text="Password", size_hint_x=None, width=100)
layout.add_widget(usernamelbl)
layout.add_widget(usernameinput)
layout.add_widget(passwordlbl)
layout.add_widget(passwordinput)
main_layout = BoxLayout(orientation='vertical', padding=10, spacing=10)
main_layout.add_widget(layout)
loginbutton = Button(text="Login")
main_layout.add_widget(loginbutton)
return main_layout
if __name__ == '__main__':
print("Hello world!")
print(f"adc = {adc}")
# print(f"db = {db}")
app = KivyApp()
app.run()