-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
73 lines (63 loc) · 2.59 KB
/
main.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
from menu import menu, pausa, receivedData, menuShortcuts
from db import getAll, insertDB, updateDB, removeDB, getById, getPending, getInProgress, getComplete
def main():
title = "Menu"
items = ["1 Insert",
"2 List all",
"3 List pending",
"4 List in progress",
"5 List completed",
"Exit"]
repeat = True
while repeat:
opc = menu(title, items)
if (opc == 1):
insertDB()
pausa(0.5)
elif (opc == 2):
idL, nameL = getAll()
id = receivedData('Select', idL, nameL, 'purple')
id = id if id is not None else 'Exit'
if id != 'Exit':
info = getById(id, 'Current data')
print(info[0])
op = menuShortcuts(['[Update]', '[Remove]', '[Exit]'], 'Select an option', 'green') if id != 'Exit' else id
if op == 0: updateDB(id)
elif op == 1: removeDB(id)
pausa(0.5)
elif (opc == 3):
idL, nameL = getPending()
id = receivedData('Select', idL, nameL, 'red')
id = id if id is not None else 'Exit'
if id != 'Exit':
info = getById(id, 'Current data')
print(info[0])
op = menuShortcuts(['[Update]', '[Remove]', '[Exit]'], 'Select an option', 'green') if id != 'Exit' else id
if op == 0: updateDB(id)
elif op == 1: removeDB(id)
pausa(0.5)
elif (opc == 4):
idL, nameL = getInProgress()
id = receivedData('Select', idL, nameL, 'blue')
id = id if id is not None else 'Exit'
if id != 'Exit':
info = getById(id, 'Current data')
print(info[0])
op = menuShortcuts(['[Update]', '[Remove]', '[Exit]'], 'Select an option', 'green') if id != 'Exit' else id
if op == 0: updateDB(id)
elif op == 1: removeDB(id)
pausa(0.5)
elif (opc == 5):
idL, nameL = getComplete()
id = receivedData('Select', idL, nameL, 'green')
id = id if id is not None else 'Exit'
if id != 'Exit':
info = getById(id, 'Current data')
print(info[0])
op = menuShortcuts(['[Update]', '[Remove]', '[Exit]'], 'Select an option', 'green') if id != 'Exit' else id
if op == 0: updateDB(id)
elif op == 1: removeDB(id)
pausa(0.5)
repeat = (opc < len(items))
if __name__ == "__main__":
main()