-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
85 lines (79 loc) · 2.35 KB
/
main.py
File metadata and controls
85 lines (79 loc) · 2.35 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
import os
import time
from controller import data_manipulator
from graphics import Graphics
#print('*')
control = data_manipulator.DataManipulation()
def GetDetails():
data1=[]
while len(data1) !=4 :
#os.system('clear')
Graphics.DisplayGraphics()
print("Enter the following data:\n")
data1.append(input("Bug Name:"))
data1.append(input("Project Name:"))
data1.append(input("Bug Section:"))
data1.append(input("Importance (Only integer values between 1 and 5) :"))
data1.append(input("Description:"))
Graphics.DisplayGraphics()
flag=0
#print(data1)
for i in data1:
if len(i) == 0:
flag=1
if flag == 1:
print("\nInvalid Data Entry! Please enter again!")
time.sleep(2)
if flag == 0:
break
return data1
#print('*')
db = 0
while True:
count=0
#print('*')
Graphics.DisplayGraphics()
files = list(os.listdir('model'))
if 'bug-tracker.db' in files:
print('')
print("Updating Database. . .")
control.UpdateDatabase()
print('')
#print('*')
else:
#print('*')
print("")
print("Initializing Database. . .")
control.InitializeTables()
while True:
print("Main Menu:")
print("\n 1. Add a bug\n 2. View all bugs\n 3. Modify a bug\n 4. Close a bug\n 5. Exit\n\n>",end='')
try:
num = int(input())
except:
#os.system('clear')
Graphics.DisplayGraphics()
print('\033[91m'+"Input Error . ."+'\033[0m'+"\n")
if num == 1:
try:
control.AddData(GetDetails())
except:
#os.system('clear')
Graphics.DisplayGraphics()
print('\033[91m'+"Input Error . ."+'\033[0m'+"\n")
elif num == 2:
control.DisplayData()
elif num == 3:
control.ModifyData()
elif num == 4:
control.CloseBug()
elif num == 5:
control.CloseConnection()
os.system('clear')
exit(0)
else:
#os.system('clear')
Graphics.DisplayGraphics()
#control.DisplayNames()
print('\033[91m'+"Invalid Option . ."+'\033[0m'+"\n")
break