-
Notifications
You must be signed in to change notification settings - Fork 0
/
pomodoro.py
81 lines (65 loc) · 1.88 KB
/
pomodoro.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
from win10toast import ToastNotifier
import time
class Pomodoro:
def __init__(self):
self.toaster = ToastNotifier()
def task(self, timing=1500):
print("starting task...")
time.sleep(timing)
self.toaster.show_toast(
"POMODORO",
"Your task has completed!",
threaded=True,
icon_path=None,
duration=3
)
# Await toaster completion
while self.toaster.notification_active():
time.sleep(0.1)
return
def short_break(self, timing=300):
print("starting break...")
time.sleep(timing)
self.toaster.show_toast(
"POMODORO",
"Short break is over!",
threaded=True,
icon_path=None,
duration=3
)
# Await toaster completion
while self.toaster.notification_active():
time.sleep(0.1)
return
def medium_break(self, timing=1800):
print("starting break...")
time.sleep(timing)
self.toaster.show_toast(
"POMODORO",
"Medium break is over!",
threaded=True,
icon_path=None,
duration=3
)
# Await toaster completion
while self.toaster.notification_active():
time.sleep(0.1)
return
def long_break(self, timing=3600):
print("starting break...")
time.sleep(timing)
self.toaster.show_toast(
"POMODORO",
"Long break is over!",
threaded=True,
icon_path=None,
duration=3
)
# Await toaster completion
while self.toaster.notification_active():
time.sleep(0.1)
return
if __name__=='__main__':
pomodoro = Pomodoro()
pomodoro.task(2)
pomodoro.short_break(1)