-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_screen.py
43 lines (34 loc) · 1.18 KB
/
main_screen.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
class main_screen():
options = {
'1': 'new_task',
'2': 'todays_tasks',
'3': 'show_entire_history'
}
def __init__(self, task):
self.task = task
self.current_option = None
def print_current_task(self):
if self.task.task_start_time:
print("Current task: %s" % self.task.task_name)
def print_options(self):
for k,v in self.options.items():
print("%s : %s" % (k,v))
def read_option(self):
while True:
print("Select option: ", end='')
self.current_option = input()
if self.validate_option():
if self.current_option == "1":
#of task has start time then stop it first
if self.task.task_start_time:
self.task.stop_task()
self.task.__init__()
self.task.set_task_name()
self.task.start_task()
break
def validate_option(self):
if self.current_option in self.options:
validated_status= True
else:
validated_status= False
return validated_status