-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.py
More file actions
64 lines (55 loc) · 2.25 KB
/
timer.py
File metadata and controls
64 lines (55 loc) · 2.25 KB
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
import os
import time
import config
from plyer import notification
wait_sequence = [int(config.time_on_minutes*60), int(config.time_off_minutes*60)]
def seconds_to_timer(seconds):
minutes, seconds = divmod(seconds, 60)
return f"{int(minutes):02d}:{int(seconds):02d}"
def print_7_seg_time(time_str):
dict = {
"0":('▓▓▓','▓ ▓','▓ ▓','▓ ▓','▓▓▓'),
"1":(' ▓',' ▓',' ▓',' ▓',' ▓'),
"2":('▓▓▓',' ▓','▓▓▓','▓ ','▓▓▓'),
"3":('▓▓▓',' ▓','▓▓▓',' ▓','▓▓▓'),
"4":('▓ ▓','▓ ▓','▓▓▓',' ▓',' ▓'),
"5":('▓▓▓','▓ ','▓▓▓',' ▓','▓▓▓'),
"6":('▓▓▓','▓ ','▓▓▓','▓ ▓','▓▓▓'),
"7":('▓▓▓',' ▓',' ▓',' ▓',' ▓'),
"8":('▓▓▓','▓ ▓','▓▓▓','▓ ▓','▓▓▓'),
"9":('▓▓▓','▓ ▓','▓▓▓',' ▓','▓▓▓'),
":":(' ',' ▓ ',' ',' ▓ ',' '),
}
time_list = list(time_str)
for seg in range(5):
print(' '.join([dict.get(value)[seg] for value in time_list]))
print("Pomodoro Timer...")
print()
def print_time_up():
print()
print("▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓")
print("▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓")
print("▓▓▓▓▓▓▓▓TIME▓▓▓▓▓▓▓▓")
print("▓▓▓▓▓▓▓▓▓UP▓▓▓▓▓▓▓▓▓")
print("▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓")
print("▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓")
print()
notification.notify(
title = "Pomodoro",
message = "Time is up...",
app_icon = None,
timeout = 10,
toast = False
)
try:
# Shrink the CLI to just fit the timer so it doesn't take up so much space
os.system('mode con: cols=20 lines=9')
while True:
for wait_time in wait_sequence:
for i in range(wait_time):
time.sleep(1)
print_7_seg_time(seconds_to_timer(wait_time - i))
print_time_up()
time.sleep(5)
except KeyboardInterrupt:
print("Pomodoro Timer Stopped...")