-
Notifications
You must be signed in to change notification settings - Fork 0
/
EQPlay.py
56 lines (44 loc) · 1.28 KB
/
EQPlay.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
from DisplayManager import displayManager
from EQMap import BLACK
from EventDB import eventDB
from time import sleep
EQEventQueue = []
displayManager.displayMap()
displayManager.drawRightJustifiedText(500, "database player")
sleep(2)
def displayDatabase(day):
# Repaint the map from the events in the DB
displayManager.displayMap()
# load DB event que
EQEventQueue, filecount = eventDB.load(day)
# event count
eventcount = len(EQEventQueue)
#print event queue to map
for event in EQEventQueue:
cqLon = event[0]
cqLat = event[1]
cqMag = event[2]
cqTsunami = event[3]
cqAlert = event[4]
color = displayManager.colorFromMag(cqMag)
displayManager.mapEarthquake(cqLon, cqLat, cqMag, color)
return eventcount
def main():
lastevents = 0
updateMap = True
EQEventQueue, filecount = eventDB.load() #grab filecount
try:
while updateMap:
for day in range(filecount):
#displayManager.displayMap()
events = displayDatabase(day)
if events > lastevents: trend = "up"
if events < lastevents: trend = "down"
lastevents = events
displayManager.drawRightJustifiedText(100, "db: " + str(day) + " Events:" + str(events) + " Trending " + trend)
displayManager.handleKeyPress()
sleep(5)
except KeyboardInterrupt:
pass
if __name__ == '__main__':
main()