-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog_in.py
60 lines (45 loc) · 1.78 KB
/
log_in.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
# noinspection PyUnresolvedReferences
from init import Gtk, Notify, GLib
from util import show_msgbox
class LogInWindow(Gtk.Window):
def __init__(self, title: str):
Gtk.Window.__init__(self, title=title)
self.set_size_request(150, 100)
self.set_resizable(False)
label = Gtk.Label('Please, enter your credentials in order'
"\n"
'to authorize in the application.')
def new_sep():
sep = Gtk.Separator()
sep.set_margin_top(5)
sep.set_margin_bottom(5)
return sep
form = Gtk.VBox(spacing=6)
form.set_border_width(10)
form.set_hexpand(True)
self.email = Gtk.Entry()
self.password = Gtk.Entry()
self.password.set_visibility(False)
submit_button = Gtk.Button(label="Enter")
submit_button.connect("clicked", self.on_submit_button_clicked)
form.pack_start(label, True, False, 0)
form.pack_start(new_sep(), True, False, 0)
form.pack_start(Gtk.Label('E-Mail'), True, False, 0)
form.pack_start(self.email, True, False, 0)
form.pack_start(Gtk.Label('Password'), True, False, 0)
form.pack_start(self.password, True, False, 0)
form.pack_start(new_sep(), True, False, 0)
form.pack_end(submit_button, True, False, 0)
self.add(form)
def on_submit_button_clicked(self, widget):
email = self.email.get_text()
password = self.password.get_text()
print('Email:', email)
print('Password:', password)
if '@' not in email:
show_msgbox(self, 'You entered an incorrect e-mail')
else:
# authorize
self.destroy()
def __del__(self):
print('deleted log in form')