-
Notifications
You must be signed in to change notification settings - Fork 0
/
AonW.py
94 lines (77 loc) · 2.64 KB
/
AonW.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
import Text
import Voice
import time
import DataSets
import threading
import GUI
from os import getenv, _exit
import create_path
from tkinter import messagebox
import dataPath as dp
DTP = dp.dataPath.dataPath
credSavePath_sub_list = [getenv('APPDATA'), '\\AonW', '\\data']
create_path.CREATE_PATH_LIST(path_list=credSavePath_sub_list, log=False)
DataSets.loadSettings()
TEXTPUT = DataSets.Settings.Text
VOICEPUT = DataSets.Settings.Voice
if TEXTPUT and not VOICEPUT:
try:
t = threading.Thread(target = lambda: Text.main())
t.daemon=True
t.start()
while DataSets.Dataset_Text.begin==False and DataSets.Command.CredentialsReq == False:
pass
except:
print('Invalid, credentials, re sign-in required')
elif TEXTPUT and VOICEPUT:
try:
t = threading.Thread(target = lambda: Text.main())
t.daemon=True
t.start()
tv = threading.Thread(target = lambda: Voice.main())
tv.daemon=True
tv.start()
while (DataSets.Dataset_Text.begin==False or DataSets.Dataset_Voice.begin==False) and DataSets.Command.CredentialsReq == False:
pass
except:
print('Invalid, credentials, re sign-in required')
elif not TEXTPUT and VOICEPUT:
try:
tv = threading.Thread(target = lambda: Voice.main())
tv.daemon=True
tv.start()
while DataSets.Dataset_Voice.begin==False and DataSets.Command.CredentialsReq == False:
pass
except:
print('Invalid, credentials, re sign-in required')
def start():
tg = threading.Thread(target = lambda: GUI.start(DataSets.Command.CredentialsReq))
tg.daemon=True
tg.start()
while True:
time.sleep(2)
if DataSets.Quit:
break
_exit(0)
if __name__== "__main__":
try:
start()
except:
messagebox.showerror('Google Assistant On Windows - ERROR', 'The main Application couldn\'t be run properly!')
try:
h = open(DTP+'\\start.start', 'w+')
h.close()
except:
pass
import traceback, sys
# Get current system exception
ex_type, ex_value, ex_traceback = sys.exc_info()
# Extract unformatter stack traces as tuples
trace_back = traceback.extract_tb(ex_traceback)
# Format stacktrace
stack_trace = list()
for trace in trace_back:
stack_trace.append("File : %s , Line : %d, Func.Name : %s, Message : %s" % (trace[0], trace[1], trace[2], trace[3]))
print("Exception type : %s " % ex_type.__name__)
print("Exception message : %s" %ex_value)
print("Stack trace : %s" %stack_trace)