204 lines
6.7 KiB
Python
204 lines
6.7 KiB
Python
# coding: gb2312
|
||
from PyQt5.QtWidgets import *
|
||
from PyQt5.QtCore import Qt
|
||
from BaseFrontend.based_widget import BasedWidget
|
||
|
||
|
||
class PersonPageWidgetDefine(BasedWidget):
|
||
|
||
def __init__(self):
|
||
super().__init__()
|
||
# 定义控件(按Ctrl+点击快速跳转编辑)
|
||
"""**布局对象初始化区**布局对象初始化区**布局对象初始化区**布局对象初始化区**布局对象初始化区**布局对象初始化区"""
|
||
# 班级标题
|
||
self.class_title = self._init_class_title_widget()
|
||
# 班级下拉框
|
||
self.class_combobox = self._init_class_combobox()
|
||
# 姓名标题
|
||
self.name_title = self._init_name_title_widget()
|
||
# 姓名输入框
|
||
self.name_editbox = self._init_name_editbox()
|
||
# 添加人员信息按钮
|
||
self.add_person_button = self._init_add_person_button()
|
||
# 人员信息同步按钮
|
||
self.person_synchronization_button = self._init_person_synchronization_button()
|
||
# 全选按钮
|
||
self.select_all_button = self._init_select_all_button()
|
||
# 取消全选按钮
|
||
self.deselect_all_button = self._init_deselect_all_button()
|
||
# 批量删除人员信息按钮
|
||
self.delete_persons_button = self._init_delete_persons_button()
|
||
# Excel导入人员信息按钮
|
||
self.excel_import_button = self._init_excel_import_button()
|
||
# Excel导出人员信息按钮
|
||
self.excel_export_button = self._init_excel_export_button()
|
||
# 表格
|
||
self.table_widget = self._init_table_widget()
|
||
|
||
# 初始化空白控件
|
||
@staticmethod
|
||
def init_empty_widget():
|
||
empty_widget = QFrame()
|
||
# empty_widget.setStyleSheet("border: 1px solid red")
|
||
return empty_widget
|
||
|
||
@staticmethod
|
||
def _init_class_title_widget():
|
||
class_title = QLabel("班级:")
|
||
class_title.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
|
||
class_title.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
)
|
||
return class_title
|
||
|
||
@staticmethod
|
||
def _init_class_combobox():
|
||
class_combobox = QComboBox()
|
||
class_combobox.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
"padding-left: 15px;"
|
||
)
|
||
return class_combobox
|
||
|
||
@staticmethod
|
||
def _init_name_title_widget():
|
||
action_difficulty_title = QLabel("姓名:")
|
||
action_difficulty_title.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
|
||
action_difficulty_title.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
)
|
||
return action_difficulty_title
|
||
|
||
@staticmethod
|
||
def _init_name_editbox():
|
||
name_editbox = QLineEdit()
|
||
name_editbox.setPlaceholderText("请输入姓名")
|
||
name_editbox.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
"padding-left: 15px;"
|
||
)
|
||
return name_editbox
|
||
|
||
@staticmethod
|
||
def _init_add_person_button():
|
||
add_person_button = QPushButton("添加人员信息")
|
||
add_person_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return add_person_button
|
||
|
||
@staticmethod
|
||
def _init_person_synchronization_button():
|
||
person_synchronization_button = QPushButton("人员信息同步")
|
||
person_synchronization_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return person_synchronization_button
|
||
|
||
@staticmethod
|
||
def _init_select_all_button():
|
||
select_all_button = QPushButton("全选")
|
||
select_all_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return select_all_button
|
||
|
||
@staticmethod
|
||
def _init_deselect_all_button():
|
||
deselect_all_button = QPushButton("取消全选")
|
||
deselect_all_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return deselect_all_button
|
||
|
||
@staticmethod
|
||
def _init_delete_persons_button():
|
||
delete_persons_button = QPushButton("批量删除人员信息")
|
||
delete_persons_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return delete_persons_button
|
||
|
||
@staticmethod
|
||
def _init_excel_import_button():
|
||
excel_import_button = QPushButton("Excel导入人员信息")
|
||
excel_import_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return excel_import_button
|
||
|
||
@staticmethod
|
||
def _init_excel_export_button():
|
||
excel_export_button = QPushButton("Excel导出人员信息")
|
||
excel_export_button.setStyleSheet(
|
||
"font: 24px \"Microsoft YaHei UI\";"
|
||
"color: #222222;"
|
||
"letter-spacing: 4px;"
|
||
"border: 1px solid #222222;"
|
||
"border-radius: 4px;"
|
||
"padding-top: 15px;"
|
||
"padding-bottom: 15px;"
|
||
)
|
||
return excel_export_button
|
||
|
||
@staticmethod
|
||
def _init_table_widget():
|
||
table_widget = QTableWidget()
|
||
# table_widget = PersonTable()
|
||
table_widget.setStyleSheet(
|
||
"font: 18px \"Microsoft YaHei UI\";"
|
||
)
|
||
return table_widget
|