LISHUZUOXUN_yangjiang/LSZXPagesLibrary/running_score_widget_define.py

356 lines
12 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding: gb2312
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import *
from BaseFrontend.based_widget import BasedWidget
class RunningScoreWidgetDefine(BasedWidget):
def __init__(self):
super().__init__()
# 定义控件按Ctrl+点击快速跳转编辑)
"""**布局对象初始化区**布局对象初始化区**布局对象初始化区**布局对象初始化区**布局对象初始化区**布局对象初始化区"""
# 空白控件
# self.empty_box = self._init_empty_widget()
# 标题控件
self.title_label = self._init_title_widget()
# 回家按钮
self.back_home_button = self._init_back_button_widget()
# 一条直线
self.line_widget = self._init_line_widget()
# 长跑人员成绩确认滚动区域
self.scroll_area = self._init_scroll_area_widget()
# 请确认参加长跑考试的人员成绩确认名单提示
self.running_score_tips_label = self._init_running_score_tips_label_widget()
# 考生成绩卡片一个widget用于显示一个考生的姓名id用时成绩设置边框
self.card_widget = self.init_card_widget_widget()
# 确认成绩的考生姓名
self.round_score_name_label = self.init_round_score_name_label_widget()
# 确认成绩的考生ID
self.round_score_id_label = self.init_round_score_id_label_widget()
# 确认成绩的考生计时
self.round_score_time_label = self.init_round_score_time_label_widget()
# 确认成绩的考生成绩
self.round_score_grade_label = self.init_round_score_grade_label_widget()
# 哪个考生的长跑详情标题
self.round_tips_label = self._init_round_tips_label_widget()
# 循环显示用时和圈数的滚动区域
self.scroll_round_area = self._init_scroll_round_area_widget()
self.scroll_round_widget = self.init_scroll_round_widget()
# 圈数+圈时
self.round_time_label = self.init_round_time_label_widget()
# 提示哪个考生的成绩存在异常标题
self.score_abnormal_label = self._init_score_abnormal_label_widget()
# 撤销更改按钮
self.revoke_update_button = self._init_revoke_update_button()
# 确定更改按钮
self.commit_update_button = self._init_commit_update_button()
# 把更新成绩总布局添加进一个widget用于设置边框
self.update_widget = self._init_update_widget()
# 把右边长跑详情和成绩更改按钮添加进一个widget用于设置边框
self.right_widget = self._init_right_widget()
# 结束考试按钮
self.stop_test_button = self._init_stop_test_button()
# logo图标
self.logo_label = self._init_logo_label()
# 初始化空白控件
@staticmethod
def init_empty_widget():
empty_widget = QFrame()
empty_widget.setFrameShape(QFrame.Box)
empty_widget.setLineWidth(0)
return empty_widget
@staticmethod
def _init_title_widget():
title_label = QLabel("<训练类型标题>")
title_label.setAlignment(Qt.AlignCenter)
title_label.setStyleSheet(
"font: 30px \"Microsoft YaHei UI\";"
"letter-spacing: 4px"
)
return title_label
@staticmethod
def _init_back_button_widget():
back_home_button = QPushButton("返回首页")
icon = QIcon("assets/home.png")
back_home_button.setIconSize(QSize(32, 32))
back_home_button.setIcon(icon)
back_home_button.setStyleSheet(
"font: 24px \"Microsoft YaHei UI\";"
"border:none;"
"color:#222222;"
"letter-spacing: 10px;"
"border-radius:4px;"
"border:1px solid #222222"
";height: 60%;"
)
return back_home_button
@staticmethod
def _init_line_widget():
line = QFrame()
line.setFixedHeight(1) # 设置高度为 2 像素
line.setStyleSheet("border:1px solid #000000")
line.setFrameShape(QFrame.HLine) # 设置为水平线
return line
@staticmethod
def _init_scroll_area_widget():
scroll_area = QScrollArea()
scroll_area.setWidgetResizable(True)
scroll_area.setStyleSheet(
"border: none"
)
return scroll_area
@staticmethod
def _init_scroll_round_area_widget():
scroll_round_area = QScrollArea()
scroll_round_area.setWidgetResizable(True)
scroll_round_area.setStyleSheet(
"border-top: none;"
"border-bottom: none;"
"border-left:1px solid #bbbbbb;"
"border-right:1px solid #bbbbbb;"
)
return scroll_round_area
# 完成考试的考生成绩确认卡片
@staticmethod
def init_card_widget_widget():
card_widget = QWidget()
card_widget.setStyleSheet(
"border: 1px solid #409eff;"
"border-radius: 4px;"
"margin: 0px 0px 8px 8px;"
)
return card_widget
# 未完成考试的考生成绩确认卡片,显示黄色
@staticmethod
def init_unfinished_card_widget_widget():
card_widget = QWidget()
card_widget.setStyleSheet(
"border: 1px solid #e6a23c;"
"border-radius: 4px;"
"margin: 0px 0px 8px 8px;"
)
return card_widget
# 完成考试的样式,名字显示蓝色
@staticmethod
def init_round_score_name_label_widget():
round_score_name_label = QLabel()
round_score_name_label.setAlignment(Qt.AlignCenter)
round_score_name_label.setStyleSheet(
"border: none;"
"font: 600 24px \"Microsoft YaHei UI\";"
"padding: 0; "
"color: #409eff;"
"letter-spacing: 4px;"
)
return round_score_name_label
# 完成考试的样式ID显示蓝色
@staticmethod
def init_round_score_id_label_widget():
round_score_id_label = QLabel()
round_score_id_label.setAlignment(Qt.AlignCenter)
round_score_id_label.setStyleSheet(
"border: 1px solid #409eff;"
"padding: 4px 30px 4px 30px;"
"font: 20px \"Microsoft YaHei UI\";"
"background-color: #ecf5ff;"
"border-radius: 4px;"
"color: #101010;"
"margin: 0px 0px 6px 6px;"
)
return round_score_id_label
@staticmethod
def init_round_score_time_label_widget():
round_score_time_label = QLabel()
round_score_time_label.setStyleSheet(
"border: none;"
"font: 16px \"Microsoft YaHei UI\";"
)
return round_score_time_label
@staticmethod
def init_round_score_grade_label_widget():
round_score_grade_label = QLabel()
round_score_grade_label.setAlignment(Qt.AlignRight)
round_score_grade_label.setStyleSheet(
"border: none;"
"font: 16px \"Microsoft YaHei UI\";"
)
return round_score_grade_label
# 未完成考试的样式,名字显示黄色
@staticmethod
def init_round_unfinished_score_name_label_widget():
round_score_name_label = QLabel()
round_score_name_label.setAlignment(Qt.AlignCenter)
round_score_name_label.setStyleSheet(
"border: none;"
"font: 600 24px \"Microsoft YaHei UI\";"
"padding: 0;"
"color: #e6a23c;"
"letter-spacing: 4px"
)
return round_score_name_label
# 未完成考试的样式ID显示黄色
@staticmethod
def init_round_unfinished_score_id_label_widget():
round_score_id_label = QLabel()
round_score_id_label.setAlignment(Qt.AlignCenter)
round_score_id_label.setStyleSheet(
"border: 1px solid #e6a23c;"
"padding: 4px 30px 4px 30px;"
"font: 20px \"Microsoft YaHei UI\";"
"background-color: #fdf6ec;"
"border-radius: 4px;"
"color: #101010;"
"margin: 0px 0px 6px 6px;"
)
return round_score_id_label
@staticmethod
def _init_running_score_tips_label_widget():
running_score_tips_label = QLabel("请考生确认考试成绩")
running_score_tips_label.setStyleSheet(
"font: 24px \"Microsoft YaHei UI\";"
"letter-spacing: 4px;"
"border: none;"
"margin-left: 20px"
)
return running_score_tips_label
@staticmethod
def _init_round_tips_label_widget():
round_tips_label = QLabel("长跑详情:")
round_tips_label.setStyleSheet(
"font: 600 20px \"Microsoft YaHei UI\";"
"letter-spacing: 2px;"
"border: none;"
"margin-left: 2px;"
"margin-top: 2px;"
"margin-right: 2px;"
)
return round_tips_label
@staticmethod
def init_round_time_label_widget():
round_time_label = QLabel()
round_time_label.setStyleSheet(
"font: 20px \"Microsoft YaHei UI\";"
"margin-left: 4px;"
"border:none;"
)
return round_time_label
@staticmethod
def _init_score_abnormal_label_widget():
score_abnormal_label = QLabel("成绩可能存在异常,请核对!")
score_abnormal_label.setWordWrap(True)
score_abnormal_label.setAlignment(Qt.AlignLeft | Qt.AlignTop)
score_abnormal_label.setStyleSheet(
"font: 18px \"Microsoft YaHei UI\";"
"margin-top: 10px;"
"letter-spacing: 4px;"
"border: none;"
"margin-left: 10px;"
"margin-right: 10px;"
)
return score_abnormal_label
@staticmethod
def init_scroll_round_widget():
scroll_round_widget = QWidget()
scroll_round_widget.setStyleSheet(
"border: none;"
)
return scroll_round_widget
@staticmethod
def _init_revoke_update_button():
revoke_update_button = QPushButton("撤销更改")
revoke_update_button.setStyleSheet(
"font: 20px \"Microsoft YaHei UI\";"
"border: 1px solid #222222;"
"padding: 40px;"
"letter-spacing: 2px;"
"margin-right: 10px;"
"margin-left: 10px;"
"border-radius: 4px;"
)
return revoke_update_button
@staticmethod
def _init_commit_update_button():
commit_update_button = QPushButton("确定更改")
commit_update_button.setStyleSheet(
"font: 600 20px \"Microsoft YaHei UI\";"
"border: 1px solid #409eff;"
"background-color: #409eff;"
"padding: 40px;"
"letter-spacing: 2px;"
"color: #ffffff;"
"margin-right: 10px;"
"border-radius: 4px;"
)
return commit_update_button
@staticmethod
def _init_update_widget():
update_widget = QWidget()
update_widget.setStyleSheet(
"border-top:1px solid #bbbbbb;"
"border-radius: 0px;"
)
return update_widget
@staticmethod
def _init_right_widget():
right_widget = QWidget()
right_widget.setStyleSheet(
"border:1px solid #bbbbbb;"
"border-radius: 0px"
)
return right_widget
# 初始化结束考试按钮
@staticmethod
def _init_stop_test_button():
stop_test_button = QPushButton("结束考试")
stop_test_button.setStyleSheet(
"font: 600 28px \"Microsoft YaHei UI\";"
"border: none;"
"color: #ffffff;"
"letter-spacing: 10px;"
"border-radius: 4px;"
"height: 70%;"
"background-color: #67c23a;"
)
return stop_test_button
@staticmethod
def _init_logo_label():
logo_img = QLabel()
logo_img.setStyleSheet(
"border-image: url(assets/logo.png);"
"background-size: contain;"
"background-repeat: no-repeat;"
"background-position: center;"
)
logo_img.setAlignment(Qt.AlignCenter)
logo_img.setScaledContents(True)
logo_img.setContentsMargins(12, 6, 12, 6)
return logo_img