-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tea.py
106 lines (88 loc) · 3.34 KB
/
Tea.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
from PyQt5.QtGui import QFont, QIcon
from PyQt5.QtWidgets import QMainWindow, QTabWidget, QApplication, QWidget, QAction, qApp
from sys import argv
from sys import exit as sys_exit
from maintab import MainTab
from introduction import Introduction
from PLCtab import PLCTab
from training_tab_regression import TrainingTab
from printtab import PrintTab
class MainWindow(QMainWindow):
def __init__(self, app):
super(MainWindow, self).__init__()
screen = app.primaryScreen()
rect = screen.availableGeometry()
self.title = " "
self.left = 0
self.top = 30
self.width = rect.width()
self.height = rect.height() - self.top
self.initUI()
def initUI(self):
# Set font size
self.font18 = QFont("Times New Roman")
self.font18.setPointSize(18)
self.font16 = QFont("Times New Roman")
self.font16.setPointSize(16)
self.font15 = QFont("Times New Roman")
self.font15.setPointSize(15)
self.font14 = QFont("Times New Roman")
self.font14.setPointSize(14)
self.font13 = QFont("Times New Roman")
self.font13.setPointSize(13)
self.font12 = QFont("Times New Roman")
self.font12.setPointSize(12)
self.font11 = QFont("Times New Roman")
self.font11.setPointSize(11)
self.font10 = QFont("Times New Roman")
self.font10.setPointSize(10)
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
centralwidget = QWidget(self)
self.introductionGroupBox = Introduction(self)
if self.height > 800:
self.table_widget = MyTableWidget(self)
else:
self.table_widget = MyTableWidget(self)
self.setCentralWidget(centralwidget)
exitAct = QAction(QIcon('exit.png'), '&Exit', self)
exitAct.setShortcut('Ctrl+Q')
exitAct.setStatusTip('Exit application')
exitAct.triggered.connect(qApp.quit)
menubar = self.menuBar()
fileMenu = menubar.addMenu('')
fileMenu.addAction(exitAct)
self.show()
class MyTableWidget(QTabWidget):
def __init__(self, parent):
super(QTabWidget, self).__init__(parent)
self.font18 = parent.font18
self.font16 = parent.font16
self.font15 = parent.font15
self.font14 = parent.font14
self.font13 = parent.font13
self.font12 = parent.font12
self.font11 = parent.font11
self.font10 = parent.font10
self.left = parent.left
self.top = int(parent.height * 0.2)
self.width = parent.width
self.height = int(parent.height * 0.8)
self.setGeometry(self.left, self.top, self.width, self.height)
self.allFont = QFont("Times New Roman")
self.allFont.setPointSize(14)
# Create tabs
self.tabMain = MainTab(self)
self.tabMain.setFont(self.allFont)
self.tabPLC = PLCTab(self)
self.tabTraining = TrainingTab(self)
self.tabPrinting = PrintTab(self)
# Add tabs
self.addTab(self.tabMain, "Main")
self.addTab(self.tabPLC, "PLC")
self.addTab(self.tabTraining, "Training")
self.addTab(self.tabPrinting, "In ấn")
if __name__ == '__main__':
app = QApplication(argv)
window = MainWindow(app)
sys_exit(app.exec_())