forked from yogesh-kamble/Money-Manager-Python-Android
/
start.py
77 lines (52 loc) · 1.32 KB
/
start.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
import android
import pdb
from Money_Planner import Money_Planner,DB_Connection
from data_report import DataReport #import start_data_report
class Start_App:
def __init__(self):
self.connect=DB_Connection()
self.droid=android.Android()
def start(self):
'''
'''
self.cursor=self.connect.set_db_connection()
self.xml_read=open("layout/Start_Gui.xml","r").read()
self.droid.fullShow(self.xml_read)
self.eventLoop()
self.connect.connection.commit()
def add_expenses_click(self):
'''
'''
planner=Money_Planner(self.droid)
planner.start_gui(self.cursor)
self.droid.fullShow(self.xml_read)
del planner
return
#pdb.set_trace()
def view_expense_click(self):
'''
'''
data=DataReport(self.droid)
data.start_gui(self.cursor)
self.droid.fullShow(self.xml_read)
del data
return
def eventLoop(self):
while(True):
result=self.droid.eventWait().result
print result
if result["name"] == "click":
id=result["data"]["id"]
if id == "wid":
#droid.fullDismiss()
self.add_expenses_click()
elif id == "view":
self.view_expense_click()
elif result["name"]=="key":
id=result["data"]["key"]
if id == "4":
self.droid.fullDismiss()
return
if __name__ == "__main__":
start_app=Start_App()
start_app.start()