-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWeatherPi.py
executable file
·77 lines (46 loc) · 1.31 KB
/
WeatherPi.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
from multiprocessing import Process
import os
from Modules.Update import Update
from Modules.UpdateLog import UpdateLog
from Modules.UpdateUnicorn import UniCorn, UpdateIcon
from Modules.init_unicorn import unicorn_init
from Modules.update_matrix import *
processes_bar = []
def quit_all():
for thread in threads:
thread.cancel()
thread.join()
def main():
main_thread = threading.Timer(THREADING_TIMER, main)
main_thread.start()
threads.append(main_thread)
try:
Update().update_json()
UpdateLog().create_log()
update_matrix()
p = Process(target=update_bargraph)
for process in processes_bar:
process.terminate()
p.start()
processes_bar.append(p)
UpdateIcon().set_icon_path()
except KeyboardInterrupt:
quit_all()
clear_all()
if __name__ == '__main__':
Update().update_json()
os.system('Modules/WebApp.py &')
log_string('api endpoints created')
try:
matrix_init()
unicorn_init()
blinkt_init()
UniCorn().draw_single_icon('raspberry_boot')
update_clock_matrix()
main()
UniCorn().update_unicorn()
except KeyboardInterrupt:
quit_all()
clear_all()