265 lines
8.9 KiB
Python
265 lines
8.9 KiB
Python
|
# coding: gb2312
|
|||
|
from PyQt5.QtCore import Qt, QSize
|
|||
|
from PyQt5.QtWidgets import *
|
|||
|
from BaseFrontend.based_widget import BasedWidget
|
|||
|
from PyQt5.QtGui import QIcon
|
|||
|
|
|||
|
|
|||
|
class HomePageWidgetDefine(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()
|
|||
|
# ͼ<><CDBC><EFBFBD>ؼ<EFBFBD>
|
|||
|
self.image_widget = self._init_image_widget()
|
|||
|
# <20><><EFBFBD><EFBFBD><EEB6AF><EFBFBD>ؼ<EFBFBD>
|
|||
|
self.sit_up_widget = self._init_sit_up_widget()
|
|||
|
self.pull_up_widget = self._init_pull_up_widget()
|
|||
|
self.hanging_up_widget = self._init_hanging_up_widget()
|
|||
|
self.push_up_widget = self._init_push_up_widget()
|
|||
|
self.runaround_widget = self._init_runaround_widget()
|
|||
|
self.running_widget = self._init_running_widget()
|
|||
|
# WiFi<46>ؼ<EFBFBD>
|
|||
|
self.wifi_widget = self.init_wifi_widget()
|
|||
|
self.wifi_disconnect_widget = self.init_wifi_disconnect_widget()
|
|||
|
self.wifi_stacked_widget = QStackedWidget()
|
|||
|
self.wifi_stacked_widget.addWidget(self.wifi_disconnect_widget)
|
|||
|
self.wifi_stacked_widget.addWidget(self.wifi_widget)
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
|
|||
|
self.standard_title = self._init_standard_title_widget()
|
|||
|
self.standard_value = self._init_standard_value_widget()
|
|||
|
self.difficulty_title = self._init_difficulty_title_widget()
|
|||
|
self.difficulty_value = self._init_difficulty_value_widget()
|
|||
|
# ͬ<><CDAC><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
|||
|
self.data_synchronization_button = self._init_data_synchronization_widget()
|
|||
|
self.score_synchronization_button = self._init_score_synchronization_widget()
|
|||
|
# logo<67><6F><EFBFBD><EFBFBD>
|
|||
|
self.logo_label = self._init_logo_widget()
|
|||
|
|
|||
|
# <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
|
|||
|
|
|||
|
# <20><>ʼ<EFBFBD><CABC>ͼ<EFBFBD><CDBC><EFBFBD>ؼ<EFBFBD>
|
|||
|
@staticmethod
|
|||
|
def _init_image_widget():
|
|||
|
image_widget = QLabel()
|
|||
|
image_widget.setStyleSheet(
|
|||
|
"border-image: url(assets/main.png) 0 0 0 0 stretch stretch;"
|
|||
|
)
|
|||
|
image_widget.setAlignment(Qt.AlignCenter)
|
|||
|
image_widget.setScaledContents(True)
|
|||
|
return image_widget
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_sit_up_widget():
|
|||
|
sit_up = QPushButton()
|
|||
|
sit_up.setStyleSheet(
|
|||
|
"border-image: url(assets/ywqz.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
"margin: 5 20 5 20;"
|
|||
|
)
|
|||
|
sit_up.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|||
|
return sit_up
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_pull_up_widget():
|
|||
|
pull_up = QPushButton()
|
|||
|
pull_up.setStyleSheet(
|
|||
|
"border-image: url(assets/ytxs.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
"margin: 5 20 5 20;"
|
|||
|
)
|
|||
|
pull_up.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|||
|
return pull_up
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_hanging_up_widget():
|
|||
|
hanging_up = QPushButton()
|
|||
|
hanging_up.setStyleSheet(
|
|||
|
"border-image: url(assets/qbxc.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
"margin: 5 20 5 20;"
|
|||
|
)
|
|||
|
hanging_up.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|||
|
return hanging_up
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_push_up_widget():
|
|||
|
push_up = QPushButton()
|
|||
|
push_up.setStyleSheet(
|
|||
|
"border-image: url(assets/fwc.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
"margin: 5 20 5 20;"
|
|||
|
)
|
|||
|
push_up.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|||
|
return push_up
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_runaround_widget():
|
|||
|
runaround = QPushButton()
|
|||
|
runaround.setStyleSheet(
|
|||
|
"border-image: url(assets/sxp.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
"margin: 5 20 5 20;"
|
|||
|
)
|
|||
|
runaround.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|||
|
return runaround
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_running_widget():
|
|||
|
running = QPushButton()
|
|||
|
running.setStyleSheet(
|
|||
|
"border-image: url(assets/sqm.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
"margin:5 20 5 20;"
|
|||
|
)
|
|||
|
running.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|||
|
return running
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def init_wifi_widget():
|
|||
|
wifi_frame = QPushButton()
|
|||
|
icon = QIcon("assets/wifi.png")
|
|||
|
wifi_frame.setIconSize(QSize(70, 70))
|
|||
|
wifi_frame.setIcon(icon)
|
|||
|
wifi_frame.setStyleSheet(
|
|||
|
"background-color: qlineargradient("
|
|||
|
"spread: pad,"
|
|||
|
"x1: 0,"
|
|||
|
"y1: 0,"
|
|||
|
"x2: 1,"
|
|||
|
"y2: 1,"
|
|||
|
"stop: 0 rgba(113, 183, 255, 255),"
|
|||
|
"stop: 1 rgba(79, 149, 224, 255),"
|
|||
|
"stop: 2 rgba(56, 147, 242, 255));"
|
|||
|
"border-style: none;"
|
|||
|
"border-radius: 50%;"
|
|||
|
"height: 100px;"
|
|||
|
)
|
|||
|
return wifi_frame
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def init_wifi_disconnect_widget():
|
|||
|
wifi_disconnect_widget = QPushButton()
|
|||
|
icon = QIcon("assets/wifi.png")
|
|||
|
wifi_disconnect_widget.setIconSize(QSize(70, 70))
|
|||
|
wifi_disconnect_widget.setIcon(icon)
|
|||
|
wifi_disconnect_widget.setStyleSheet(
|
|||
|
"background-color: #c2c2c3;"
|
|||
|
"border-style: none;"
|
|||
|
"border-radius: 50%;"
|
|||
|
"height: 100px;"
|
|||
|
)
|
|||
|
return wifi_disconnect_widget
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_standard_title_widget():
|
|||
|
standard_title = QLabel("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
|
|||
|
standard_title.setStyleSheet(
|
|||
|
"font: 24px \"Microsoft YaHei UI\";"
|
|||
|
)
|
|||
|
return standard_title
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_difficulty_title_widget():
|
|||
|
difficulty_title = QLabel("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѷȣ<EFBFBD>")
|
|||
|
difficulty_title.setStyleSheet(
|
|||
|
"font: 24px \"Microsoft YaHei UI\";"
|
|||
|
)
|
|||
|
return difficulty_title
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_standard_value_widget():
|
|||
|
standard_value = QLabel("<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>")
|
|||
|
standard_value.setStyleSheet(
|
|||
|
"font:700 24px \"Microsoft YaHei UI\";"
|
|||
|
)
|
|||
|
return standard_value
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_difficulty_value_widget():
|
|||
|
difficulty_value = QLabel("<<3C><><EFBFBD><EFBFBD><EFBFBD>Ѷ<EFBFBD>>")
|
|||
|
difficulty_value.setStyleSheet(
|
|||
|
"font:700 24px \"Microsoft YaHei UI\";"
|
|||
|
)
|
|||
|
return difficulty_value
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_data_synchronization_widget():
|
|||
|
synchronization_widget = QPushButton("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>")
|
|||
|
synchronization_widget.setContentsMargins(30, 0, 30, 0)
|
|||
|
synchronization_widget.setStyleSheet(
|
|||
|
"height: 100px;"
|
|||
|
"font: 700 35px \"Microsoft YaHei UI\";"
|
|||
|
"background-color: qlineargradient("
|
|||
|
"spread: pad,"
|
|||
|
"x1: 0,"
|
|||
|
"y1: 0,"
|
|||
|
"x2: 1,"
|
|||
|
"y2: 1,"
|
|||
|
"stop: 0 rgba(113, 183, 255, 255), "
|
|||
|
"stop: 1 rgba(79, 149, 224, 255),"
|
|||
|
"stop: 2 rgba(56, 147, 242, 255));"
|
|||
|
"border: none;"
|
|||
|
"color: #ffffff;"
|
|||
|
"letter-spacing: 10px;"
|
|||
|
"border-radius: 4px;"
|
|||
|
)
|
|||
|
return synchronization_widget
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_score_synchronization_widget():
|
|||
|
synchronization_widget = QPushButton("<EFBFBD>ɼ<EFBFBD>ͬ<EFBFBD><EFBFBD>")
|
|||
|
synchronization_widget.setContentsMargins(30, 0, 30, 0)
|
|||
|
synchronization_widget.setStyleSheet(
|
|||
|
"height:100px;"
|
|||
|
"font:700 35px \"Microsoft YaHei UI\";"
|
|||
|
"background-color: qlineargradient("
|
|||
|
"spread: pad,"
|
|||
|
"x1: 0,"
|
|||
|
"y1: 0,"
|
|||
|
"x2: 1,"
|
|||
|
"y2: 1,"
|
|||
|
"stop: 0 rgba(113, 183, 255, 255), "
|
|||
|
"stop: 1 rgba(79, 149, 224, 255),"
|
|||
|
"stop: 2 rgba(56, 147, 242, 255));"
|
|||
|
"border: none;"
|
|||
|
"color: #ffffff;"
|
|||
|
"letter-spacing: 10px;"
|
|||
|
"border-radius: 4px;"
|
|||
|
)
|
|||
|
return synchronization_widget
|
|||
|
|
|||
|
@staticmethod
|
|||
|
def _init_logo_widget():
|
|||
|
logo = QLabel()
|
|||
|
logo.setStyleSheet(
|
|||
|
"border-image: url(assets/logo.png);"
|
|||
|
"background-size: contain;"
|
|||
|
"background-repeat: no-repeat;"
|
|||
|
"background-position: center;"
|
|||
|
)
|
|||
|
logo.setAlignment(Qt.AlignCenter)
|
|||
|
logo.setScaledContents(True)
|
|||
|
return logo
|