Commit 6ac3e63b authored by Zheng Yile's avatar Zheng Yile
Browse files

Update gui-beta-ui

parent 97690494
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QPalette, QBrush, QColor
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt, QPropertyAnimation, pyqtSignal, QRect, pyqtProperty, QObject, QEasingCurve
from PyQt5.QtGui import QFont, QPalette, QBrush, QColor, QPainterPath, QPainter
from PyQt5.QtWidgets import QApplication, QPushButton, QLabel, QFrame
Font = {
'main': QFont(),
......@@ -63,3 +63,63 @@ Palette['gray'].setBrush(QPalette.Inactive, QPalette.Text, grayBrush)
grayBrush = QBrush(QColor(120, 120, 120))
grayBrush.setStyle(Qt.SolidPattern)
Palette['gray'].setBrush(QPalette.Disabled, QPalette.Text, grayBrush)
class NewPushButton(QLabel):
mouseHovered = pyqtSignal()
mouseLeft = pyqtSignal()
clicked = pyqtSignal()
nowColor = QColor(241, 242, 243)
def setColor(self, col):
palette = self.palette()
palette.setColor(QPalette.Background, col)
self.setPalette(palette)
self.nowColor = col
color = pyqtProperty(QColor, fset=setColor)
def __init__(self, parent):
super(NewPushButton, self).__init__(parent)
self.setStyleSheet("NewPushButton { border: 1px solid gray; border-radius: 5px }")
self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.mouseHovered.connect(self.hoveredAnimeStart)
self.mouseLeft.connect(self.leftAnimeStart)
def hoveredAnimeStart(self):
self.setAutoFillBackground(True)
self.hoveredAnime = QPropertyAnimation(self, b"color")
self.hoveredAnime.setDuration(400)
self.hoveredAnime.setStartValue(self.nowColor)
self.hoveredAnime.setEndValue(QColor(227, 240, 255))
self.hoveredAnime.setEasingCurve(QEasingCurve.OutCubic)
self.hoveredAnime.start()
def leftAnimeStart(self):
self.setAutoFillBackground(True)
self.leftAnime = QPropertyAnimation(self, b"color")
self.leftAnime.setDuration(400)
self.leftAnime.setStartValue(self.nowColor)
self.leftAnime.setEndValue(QColor(241, 242, 243))
self.leftAnime.setEasingCurve(QEasingCurve.OutCubic)
self.leftAnime.start()
def enterEvent(self, e):
# print("enterEvent")
self.mouseHovered.emit()
def leaveEvent(self, e):
# print("leaveEvent")
self.mouseLeft.emit()
def mouseReleaseEvent(self, e):
# print("mouseReleaseEvent")
if 0 <= e.x() <= self.width() and 0 <= e.y() <= self.height():
self.clicked.emit()
self.mouseHovered.emit()
def mousePressEvent(self, e):
self.setAutoFillBackground(True)
self.pressedAnime = QPropertyAnimation(self, b"color")
self.pressedAnime.setDuration(400)
self.pressedAnime.setStartValue(self.nowColor)
self.pressedAnime.setEndValue(QColor(207, 220, 235))
self.pressedAnime.setEasingCurve(QEasingCurve.OutCubic)
self.pressedAnime.start()
......@@ -28,8 +28,8 @@ def BeginLogin(callback = None):
reportVar["allow_error_deg"] = 1
uiLogin.pushButtonLogin.clicked.connect(lambda: Login(callback))
uiLogin.pushButtonLogin.setFocus()
uiLogin.pushButtonLogin.setDefault(True)
# uiLogin.pushButtonLogin.setFocus()
# uiLogin.pushButtonLogin.setDefault(True)
uiLogin.pushButtonLoginGoReset.clicked.connect(ShowReset)
uiLogin.pushButtonLoginGoRegister.clicked.connect(ShowRegister)
uiLogin.lineEditLoginPassword.setEchoMode(QLineEdit.Password)
......
......@@ -30,7 +30,7 @@ class Ui_windowLogin(object):
self.frameLogin.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frameLogin.setFrameShadow(QtWidgets.QFrame.Raised)
self.frameLogin.setObjectName("frameLogin")
self.pushButtonLoginGoReset = QtWidgets.QPushButton(self.frameLogin)
self.pushButtonLoginGoReset = NewPushButton(self.frameLogin)
self.pushButtonLoginGoReset.setGeometry(QtCore.QRect(315, 190, 120, 32))
self.pushButtonLoginGoReset.setObjectName("pushButtonLoginGoReset")
self.checkBox = QtWidgets.QCheckBox(self.frameLogin)
......@@ -58,10 +58,10 @@ class Ui_windowLogin(object):
font.setFamily("Consolas")
self.lineEditLoginPassword.setFont(font)
self.lineEditLoginPassword.setObjectName("lineEditLoginPassword")
self.pushButtonLoginGoRegister = QtWidgets.QPushButton(self.frameLogin)
self.pushButtonLoginGoRegister = NewPushButton(self.frameLogin)
self.pushButtonLoginGoRegister.setGeometry(QtCore.QRect(105, 230, 330, 32))
self.pushButtonLoginGoRegister.setObjectName("pushButtonLoginGoRegister")
self.pushButtonLogin = QtWidgets.QPushButton(self.frameLogin)
self.pushButtonLogin = NewPushButton(self.frameLogin)
self.pushButtonLogin.setGeometry(QtCore.QRect(105, 190, 120, 32))
self.pushButtonLogin.setObjectName("pushButtonLogin")
self.progressBarLogin = QtWidgets.QProgressBar(self.frameLogin)
......@@ -89,7 +89,7 @@ class Ui_windowLogin(object):
font.setFamily("Consolas")
self.lineEditRegisterPassword.setFont(font)
self.lineEditRegisterPassword.setObjectName("lineEditRegisterPassword")
self.pushButtonRegister = QtWidgets.QPushButton(self.frameRegister)
self.pushButtonRegister = NewPushButton(self.frameRegister)
self.pushButtonRegister.setGeometry(QtCore.QRect(105, 190, 120, 32))
self.pushButtonRegister.setObjectName("pushButtonRegister")
self.lineEditRegisterCheckPassword = QtWidgets.QLineEdit(self.frameRegister)
......@@ -130,7 +130,7 @@ class Ui_windowLogin(object):
font.setFamily("Consolas")
self.lineEditRegisterUsername.setFont(font)
self.lineEditRegisterUsername.setObjectName("lineEditRegisterUsername")
self.pushButtonRegisterReturn = QtWidgets.QPushButton(self.frameRegister)
self.pushButtonRegisterReturn = NewPushButton(self.frameRegister)
self.pushButtonRegisterReturn.setGeometry(QtCore.QRect(315, 190, 120, 32))
self.pushButtonRegisterReturn.setObjectName("pushButtonRegisterReturn")
self.frameReset = QtWidgets.QFrame(self.centralwidget)
......@@ -138,7 +138,7 @@ class Ui_windowLogin(object):
self.frameReset.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frameReset.setFrameShadow(QtWidgets.QFrame.Raised)
self.frameReset.setObjectName("frameReset")
self.pushButtonReset = QtWidgets.QPushButton(self.frameReset)
self.pushButtonReset = NewPushButton(self.frameReset)
self.pushButtonReset.setGeometry(QtCore.QRect(105, 190, 120, 32))
self.pushButtonReset.setObjectName("pushButtonReset")
self.label_7 = QtWidgets.QLabel(self.frameReset)
......@@ -185,10 +185,10 @@ class Ui_windowLogin(object):
font.setFamily("Consolas")
self.lineEditResetNewPassword.setFont(font)
self.lineEditResetNewPassword.setObjectName("lineEditResetNewPassword")
self.pushButtonResetAcquire = QtWidgets.QPushButton(self.frameReset)
self.pushButtonResetAcquire = NewPushButton(self.frameReset)
self.pushButtonResetAcquire.setGeometry(QtCore.QRect(349, 69, 112, 32))
self.pushButtonResetAcquire.setObjectName("pushButtonResetAcquire")
self.pushButtonResetReturn = QtWidgets.QPushButton(self.frameReset)
self.pushButtonResetReturn = NewPushButton(self.frameReset)
self.pushButtonResetReturn.setGeometry(QtCore.QRect(315, 190, 120, 32))
self.pushButtonResetReturn.setObjectName("pushButtonResetReturn")
self.frameReset.raise_()
......@@ -243,3 +243,4 @@ class Ui_windowLogin(object):
self.action.setText(_translate("windowLogin", "关于"))
self.actionsd.setText(_translate("windowLogin", "登陆"))
self.action_2.setText(_translate("windowLogin", "关于"))
from codiaclientgui.utils import NewPushButton
......@@ -60,7 +60,7 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="pushButtonLoginGoReset">
<widget class="NewPushButton" name="pushButtonLoginGoReset">
<property name="geometry">
<rect>
<x>315</x>
......@@ -157,7 +157,7 @@
</font>
</property>
</widget>
<widget class="QPushButton" name="pushButtonLoginGoRegister">
<widget class="NewPushButton" name="pushButtonLoginGoRegister">
<property name="geometry">
<rect>
<x>105</x>
......@@ -170,7 +170,7 @@
<string>没有codia账号?点击这里注册</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonLogin">
<widget class="NewPushButton" name="pushButtonLogin">
<property name="geometry">
<rect>
<x>105</x>
......@@ -239,7 +239,7 @@
</font>
</property>
</widget>
<widget class="QPushButton" name="pushButtonRegister">
<widget class="NewPushButton" name="pushButtonRegister">
<property name="geometry">
<rect>
<x>105</x>
......@@ -373,7 +373,7 @@
</font>
</property>
</widget>
<widget class="QPushButton" name="pushButtonRegisterReturn">
<widget class="NewPushButton" name="pushButtonRegisterReturn">
<property name="geometry">
<rect>
<x>315</x>
......@@ -402,7 +402,7 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="pushButtonReset">
<widget class="NewPushButton" name="pushButtonReset">
<property name="geometry">
<rect>
<x>105</x>
......@@ -551,7 +551,7 @@
</font>
</property>
</widget>
<widget class="QPushButton" name="pushButtonResetAcquire">
<widget class="NewPushButton" name="pushButtonResetAcquire">
<property name="geometry">
<rect>
<x>349</x>
......@@ -564,7 +564,7 @@
<string>发送验证码</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonResetReturn">
<widget class="NewPushButton" name="pushButtonResetReturn">
<property name="geometry">
<rect>
<x>315</x>
......@@ -628,6 +628,13 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>NewPushButton</class>
<extends>QPushButton</extends>
<header location="global">codiaclientgui/utils</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
<slots>
......
......@@ -34,13 +34,13 @@ class Ui_windowMain(object):
self.listWidgetPack.setGeometry(QtCore.QRect(28, 30, 1024, 540))
self.listWidgetPack.setMaximumSize(QtCore.QSize(1280, 768))
self.listWidgetPack.setObjectName("listWidgetPack")
self.pushButtonPackOK = QtWidgets.QPushButton(self.framePack)
self.pushButtonPackOK = NewPushButton(self.framePack)
self.pushButtonPackOK.setGeometry(QtCore.QRect(650, 660, 120, 40))
self.pushButtonPackOK.setObjectName("pushButtonPackOK")
self.pushButtonPackNext = QtWidgets.QPushButton(self.framePack)
self.pushButtonPackNext = NewPushButton(self.framePack)
self.pushButtonPackNext.setGeometry(QtCore.QRect(520, 660, 120, 40))
self.pushButtonPackNext.setObjectName("pushButtonPackNext")
self.pushButtonPackPrevious = QtWidgets.QPushButton(self.framePack)
self.pushButtonPackPrevious = NewPushButton(self.framePack)
self.pushButtonPackPrevious.setGeometry(QtCore.QRect(390, 660, 120, 40))
self.pushButtonPackPrevious.setObjectName("pushButtonPackPrevious")
self.labelPackPage = QtWidgets.QLabel(self.framePack)
......@@ -59,16 +59,16 @@ class Ui_windowMain(object):
self.frameExercise.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frameExercise.setFrameShadow(QtWidgets.QFrame.Raised)
self.frameExercise.setObjectName("frameExercise")
self.pushButtonExerciseOK = QtWidgets.QPushButton(self.frameExercise)
self.pushButtonExerciseOK = NewPushButton(self.frameExercise)
self.pushButtonExerciseOK.setGeometry(QtCore.QRect(650, 660, 120, 40))
self.pushButtonExerciseOK.setObjectName("pushButtonExerciseOK")
self.pushButtonExerciseReturn = QtWidgets.QPushButton(self.frameExercise)
self.pushButtonExerciseReturn = NewPushButton(self.frameExercise)
self.pushButtonExerciseReturn.setGeometry(QtCore.QRect(445, 660, 120, 40))
self.pushButtonExerciseReturn.setObjectName("pushButtonExerciseReturn")
self.listWidgetExercise = QtWidgets.QListWidget(self.frameExercise)
self.listWidgetExercise.setGeometry(QtCore.QRect(28, 30, 1024, 540))
self.listWidgetExercise.setObjectName("listWidgetExercise")
self.pushButtonExerciseBegin = QtWidgets.QPushButton(self.frameExercise)
self.pushButtonExerciseBegin = NewPushButton(self.frameExercise)
self.pushButtonExerciseBegin.setGeometry(QtCore.QRect(50, 660, 120, 40))
self.pushButtonExerciseBegin.setObjectName("pushButtonExerciseBegin")
self.labelDeadline = QtWidgets.QLabel(self.frameExercise)
......@@ -106,3 +106,4 @@ class Ui_windowMain(object):
self.pushButtonExerciseReturn.setText(_translate("windowMain", "返回"))
self.pushButtonExerciseBegin.setText(_translate("windowMain", "开始题包"))
self.labelDeadline.setText(_translate("windowMain", "截止日期:无限制"))
from codiaclientgui.utils import NewPushButton
......@@ -76,7 +76,7 @@
</size>
</property>
</widget>
<widget class="QPushButton" name="pushButtonPackOK">
<widget class="NewPushButton" name="pushButtonPackOK">
<property name="geometry">
<rect>
<x>650</x>
......@@ -89,7 +89,7 @@
<string>确认</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonPackNext">
<widget class="NewPushButton" name="pushButtonPackNext">
<property name="geometry">
<rect>
<x>520</x>
......@@ -102,7 +102,7 @@
<string>下一页</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonPackPrevious">
<widget class="NewPushButton" name="pushButtonPackPrevious">
<property name="geometry">
<rect>
<x>390</x>
......@@ -175,7 +175,7 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="pushButtonExerciseOK">
<widget class="NewPushButton" name="pushButtonExerciseOK">
<property name="geometry">
<rect>
<x>650</x>
......@@ -188,7 +188,7 @@
<string>确认</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonExerciseReturn">
<widget class="NewPushButton" name="pushButtonExerciseReturn">
<property name="geometry">
<rect>
<x>445</x>
......@@ -211,7 +211,7 @@
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButtonExerciseBegin">
<widget class="NewPushButton" name="pushButtonExerciseBegin">
<property name="geometry">
<rect>
<x>50</x>
......@@ -275,6 +275,13 @@
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>NewPushButton</class>
<extends>QPushButton</extends>
<header location="global">codiaclientgui/utils</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment