-
Notifications
You must be signed in to change notification settings - Fork 0
/
GroupAndHighlightManager.py
65 lines (49 loc) · 2.16 KB
/
GroupAndHighlightManager.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
from database import TaskUpdateDB, MasterTaskDB, GroupsDB, GroupsLinkDB
from DisplayManager import DisplayManager
class GroupAndHighlightManager:
def __init__(self):
self.updatesDB = TaskUpdateDB('task.db')
self.masterDB = MasterTaskDB('task.db')
self.groupsDB = GroupsDB('task.db')
self.groupsLinkDB = GroupsLinkDB('task.db')
self.displayManager = DisplayManager()
def add_highlight(self, master_task_id):
index = input("Enter the number of the update you want to highlight: ")
colors = [
"black",
"red",
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white",
"dim"
]
print("\nPossible colors for highlighting are:")
for color in colors:
print(color)
highlight_color = input("\nEnter the color for your highlight: ")
if highlight_color not in colors:
print("Invalid color. Please try again with a valid color.")
return
print(index, highlight_color)
self.updates_db.add_highlight_to_update(index, highlight_color)
def create_group(self, master_task_id):
group_name = input("Enter the name of the new group: ")
self.groupsDB.create_group(master_task_id, group_name)
def get_group_id(self, master_task_id):
groups = self.groupsDB.get_groups(master_task_id)
self.displayManager.display_groups(groups)
group_id = input("Enter the number of the group you want to select: ")
return group_id
def add_to_group(self, master_task_id):
group_id = self.get_group_id(master_task_id)
update_id = input("Enter the number of the update you want to add to the group: ")
self.groupsLink_db.create_link(update_id, group_id)
def get_group_updates_with_text(self, master_task_id):
group_id = self.get_group_id(master_task_id)
updates = self.groupsLink_db.get_updates_from_links(group_id)
print(updates)
self.displayManager.display_task_updates(updates)
input("Press enter to continue...")