Commit e412940f authored by Zheng Yile's avatar Zheng Yile
Browse files

Modify codiaclientgui/utils.py, loginWindow.py, loginWindow.ui, mainWindow.py, mainWindow.ui

parent de8a93af
......@@ -18,6 +18,58 @@ Style = {
"progressBar": "",
}
class _NewPushButton(QLabel):
clicked = pyqtSignal()
nowColor = QColor(241, 242, 243)
def setColor(self, col):
palette = self.palette()
palette.setBrush(QPalette.Active, QPalette.Background, QBrush(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 #717273; border-radius: 5px } _NewPushButton:hover { border: 1px solid blue } NewPushButton:disabled { background-color: #f1f2f3 }")
self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
def enterEvent(self, e):
# print("enterEvent")
if not self.isEnabled(): return
self.setAutoFillBackground(True)
self.enterAnime = QPropertyAnimation(self, b"color")
self.enterAnime.setDuration(400)
self.enterAnime.setStartValue(self.nowColor)
self.enterAnime.setEndValue(QColor(227, 240, 255))
self.enterAnime.setEasingCurve(QEasingCurve.OutCubic)
self.enterAnime.start()
def leaveEvent(self, e):
# print("leaveEvent")
if not self.isEnabled(): return
self.setAutoFillBackground(True)
self.leaveAnime = QPropertyAnimation(self, b"color")
self.leaveAnime.setDuration(400)
self.leaveAnime.setStartValue(self.nowColor)
self.leaveAnime.setEndValue(QColor(241, 242, 243))
self.leaveAnime.setEasingCurve(QEasingCurve.OutCubic)
self.leaveAnime.start()
def mouseReleaseEvent(self, e):
# print("mouseReleaseEvent")
if 0 <= e.x() <= self.width() and 0 <= e.y() <= self.height():
self.clicked.emit()
self.enterEvent(e)
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()
import sys
if sys.platform == 'win32':
Font['main'].setFamily("Microsoft YaHei")
......@@ -25,11 +77,13 @@ if sys.platform == 'win32':
Font['status'].setFamily("KaiTi")
Font['status'].setPointSize(10)
Style['progressBar'] = "QProgressBar { border: 1px solid grey; border-radius: 2px; text-align: center; background-color: #FFFFFF;}QProgressBar::chunk { background-color: #30A132; width: 10px;}"
NewPushButton = _NewPushButton
elif sys.platform == 'darwin':
Font['main'].setFamily(".AppleSystemUIFont")
Font['main'].setPointSize(13)
Font['status'].setFamily(".AppleSystemUIFont")
Font['status'].setPointSize(13)
NewPushButton = QPushButton
else:
Font['main'].setFamily("Microsoft YaHei")
Font['main'].setPointSize(13)
......@@ -63,67 +117,3 @@ 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.setFrameShadow(QFrame.Raised)
# self.setFrameShape(QFrame.StyledPanel)
self.setStyleSheet("NewPushButton { border: 1px solid gray; border-radius: 5px } NewPushButton::hover { border: 1px solid blue }")
self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.mouseHovered.connect(self.hoveredAnimeStart)
self.mouseLeft.connect(self.leftAnimeStart)
def hoveredAnimeStart(self):
if not self.isEnabled(): return
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):
if not self.isEnabled(): return
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()
......@@ -163,10 +163,12 @@ class Ui_windowLogin(object):
self.label_9.setIndent(10)
self.label_9.setObjectName("label_9")
self.lineEditResetCheckNum = QtWidgets.QLineEdit(self.frameReset)
self.lineEditResetCheckNum.setGeometry(QtCore.QRect(220, 70, 130, 30))
self.lineEditResetCheckNum.setGeometry(QtCore.QRect(220, 70, 100, 30))
font = QtGui.QFont()
font.setFamily("Consolas")
self.lineEditResetCheckNum.setFont(font)
self.lineEditResetCheckNum.setMaxLength(6)
self.lineEditResetCheckNum.setAlignment(QtCore.Qt.AlignCenter)
self.lineEditResetCheckNum.setObjectName("lineEditResetCheckNum")
self.lineEditResetAccount = QtWidgets.QLineEdit(self.frameReset)
self.lineEditResetAccount.setGeometry(QtCore.QRect(220, 30, 240, 30))
......@@ -186,14 +188,14 @@ class Ui_windowLogin(object):
self.lineEditResetNewPassword.setFont(font)
self.lineEditResetNewPassword.setObjectName("lineEditResetNewPassword")
self.pushButtonResetAcquire = NewPushButton(self.frameReset)
self.pushButtonResetAcquire.setGeometry(QtCore.QRect(349, 69, 112, 32))
self.pushButtonResetAcquire.setGeometry(QtCore.QRect(350, 70, 110, 30))
self.pushButtonResetAcquire.setObjectName("pushButtonResetAcquire")
self.pushButtonResetReturn = NewPushButton(self.frameReset)
self.pushButtonResetReturn.setGeometry(QtCore.QRect(315, 190, 120, 32))
self.pushButtonResetReturn.setObjectName("pushButtonResetReturn")
self.frameLogin.raise_()
self.frameReset.raise_()
self.frameRegister.raise_()
self.frameLogin.raise_()
windowLogin.setCentralWidget(self.centralwidget)
self.menuBar = QtWidgets.QMenuBar(windowLogin)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 540, 26))
......
......@@ -492,7 +492,7 @@
<rect>
<x>220</x>
<y>70</y>
<width>130</width>
<width>100</width>
<height>30</height>
</rect>
</property>
......@@ -501,6 +501,12 @@
<family>Consolas</family>
</font>
</property>
<property name="maxLength">
<number>6</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="lineEditResetAccount">
<property name="geometry">
......@@ -554,10 +560,10 @@
<widget class="NewPushButton" name="pushButtonResetAcquire">
<property name="geometry">
<rect>
<x>349</x>
<y>69</y>
<width>112</width>
<height>32</height>
<x>350</x>
<y>70</y>
<width>110</width>
<height>30</height>
</rect>
</property>
<property name="text">
......@@ -578,9 +584,9 @@
</property>
</widget>
</widget>
<zorder>frameLogin</zorder>
<zorder>frameReset</zorder>
<zorder>frameRegister</zorder>
<zorder>frameLogin</zorder>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
......
......@@ -35,16 +35,16 @@ class Ui_windowMain(object):
self.listWidgetPack.setMaximumSize(QtCore.QSize(1280, 768))
self.listWidgetPack.setObjectName("listWidgetPack")
self.pushButtonPackOK = NewPushButton(self.framePack)
self.pushButtonPackOK.setGeometry(QtCore.QRect(650, 660, 120, 40))
self.pushButtonPackOK.setGeometry(QtCore.QRect(250, 660, 120, 32))
self.pushButtonPackOK.setObjectName("pushButtonPackOK")
self.pushButtonPackNext = NewPushButton(self.framePack)
self.pushButtonPackNext.setGeometry(QtCore.QRect(520, 660, 120, 40))
self.pushButtonPackNext.setGeometry(QtCore.QRect(930, 660, 120, 32))
self.pushButtonPackNext.setObjectName("pushButtonPackNext")
self.pushButtonPackPrevious = NewPushButton(self.framePack)
self.pushButtonPackPrevious.setGeometry(QtCore.QRect(390, 660, 120, 40))
self.pushButtonPackPrevious.setGeometry(QtCore.QRect(770, 660, 120, 32))
self.pushButtonPackPrevious.setObjectName("pushButtonPackPrevious")
self.labelPackPage = QtWidgets.QLabel(self.framePack)
self.labelPackPage.setGeometry(QtCore.QRect(50, 660, 120, 40))
self.labelPackPage.setGeometry(QtCore.QRect(50, 660, 120, 32))
self.labelPackPage.setAlignment(QtCore.Qt.AlignCenter)
self.labelPackPage.setObjectName("labelPackPage")
self.progressBarPack = QtWidgets.QProgressBar(self.framePack)
......@@ -60,19 +60,19 @@ class Ui_windowMain(object):
self.frameExercise.setFrameShadow(QtWidgets.QFrame.Raised)
self.frameExercise.setObjectName("frameExercise")
self.pushButtonExerciseOK = NewPushButton(self.frameExercise)
self.pushButtonExerciseOK.setGeometry(QtCore.QRect(650, 660, 120, 40))
self.pushButtonExerciseOK.setGeometry(QtCore.QRect(250, 660, 120, 32))
self.pushButtonExerciseOK.setObjectName("pushButtonExerciseOK")
self.pushButtonExerciseReturn = NewPushButton(self.frameExercise)
self.pushButtonExerciseReturn.setGeometry(QtCore.QRect(445, 660, 120, 40))
self.pushButtonExerciseReturn.setGeometry(QtCore.QRect(410, 660, 120, 32))
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 = NewPushButton(self.frameExercise)
self.pushButtonExerciseBegin.setGeometry(QtCore.QRect(50, 660, 120, 40))
self.pushButtonExerciseBegin.setGeometry(QtCore.QRect(50, 660, 120, 32))
self.pushButtonExerciseBegin.setObjectName("pushButtonExerciseBegin")
self.labelDeadline = QtWidgets.QLabel(self.frameExercise)
self.labelDeadline.setGeometry(QtCore.QRect(780, 660, 280, 40))
self.labelDeadline.setGeometry(QtCore.QRect(770, 660, 280, 32))
self.labelDeadline.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.labelDeadline.setIndent(10)
self.labelDeadline.setObjectName("labelDeadline")
......@@ -81,8 +81,6 @@ class Ui_windowMain(object):
self.progressBarExercise.setProperty("value", 20)
self.progressBarExercise.setTextVisible(False)
self.progressBarExercise.setObjectName("progressBarExercise")
self.frameExercise.raise_()
self.framePack.raise_()
windowMain.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(windowMain)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1080, 26))
......
......@@ -79,10 +79,10 @@
<widget class="NewPushButton" name="pushButtonPackOK">
<property name="geometry">
<rect>
<x>650</x>
<x>250</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -92,10 +92,10 @@
<widget class="NewPushButton" name="pushButtonPackNext">
<property name="geometry">
<rect>
<x>520</x>
<x>930</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -105,10 +105,10 @@
<widget class="NewPushButton" name="pushButtonPackPrevious">
<property name="geometry">
<rect>
<x>390</x>
<x>770</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -121,7 +121,7 @@
<x>50</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -178,10 +178,10 @@
<widget class="NewPushButton" name="pushButtonExerciseOK">
<property name="geometry">
<rect>
<x>650</x>
<x>250</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -191,10 +191,10 @@
<widget class="NewPushButton" name="pushButtonExerciseReturn">
<property name="geometry">
<rect>
<x>445</x>
<x>410</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -217,7 +217,7 @@
<x>50</x>
<y>660</y>
<width>120</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -227,10 +227,10 @@
<widget class="QLabel" name="labelDeadline">
<property name="geometry">
<rect>
<x>780</x>
<x>770</x>
<y>660</y>
<width>280</width>
<height>40</height>
<height>32</height>
</rect>
</property>
<property name="text">
......@@ -260,8 +260,6 @@
</property>
</widget>
</widget>
<zorder>frameExercise</zorder>
<zorder>framePack</zorder>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
......
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