LISHUZUOXUN_yangjiang/LSZXPagesLibrary/running_score_widget_define.py

356 lines
12 KiB
Python
Raw Normal View History

2024-09-23 14:54:15 +08:00
# 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__()
# <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>Ctrl+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><E0BCAD>
"""**<2A><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>**<2A><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>**<2A><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>**<2A><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>**<2A><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>**<2A><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>"""
# <20>հ׿ؼ<D7BF>
# self.empty_box = self._init_empty_widget()
# <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD>
self.title_label = self._init_title_widget()
# <20>ؼҰ<D8BC>ť
self.back_home_button = self._init_back_button_widget()
# һ<><D2BB>ֱ<EFBFBD><D6B1>
self.line_widget = self._init_line_widget()
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>ɼ<EFBFBD>ȷ<EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
self.scroll_area = self._init_scroll_area_widget()
# <20><>ȷ<EFBFBD>ϲμӳ<CEBC><D3B3>ܿ<EFBFBD><DCBF>Ե<EFBFBD><D4B5><EFBFBD>Ա<EFBFBD>ɼ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
self.running_score_tips_label = self._init_running_score_tips_label_widget()
# <20><><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>Ƭ<EFBFBD><C6AC>һ<EFBFBD><D2BB>widget<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ<CABE><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>id<69><64><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ߿<C3B1><DFBF><EFBFBD>
self.card_widget = self.init_card_widget_widget()
# ȷ<>ϳɼ<CFB3><C9BC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
self.round_score_name_label = self.init_round_score_name_label_widget()
# ȷ<>ϳɼ<CFB3><C9BC>Ŀ<EFBFBD><C4BF><EFBFBD>ID
self.round_score_id_label = self.init_round_score_id_label_widget()
# ȷ<>ϳɼ<CFB3><C9BC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>ʱ
self.round_score_time_label = self.init_round_score_time_label_widget()
# ȷ<>ϳɼ<CFB3><C9BC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ɼ<EFBFBD>
self.round_score_grade_label = self.init_round_score_grade_label_widget()
# <20>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
self.round_tips_label = self._init_round_tips_label_widget()
# ѭ<><D1AD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ʱ<EFBFBD><CAB1>Ȧ<EFBFBD><C8A6><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
self.scroll_round_area = self._init_scroll_round_area_widget()
self.scroll_round_widget = self.init_scroll_round_widget()
# Ȧ<><C8A6>+Ȧʱ
self.round_time_label = self.init_round_time_label_widget()
# <20><>ʾ<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijɼ<C4B3><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>
self.score_abnormal_label = self._init_score_abnormal_label_widget()
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť
self.revoke_update_button = self._init_revoke_update_button()
# ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť
self.commit_update_button = self._init_commit_update_button()
# <20>Ѹ<EFBFBD><D1B8>³ɼ<C2B3><C9BC>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>һ<EFBFBD><D2BB>widget<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ߿<C3B1>
self.update_widget = self._init_update_widget()
# <20><><EFBFBD>ұ߳<D2B1><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳɼ<CDB3><C9BC><EFBFBD><EFBFBD>İ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD>ӽ<EFBFBD>һ<EFBFBD><D2BB>widget<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ߿<C3B1>
self.right_widget = self._init_right_widget()
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>԰<EFBFBD>ť
self.stop_test_button = self._init_stop_test_button()
# logoͼ<6F><CDBC>
self.logo_label = self._init_logo_label()
# <20><>ʼ<EFBFBD><CABC><EFBFBD>հ׿ؼ<D7BF>
@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("<ѵ<><D1B5><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>>")
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ")
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) # <20><><EFBFBD>ø߶<C3B8>Ϊ 2 <20><><EFBFBD><EFBFBD>
line.setStyleSheet("border:1px solid #000000")
line.setFrameShape(QFrame.HLine) # <20><><EFBFBD><EFBFBD>Ϊˮƽ<CBAE><C6BD>
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
# <20><><EFBFBD>ɿ<EFBFBD><C9BF>ԵĿ<D4B5><C4BF><EFBFBD><EFBFBD>ɼ<EFBFBD>ȷ<EFBFBD>Ͽ<EFBFBD>Ƭ
@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
# δ<><CEB4><EFBFBD>ɿ<EFBFBD><C9BF>ԵĿ<D4B5><C4BF><EFBFBD><EFBFBD>ɼ<EFBFBD>ȷ<EFBFBD>Ͽ<EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫ
@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
# <20><><EFBFBD>ɿ<EFBFBD><C9BF>Ե<EFBFBD><D4B5><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫ
@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
# <20><><EFBFBD>ɿ<EFBFBD><C9BF>Ե<EFBFBD><D4B5><EFBFBD>ʽ<EFBFBD><CABD>ID<49><44>ʾ<EFBFBD><CABE>ɫ
@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
# δ<><CEB4><EFBFBD>ɿ<EFBFBD><C9BF>Ե<EFBFBD><D4B5><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫ
@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
# δ<><CEB4><EFBFBD>ɿ<EFBFBD><C9BF>Ե<EFBFBD><D4B5><EFBFBD>ʽ<EFBFBD><CABD>ID<49><44>ʾ<EFBFBD><CABE>ɫ
@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("<EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Ͽ<EFBFBD><EFBFBD>Գɼ<EFBFBD>")
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
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("<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶ԣ<EFBFBD>")
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
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("ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
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
# <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>԰<EFBFBD>ť
@staticmethod
def _init_stop_test_button():
stop_test_button = QPushButton("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
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