-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluate_warning_window.py
153 lines (144 loc) · 6.77 KB
/
evaluate_warning_window.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
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'evaluate_warning_window2.ui'
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QPalette # 调色板模块
class Evaluate_Warning_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(600, 177)
MainWindow.setMinimumSize(QtCore.QSize(600, 177))
MainWindow.setMaximumSize(QtCore.QSize(600, 177))
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
# 开启自动填充背景
self.centralwidget.setAutoFillBackground(True)
palette = QPalette() # 调色板类
palette.setBrush(QPalette.Background, QtGui.QBrush(QtGui.QPixmap('img/evaluate_warning_bg.png'))) # 设置背景图片
self.centralwidget.setPalette(palette) # 为控件设置对应的调色板即可
self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
self.tableWidget.setGeometry(QtCore.QRect(0, 0, 600, 177))
font = QtGui.QFont()
font.setPointSize(12)
self.tableWidget.setFont(font)
self.tableWidget.setLineWidth(1)
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) # 表格内容不可编辑
self.tableWidget.setRowCount(3)
self.tableWidget.setColumnCount(3)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setStyleSheet("background-color:rgba(244,244,244,2)") # 设置背景透明
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True) # 字体加粗
font.setWeight(75)
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True) # 字体加粗
font.setWeight(75)
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True) # 字体加粗
font.setWeight(75)
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(0, 0, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(0, 1, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(0, 2, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(1, 0, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(1, 1, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(1, 2, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(2, 0, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(2, 1, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
font = QtGui.QFont()
font.setPointSize(12)
item.setFont(font)
self.tableWidget.setItem(2, 2, item)
self.tableWidget.horizontalHeader().setDefaultSectionSize(199) # 默认列宽度
self.tableWidget.horizontalHeader().setMinimumSectionSize(25) # 最小列宽度
self.tableWidget.horizontalHeader().setStretchLastSection(False) # 关闭拉伸
self.tableWidget.verticalHeader().setVisible(False) # 不显示行号
self.tableWidget.verticalHeader().setDefaultSectionSize(50) # 默认行高度
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "评价预警窗口"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "关注图书的名称"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "最新的中评信息"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "最新的差评信息"))
__sortingEnabled = self.tableWidget.isSortingEnabled()
self.tableWidget.setSortingEnabled(False) # 关闭排序
item = self.tableWidget.item(0, 0)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(0, 1)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(0, 2)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(1, 0)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(1, 1)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(1, 2)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(2, 0)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(2, 1)
item.setText(_translate("MainWindow", "无"))
item = self.tableWidget.item(2, 2)
item.setText(_translate("MainWindow", "无"))
self.tableWidget.setSortingEnabled(__sortingEnabled)