forked from yhtyyar94/Python_Modul_Week_6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchief.py
More file actions
87 lines (72 loc) · 2.66 KB
/
chief.py
File metadata and controls
87 lines (72 loc) · 2.66 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from personal_task import PersonalTask
from work_task import WorkTask
from task_management import TaskManagement
from task_editing import TaskEditing
from task_tracking import TaskTracking
from keywords import SPECIAL_KEYWORDS
from datetime import datetime
def get_date_input():
user_input = input("Enter deadline (YYYY-MM-DD or keywords: today, tomorrow, next week): ").lower()
if user_input in SPECIAL_KEYWORDS:
return SPECIAL_KEYWORDS[user_input].strftime("%Y-%m-%d")
try:
datetime.strptime(user_input, "%Y-%m-%d")
return user_input
except ValueError:
print("Invalid date format.")
return get_date_input()
def main():
tm = TaskManagement()
te = TaskEditing(tm)
tt = TaskTracking(tm)
while True:
print("\nTask Manager Menu:")
print("1. Add Personal Task")
print("2. Add Work Task")
print("3. Display Tasks")
print("4. Set Task Status")
print("5. Mark Task as Completed")
print("6. Set Task Priority")
print("7. Get Task Deadline")
print("8. Get Task Color")
print("9. Exit")
choice = input("Select an option: ")
if choice == "1":
task_id = input("Enter task ID: ")
name = input("Enter task name: ")
deadline = get_date_input()
task = PersonalTask(task_id, name, deadline)
tm.add_task(task)
elif choice == "2":
task_id = input("Enter task ID: ")
name = input("Enter task name: ")
deadline = get_date_input()
task = WorkTask(task_id, name, deadline)
tm.add_task(task)
elif choice == "3":
tm.display_tasks()
elif choice == "4":
task_id = input("Enter task ID: ")
status = input("Enter new status: ")
te.set_status(task_id, status)
elif choice == "5":
task_id = input("Enter task ID: ")
te.mark_completed(task_id)
elif choice == "6":
task_id = input("Enter task ID: ")
priority = input("Enter new priority: ")
te.set_priority(task_id, priority)
elif choice == "7":
task_id = input("Enter task ID: ")
deadline = tt.get_deadline(task_id)
print(f"Deadline: {deadline}" if deadline else "Task not found.")
elif choice == "8":
task_id = input("Enter task ID: ")
color = tt.get_color(task_id)
print(f"Color: {color}" if color else "Task not found.")
elif choice == "9":
break
else:
print("Invalid option.")
if __name__ == "__main__":
main()