-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuserScreen.py
More file actions
93 lines (66 loc) · 2.53 KB
/
Copy pathuserScreen.py
File metadata and controls
93 lines (66 loc) · 2.53 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
88
89
90
91
92
93
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import loginScreen
import sqlOperations
class userScreen(QDialog):
def __init__(self, userName, title):
super(userScreen, self).__init__()
self.userName = userName
self.initUi(400, 350, 20)
self.setWindowTitle(title)
def initUi(self, winWidth, winHeight, winMargins):
self.setMinimumSize(winWidth, winHeight)
self.resize(winWidth, winHeight)
vLayout = QVBoxLayout()
logoutButton = QPushButton('Logout')
logoutButton.clicked.connect(self.logoutClick)
welcomeLabel = QLabel('Welcome, ' + self.userName)
userLogout = QHBoxLayout()
userLogout.addWidget(welcomeLabel)
userLogout.addStretch(1)
userLogout.addWidget(logoutButton)
self.listWidget = QListWidget()
self.admins = QComboBox()
self.admins.currentIndexChanged.connect(self.adminChanged)
for admName in sqlOperations.getAdmins():
self.admins.addItem(admName)
if(self.listWidget.count() > 0):
self.listWidget.setCurrentRow(0)
fileLabel = QLabel('File')
self.fileName = QLineEdit()
browseButton = QPushButton('Browse')
browseButton.clicked.connect(self.browseClick)
fileLayout = QHBoxLayout()
fileLayout.addWidget(fileLabel)
fileLayout.addWidget(self.fileName)
fileLayout.addWidget(browseButton)
analyseButton = QPushButton('Analyse')
analyseButton.clicked.connect(self.analyseClick)
analyseLayout = QHBoxLayout()
analyseLayout.addStretch(1)
analyseLayout.addWidget(analyseButton)
analyseLayout.addStretch(1)
vLayout.addLayout(userLogout)
vLayout.addWidget(self.admins)
vLayout.addWidget(self.listWidget)
vLayout.addLayout(fileLayout)
vLayout.addLayout(analyseLayout)
self.setLayout(vLayout)
self.show()
def analyseClick(self):
print "analyse"
def browseClick(self):
openfile = QFileDialog.getOpenFileName()
self.fileName.setText(openfile)
def populateList(self):
fstrings = sqlOperations.getStrings(self.fUser)
for fstr in fstrings:
item = QListWidgetItem(fstr)
self.listWidget.addItem(item)
def adminChanged(self):
self.listWidget.clear()
self.fUser = str(self.admins.currentText())
self.populateList()
def logoutClick(self):
self.close()
self.screen = loginScreen.loginScreen()