-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (34 loc) · 1.14 KB
/
main.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
import sys
from load_graph import *
from find_edges import *
from gui import *
from get_chrome_history import *
DEBUG = True
if __name__ == "__main__":
try:
get_history()
FILE_NAME = 'out.csv'
except:# OperationalError:
print("Chrome database could not be accessed.. Using demo history file")
FILE_NAME = 'history.csv'
g, md = load_graph(FILE_NAME)
g = find_edges(g, md)
if g.vertices() == None:
print("No webpages in history")
sys.exit()
gui = Gui(g, md)
gui.draw() # draw once only since the graph does not change
# The event loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT or \
(event.type == pygame.KEYDOWN and
(event.key == pygame.K_q or event.key == pygame.K_ESCAPE)):
pygame.display.quit()
sys.exit()
elif event.type == pygame.MOUSEBUTTONUP:
# Respond to clicks
gui.on_click(event)
elif event.type == pygame.MOUSEMOTION:
# Respond to moves
gui.on_move(event)