-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathapp.py
executable file
·53 lines (42 loc) · 982 Bytes
/
app.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
#!/usr/bin/env python
#
# App.py
from config import Config
from windows.loginWindow import LoginWindow
from dapi import DAPI
from dewdrop import DewDrop
from version import new_version
import gtk
class App:
def __init__(self):
self._cfg = Config()
new_version()
if self._cfg.get('email') == None:
# Time to login
self.show_login()
else:
# Test the credentials
if self.test_credentials(self._cfg.get('email'), self._cfg.get('passhash')) == True:
self.start()
else:
self.logout()
def logout(self):
self._cfg.set('email', None)
self._cfg.set('passhash', None)
self._cfg.save()
delattr(self, 'dew')
self.show_login()
def show_login(self):
login = LoginWindow(self)
login.show()
def test_credentials(self, email, passhash):
d = DAPI()
d.auth(email, passhash)
rtn = d.account_details()
if rtn.is_error():
return rtn
return True
def start(self):
self.dew = DewDrop(self)
if __name__ == "__main__":
app = App()