-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimer.py
49 lines (43 loc) · 1.38 KB
/
timer.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
class Timer():
UpList = {}
DownList = {}
def tick():
for i in Timer.UpList:
Timer.UpList[i] += 1
for i in Timer.DownList:
if not Timer.DownList[i] == True:
Timer.DownList[i] -= 1
if Timer.DownList[i] == 0:
Timer.DownList[i] = True
def set(name = False, value = None, up = False):
if value == None or up:
if name == False:
keylist = Timer.UpList.keys()
for i in Timer.UpList:
if not keylist[Timer.UpList.index(i)] == i:
name = Timer.UpList[i]
print(name)
if value == None:
value = 0
Timer.UpList[name] = value
else:
Timer.DownList[name] = value
def get(name, up = False):
if up:
return Timer.UpList[name]
if Timer.DownList[name] == True:
#print(Timer.DownList)
return True
else:
return False
def getvalue(name, up):
if up:
return Timer.UpList[name]
return Timer.DownList[name]
def __str__():
print("Current Timers:")
for i in Timer.UpList:
print(Timer.UpList)
print(i,":", Timer.UpList[i])
for i in Timer.DownList:
print(i,":", Timer.DownList[i])