-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
146 lines (114 loc) · 4.65 KB
/
gui.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
from tkinter import *
from firebase_communication import auth
from firebase_communication.update_db import set_active, set_deactive
import os
def main_menu():
global main_screen
main_screen = Tk()
main_screen.geometry("350x300")
main_screen.title("Account Login")
Label(text="SISOSIG Client Software", width="300", height="2", font=("Calibri", 13)).pack()
Label(text="").pack()
Button(text="Login", height="2", width="30", command=login_screen).pack()
Label(text="").pack()
Button(text="Register", height="2", width="30", command=register_screen).pack()
main_screen.mainloop()
def register_screen():
global register_screen
global email
global password
global location_name
global max_people
global email_entry
global password_entry
global location_name_entry
global people_entry
register_screen = Toplevel(main_screen)
register_screen.title("Register")
register_screen.geometry("350x300")
email = StringVar()
password = StringVar()
location_name = StringVar()
max_people = IntVar()
Label(register_screen, text="Register", ).pack()
Label(register_screen, text="").pack()
email_label = Label(register_screen, text="Email: ")
email_label.pack()
email_entry = Entry(register_screen, textvariable=email)
email_entry.pack()
password_label = Label(register_screen, text="Password: ")
password_label.pack()
password_entry = Entry(register_screen, textvariable=password, show='*')
password_entry.pack()
location_name_label = Label(register_screen, text="Location Name: ")
location_name_label.pack()
location_name_entry = Entry(register_screen, textvariable=location_name)
location_name_entry.pack()
people_label = Label(register_screen, text="Person Capacity to Enhance Social Distancing: ")
people_label.pack()
people_entry = Entry(register_screen, textvariable=max_people)
people_entry.pack()
Label(register_screen, text="").pack()
Button(register_screen, text="Register", width=10, height=1, command=register_user).pack()
def register_user():
email_info = email.get()
password_info = password.get()
location_name_info = location_name.get()
max_people_info = max_people.get()
user_id = auth.create_account(email_info,password_info,location_name_info,max_people_info)
control_screen(user_id)
'''
try:
user_id = auth.create_account(email_info,password_info,location_name_info,max_people_info)
control_screen(user_id)
except:
Label(register_screen, text="Registration Failed. Please try again.", fg="red", font=("calibri", 11)).pack()
'''
def login_screen():
global login_screen
global login_email
global login_password
global login_email_entry
global login_password_entry
login_screen = Toplevel(main_screen)
login_screen.title("Login")
login_screen.geometry("300x250")
login_email = StringVar()
login_password = StringVar()
Label(login_screen, text="Login", ).pack()
Label(login_screen, text="").pack()
email_label = Label(login_screen, text="Email: ")
email_label.pack()
login_email_entry = Entry(login_screen, textvariable=login_email)
login_email_entry.pack()
password_label = Label(login_screen, text="Password: ")
password_label.pack()
login_password_entry = Entry(login_screen, textvariable=login_password, show='*')
login_password_entry.pack()
Label(login_screen, text="").pack()
Button(login_screen, text="Login", width=10, height=1, command=login_user).pack()
def login_user():
email_info = login_email.get()
password_info = login_password.get()
try:
user = auth.login_user(email_info,password_info)
except:
Label(login_screen, text="Registration Failed. Please try again.", fg="red", font=("calibri", 11)).pack()
# TODO: USER LOGIN
def control_screen(user):
global is_active
register_screen.destroy()
#main_screen.withdraw()
is_active = False
control_screen = Toplevel(main_screen)
control_screen.title("Control Screen")
control_screen.geometry("350x250")
is_active_label = Label(control_screen, text='Change your camera activity.').pack()
Button(control_screen, text="Activate", width=10, height=1, command=lambda: change_camera_activity(user)).pack()
Button(control_screen, text="De-Activate", width=10, height=1).pack() #TODO: Add Camera Deactivation
def change_camera_activity(user):
global is_active
if not is_active:
is_active = True
os.system(r'python yolov3_deepsort.py demo\test.mp4 '+f'{user[1:]}' ' --display')
main_menu()