-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
87 lines (67 loc) · 3.03 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import sys
from assets.ui_AnovaOneWay import Ui_MainWindow
from assets import util
from PySide2.QtWidgets import QMainWindow, QApplication, QItemDelegate, QLineEdit
from PySide2.QtGui import QDoubleValidator, QPixmap
from PySide2.QtCore import QSize
class MainScreen(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.UI = Ui_MainWindow()
self.UI.setupUi(self)
self.UI.generate_Btn.clicked.connect(self.generateTable)
self.UI.compute_Btn.clicked.connect(self.compute)
self.UI.reset_Btn.clicked.connect(self.reset)
self.UI.anova_Tbl.setColumnCount(5)
self.UI.anova_Tbl.setHorizontalHeaderLabels(['SS', 'df', 'MS', 'F', 'p'])
self.UI.anova_Tbl.setRowCount(3)
self.UI.anova_Tbl.setVerticalHeaderLabels(['Treatment (Between) ', 'Error (Within) ', 'Total'])
self.UI.rawData_Tbl.setItemDelegate(inputValidator())
self.UI.acronymMeaning_Lbl.setMinimumSize(QSize(257, 342))
self.UI.acronymMeaning_Lbl.setMaximumSize(QSize(257, 342))
self.UI.acronymMeaning_Lbl.setPixmap(QPixmap(u"assets/acronymMeaning.jpeg"))
self.UI.acronymMeaning_Lbl.setScaledContents(True)
self.UI.formulaTable_Lbl.setMinimumSize(QSize(480, 135))
self.UI.formulaTable_Lbl.setMaximumSize(QSize(480, 135))
self.UI.formulaTable_Lbl.setPixmap(QPixmap(u"assets/formulaTable.jpeg"))
self.UI.formulaTable_Lbl.setScaledContents(True)
self.show()
def generateTable(self):
column = self.UI.column_Sbox.value()
row = self.UI.row_Sbox.value()
self.UI.rawData_Tbl.setColumnCount(column)
self.UI.rawData_Tbl.setRowCount(row)
treatments = self.UI.header_Ledit.text()
header = []
if treatments:
header = treatments.split(",")
else:
for i in range(1, column+1):
header.append(str(i))
self.UI.rawData_Tbl.setHorizontalHeaderLabels(header)
def compute(self):
util.oneWayAnova(self.UI)
def reset(self):
self.UI.header_Ledit.setText("")
self.UI.row_Sbox.setValue(0)
self.UI.column_Sbox.setValue(0)
self.UI.rawData_Tbl.setRowCount(0)
self.UI.rawData_Tbl.setColumnCount(0)
self.UI.anova_Tbl.setRowCount(0)
self.UI.anova_Tbl.setColumnCount(0)
self.UI.summary_Tbl.setRowCount(0)
self.UI.anova_Tbl.setRowCount(0)
self.UI.k_Lbl.setText("")
self.UI.n_Lbl.setText("")
self.UI.N_Lbl.setText("")
self.UI.G_Lbl.setText("")
self.UI.sas_Lbl.setText("")
class inputValidator(QItemDelegate):
def createEditor(self, parent, option, index):
data_Ledit = QLineEdit(parent)
data_Ledit.setValidator(QDoubleValidator())
return data_Ledit
if __name__ == '__main__':
application = QApplication(sys.argv)
window = MainScreen()
sys.exit(application.exec_())