-
Notifications
You must be signed in to change notification settings - Fork 0
/
mes2.py
289 lines (277 loc) · 14.7 KB
/
mes2.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'css4.ui'
#
# Created by: PyQt4 UI code generator 4.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
gradeDict = {
"O":10,
"A+":9,
"A":8.5,
"B+":8,
"B":7,
"C":6,
"P":5,
"F":0
}
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(799, 569)
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setGeometry(QtCore.QRect(430, 500, 341, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.lineEdit = QtGui.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(20, 20, 111, 29))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.lineEdit_2 = QtGui.QLineEdit(Dialog)
self.lineEdit_2.setGeometry(QtCore.QRect(20, 80, 111, 29))
self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))
self.lineEdit_3 = QtGui.QLineEdit(Dialog)
self.lineEdit_3.setGeometry(QtCore.QRect(20, 140, 113, 29))
self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3"))
self.lineEdit_4 = QtGui.QLineEdit(Dialog)
self.lineEdit_4.setGeometry(QtCore.QRect(20, 200, 113, 29))
self.lineEdit_4.setObjectName(_fromUtf8("lineEdit_4"))
self.lineEdit_5 = QtGui.QLineEdit(Dialog)
self.lineEdit_5.setGeometry(QtCore.QRect(20, 260, 113, 29))
self.lineEdit_5.setObjectName(_fromUtf8("lineEdit_5"))
self.lineEdit_6 = QtGui.QLineEdit(Dialog)
self.lineEdit_6.setGeometry(QtCore.QRect(20, 320, 113, 29))
self.lineEdit_6.setObjectName(_fromUtf8("lineEdit_6"))
self.lineEdit_7 = QtGui.QLineEdit(Dialog)
self.lineEdit_7.setGeometry(QtCore.QRect(20, 380, 113, 29))
self.lineEdit_7.setObjectName(_fromUtf8("lineEdit_7"))
self.lineEdit_8 = QtGui.QLineEdit(Dialog)
self.lineEdit_8.setGeometry(QtCore.QRect(20, 440, 113, 29))
self.lineEdit_8.setObjectName(_fromUtf8("lineEdit_8"))
self.lineEdit_9 = QtGui.QLineEdit(Dialog)
self.lineEdit_9.setGeometry(QtCore.QRect(20, 500, 113, 29))
self.lineEdit_9.setObjectName(_fromUtf8("lineEdit_9"))
self.comboBox = QtGui.QComboBox(Dialog)
self.comboBox.setGeometry(QtCore.QRect(200, 20, 69, 25))
self.comboBox.setObjectName(_fromUtf8("comboBox"))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox.addItem(_fromUtf8(""))
self.comboBox_2 = QtGui.QComboBox(Dialog)
self.comboBox_2.setGeometry(QtCore.QRect(200, 80, 69, 25))
self.comboBox_2.setObjectName(_fromUtf8("comboBox_2"))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_2.addItem(_fromUtf8(""))
self.comboBox_3 = QtGui.QComboBox(Dialog)
self.comboBox_3.setGeometry(QtCore.QRect(200, 140, 69, 25))
self.comboBox_3.setObjectName(_fromUtf8("comboBox_3"))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_3.addItem(_fromUtf8(""))
self.comboBox_4 = QtGui.QComboBox(Dialog)
self.comboBox_4.setGeometry(QtCore.QRect(200, 200, 69, 25))
self.comboBox_4.setObjectName(_fromUtf8("comboBox_4"))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_4.addItem(_fromUtf8(""))
self.comboBox_5 = QtGui.QComboBox(Dialog)
self.comboBox_5.setGeometry(QtCore.QRect(200, 260, 69, 25))
self.comboBox_5.setObjectName(_fromUtf8("comboBox_5"))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_5.addItem(_fromUtf8(""))
self.comboBox_6 = QtGui.QComboBox(Dialog)
self.comboBox_6.setGeometry(QtCore.QRect(200, 320, 69, 25))
self.comboBox_6.setObjectName(_fromUtf8("comboBox_6"))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_6.addItem(_fromUtf8(""))
self.comboBox_7 = QtGui.QComboBox(Dialog)
self.comboBox_7.setGeometry(QtCore.QRect(200, 380, 69, 25))
self.comboBox_7.setObjectName(_fromUtf8("comboBox_7"))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_7.addItem(_fromUtf8(""))
self.comboBox_8 = QtGui.QComboBox(Dialog)
self.comboBox_8.setGeometry(QtCore.QRect(200, 440, 69, 25))
self.comboBox_8.setObjectName(_fromUtf8("comboBox_8"))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_8.addItem(_fromUtf8(""))
self.comboBox_9 = QtGui.QComboBox(Dialog)
self.comboBox_9.setGeometry(QtCore.QRect(200, 500, 69, 25))
self.comboBox_9.setObjectName(_fromUtf8("comboBox_9"))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.comboBox_9.addItem(_fromUtf8(""))
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.calc)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(_translate("Dialog", "Grade Card", None))
self.lineEdit.setText(_translate("Dialog", "MA 102", None))
self.lineEdit_2.setText(_translate("Dialog", "PH 100", None))
self.lineEdit_3.setText(_translate("Dialog", "BE 100", None))
self.lineEdit_4.setText(_translate("Dialog", "BE 102", None))
self.lineEdit_5.setText(_translate("Dialog", "EE 100", None))
self.lineEdit_6.setText(_translate("Dialog", "CE 100", None))
self.lineEdit_7.setText(_translate("Dialog", "PH 110", None))
self.lineEdit_8.setText(_translate("Dialog", "CE 110", None))
self.lineEdit_9.setText(_translate("Dialog", "EE 110", None))
self.comboBox.setItemText(0, _translate("Dialog", "O", None))
self.comboBox.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox.setItemText(2, _translate("Dialog", "A", None))
self.comboBox.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox.setItemText(4, _translate("Dialog", "B", None))
self.comboBox.setItemText(5, _translate("Dialog", "C", None))
self.comboBox.setItemText(6, _translate("Dialog", "P", None))
self.comboBox.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_2.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_2.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_2.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_2.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_2.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_2.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_2.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_2.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_3.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_3.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_3.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_3.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_3.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_3.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_3.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_3.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_4.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_4.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_4.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_4.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_4.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_4.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_4.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_4.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_5.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_5.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_5.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_5.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_5.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_5.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_5.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_5.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_6.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_6.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_6.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_6.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_6.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_6.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_6.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_6.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_7.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_7.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_7.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_7.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_7.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_7.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_7.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_7.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_8.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_8.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_8.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_8.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_8.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_8.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_8.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_8.setItemText(7, _translate("Dialog", "F", None))
self.comboBox_9.setItemText(0, _translate("Dialog", "O", None))
self.comboBox_9.setItemText(1, _translate("Dialog", "A+", None))
self.comboBox_9.setItemText(2, _translate("Dialog", "A", None))
self.comboBox_9.setItemText(3, _translate("Dialog", "B+", None))
self.comboBox_9.setItemText(4, _translate("Dialog", "B", None))
self.comboBox_9.setItemText(5, _translate("Dialog", "C", None))
self.comboBox_9.setItemText(6, _translate("Dialog", "P", None))
self.comboBox_9.setItemText(7, _translate("Dialog", "F", None))
def calc(self):
sum=0.0
credSum=24
sum+=gradeDict[str(self.comboBox.currentText())]*4
sum+=gradeDict[str(self.comboBox_2.currentText())]*4
sum+=gradeDict[str(self.comboBox_3.currentText())]*4
sum+=gradeDict[str(self.comboBox_4.currentText())]*3
sum+=gradeDict[str(self.comboBox_5.currentText())]*3
sum+=gradeDict[str(self.comboBox_6.currentText())]*3
sum+=gradeDict[str(self.comboBox_7.currentText())]*1
sum+=gradeDict[str(self.comboBox_8.currentText())]*1
sum+=gradeDict[str(self.comboBox_9.currentText())]*1
sum/=credSum
sum=round(sum,2)
msg=QtGui.QMessageBox()
msg.setWindowTitle("GPA")
msg.setText("Your GPA is "+str(sum))
msg.exec_()
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec_())