LISHUZUOXUN_yangjiang/LSZXPagesLibrary/running_pick_up_widget_defi...

147 lines
4.8 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
from LSZXPagesLibrary.consensus import PICK_UP_TYPE_TABLE, PICK_UP_TYPE_LIST
from LSZXPagesLibrary.keyboard_layout import Keyboard
class RunningPickUpPageWidgetDefine(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.keyboard = Keyboard()
self.keyboard_layout = self.keyboard.get_layout()
# 全选按钮
self.select_button = self._init_select_button_widget()
# 取消全选按钮
self.cancel_select_button = self._init_cancel_select_button_widget()
# 下一步按钮
self.next_page_button = self._init_next_page_button_widget()
# 提示
self.tips_label = self._init_tips_label()
# 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_next_page_button_widget():
next_page_button = QPushButton("下一步")
next_page_button.setStyleSheet(
"font: 600 28px \"Microsoft YaHei UI\";"
"border: none;"
"color:#ffffff;"
"letter-spacing: 10px;"
"border-radius: 4px;"
"height: 80%;"
"background-color: #e6a23c;"
)
return next_page_button
@staticmethod
def _init_select_button_widget():
select_button = QPushButton("全选")
select_button.setStyleSheet(
"font: 28px \"Microsoft YaHei UI\";"
"border: 1px solid #222222;"
"color: #222222;"
"letter-spacing: 4px;"
"border-radius: 4px;"
"height: 90%;"
"background-color: #f4f4f5;"
)
return select_button
@staticmethod
def _init_cancel_select_button_widget():
cancel_select_button = QPushButton("取消全选")
cancel_select_button.setStyleSheet(
"font: 28px \"Microsoft YaHei UI\";"
"border: 1px solid #222222;"
"color: #222222;"
"letter-spacing: 4px;"
"border-radius: 4px;"
"height: 90%;"
"background-color: #f4f4f5;"
)
return cancel_select_button
@staticmethod
def _init_tips_label():
tips_text_label = QLabel("注意:蓝色边框表示未考人员,红色边框表示已考人员,蓝色背景表示当前参加考试人员。")
tips_text_label.setWordWrap(True)
tips_text_label.setStyleSheet(
"font: 20px \"Microsoft YaHei UI\";"
"letter-spacing: 4px;"
"padding:0 0 0 10"
)
return tips_text_label
@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