-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_eye_tracking.py
84 lines (74 loc) · 1.96 KB
/
add_eye_tracking.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
import requests
from requests.auth import HTTPBasicAuth
import time
import zipfile
import os
import sys
import getopt, numpy
#api_key = '471f3a97a4ccc0f2d417369db65599e635097856'
#target_format = "html5"
#target_file = "target.zip"
def add_tracking(css_file):
src = open(css_file, 'r')
fline = '''.btn-primary {
color: bisque;
background-color: rgba(0,151,183,0.4);
border-radius: 5px;
width: 15vw;
height: 15vh;
}
.btn-primary:hover {
box-shadow: inset 0 0 0 20rem var(--darken-1);
}
.btn-primary:active {
box-shadow: inset 0 0 0 20rem var(--darken-2),
inset 0 3px 4px 0 var(--darken-3),
0 0 1px var(--darken-2);
}
.btn-primary:disabled,
.btn-primary.is-disabled {
opacity: .5;
}
.Calibration{
z-index:10000;
width: 20px;
height: 20px;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
background-color: red;
opacity: 0.2;
border-color: black;
border-style: solid;
position:fixed;
}
.calibrationDiv {
z-index:1000;
}'''
fline = fline+"\n" # Prepending string
oline = src.readlines()
# Here, we prepend the string we want to on first line
oline.insert(0, fline)
src.close()
# We again open the file in WRITE mode
src = open(css_file, "w")
src.writelines(oline)
src.close()
def create_div_data_css(data):
result = ""
todel = []
for attr, value in data.items():
if ("x1 " in attr or "y1 " in attr or len(attr) < 4 or "btn" in attr or "w0" in attr or "h0" in attr):
todel.append(attr)
if (len(data.items()) == 0):
return
for attr in todel:
del data[attr]
max_val = data[max(data, key=data.get)]
for attr, value in data.items():
# strHex = "%0.2X" % 255
result += str("."+attr.replace(" ", ".") + " { background-color: #"+str(
format((int((value/max_val)*255)), '02x')) + "00008B;}")
return result
def create_heat_map(json_data):
print(json_data)