|
@@ -1,122 +1,94 @@
|
|
|
-
|
|
|
-
|
|
|
-'''
|
|
|
-@Contact : liuyuqi.gov@msn.cn
|
|
|
-@Time : 2022/06/29 12:42:58
|
|
|
-@License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
|
|
|
-@Desc : main ui
|
|
|
-'''
|
|
|
-
|
|
|
-from PyQt5.QtWidgets import QApplication, QMainWindow, QGraphicsDropShadowEffect, QListWidgetItem, QListView, QWidget, \
|
|
|
- QLabel, QHBoxLayout, QFileDialog
|
|
|
-from PyQt5.QtCore import Qt, QPropertyAnimation, QEasingCurve, QThread, pyqtSignal, QMutex, QSize, QEvent, QPoint
|
|
|
-from PyQt5.QtGui import QMouseEvent, QCursor, QColor
|
|
|
-from PyQt5.uic import loadUi
|
|
|
-
|
|
|
-class Window(QMainWindow):
|
|
|
- '''主窗体'''
|
|
|
-
|
|
|
- def mousePressEvent(self, event):
|
|
|
-
|
|
|
- if event.button() == Qt.LeftButton:
|
|
|
- self.m_drag = True
|
|
|
- self.m_DragPosition = event.globalPos() - self.pos()
|
|
|
- event.accept()
|
|
|
-
|
|
|
- def mouseMoveEvent(self, QMouseEvent):
|
|
|
- try:
|
|
|
- if Qt.LeftButton and self.m_drag:
|
|
|
- self.move(QMouseEvent.globalPos() - self.m_DragPosition)
|
|
|
- QMouseEvent.accept()
|
|
|
- except:
|
|
|
- pass
|
|
|
-
|
|
|
- def mouseReleaseEvent(self, QMouseEvent):
|
|
|
- self.m_drag = False
|
|
|
-
|
|
|
- def _frame(self):
|
|
|
-
|
|
|
- self.setWindowFlags(Qt.FramelessWindowHint)
|
|
|
- self.setAttribute(Qt.WA_TranslucentBackground, True)
|
|
|
-
|
|
|
- effect = QGraphicsDropShadowEffect(blurRadius=12, xOffset=0, yOffset=0)
|
|
|
- effect.setColor(QColor(25, 25, 25, 170))
|
|
|
-
|
|
|
-
|
|
|
- def doFadeIn(self):
|
|
|
-
|
|
|
- self.animation = QPropertyAnimation(self, b'windowOpacity')
|
|
|
-
|
|
|
- self.animation.setDuration(250)
|
|
|
- try:
|
|
|
-
|
|
|
- self.animation.finished.disconnect(self.close)
|
|
|
- except:
|
|
|
- pass
|
|
|
- self.animation.stop()
|
|
|
-
|
|
|
- self.animation.setEasingCurve(QEasingCurve.InOutCubic)
|
|
|
- self.animation.setStartValue(0)
|
|
|
- self.animation.setEndValue(1)
|
|
|
- self.animation.start()
|
|
|
-
|
|
|
- def doFadeOut(self):
|
|
|
- self.animation.stop()
|
|
|
-
|
|
|
- self.animation.finished.connect(self.close)
|
|
|
-
|
|
|
- self.animation.setEasingCurve(QEasingCurve.InOutCubic)
|
|
|
- self.animation.setStartValue(1)
|
|
|
- self.animation.setEndValue(0)
|
|
|
- self.animation.start()
|
|
|
-
|
|
|
- def setWarninginfo(self, text):
|
|
|
- self.lab_info.setStyleSheet("""
|
|
|
- .QLabel {
|
|
|
- border:1px solid
|
|
|
- border-radius:3px;
|
|
|
- line-height: 140px;
|
|
|
- padding: 5px;
|
|
|
- color:
|
|
|
- background:
|
|
|
- }
|
|
|
- """)
|
|
|
- self.lab_info.setText(text)
|
|
|
-
|
|
|
- def setSuccessinfo(self, text):
|
|
|
- self.lab_info.setStyleSheet("""
|
|
|
- .QLabel {
|
|
|
- border:1px solid
|
|
|
- border-radius:3px;
|
|
|
- line-height: 140px;
|
|
|
- padding: 5px;
|
|
|
- color:
|
|
|
- background:
|
|
|
- }
|
|
|
- """)
|
|
|
- self.lab_info.setText(text)
|
|
|
-
|
|
|
-class ConfigureWindow(Window):
|
|
|
- '''配置弹框'''
|
|
|
- config = {}
|
|
|
- def __init__(self):
|
|
|
- super().__init__()
|
|
|
- loadUi("./conf/main.ui", self)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- self.config_exists = True
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- self.show()
|
|
|
-
|
|
|
- def saveConf(self):
|
|
|
- self.updateConfig()
|
|
|
- self.doFadeOut()
|
|
|
-
|
|
|
- def updateConfig():
|
|
|
- pass
|
|
|
+
|
|
|
+
|
|
|
+'''
|
|
|
+@Contact : liuyuqi.gov@msn.cn
|
|
|
+@Time : 2023/03/16 01:29:59
|
|
|
+@License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
|
|
|
+@Desc : base windows
|
|
|
+'''
|
|
|
+from PyQt5.QtWidgets import QMainWindow, QGraphicsDropShadowEffect
|
|
|
+from PyQt5.QtCore import Qt, QPropertyAnimation, QEasingCurve
|
|
|
+from PyQt5.QtGui import QColor
|
|
|
+
|
|
|
+class BaseWindow(QMainWindow):
|
|
|
+ '''主窗体'''
|
|
|
+
|
|
|
+ def mousePressEvent(self, event):
|
|
|
+
|
|
|
+ if event.button() == Qt.LeftButton:
|
|
|
+ self.m_drag = True
|
|
|
+ self.m_DragPosition = event.globalPos() - self.pos()
|
|
|
+ event.accept()
|
|
|
+
|
|
|
+ def mouseMoveEvent(self, QMouseEvent):
|
|
|
+ try:
|
|
|
+ if Qt.LeftButton and self.m_drag:
|
|
|
+ self.move(QMouseEvent.globalPos() - self.m_DragPosition)
|
|
|
+ QMouseEvent.accept()
|
|
|
+ except:
|
|
|
+ pass
|
|
|
+
|
|
|
+ def mouseReleaseEvent(self, QMouseEvent):
|
|
|
+ self.m_drag = False
|
|
|
+
|
|
|
+ def _frame(self):
|
|
|
+
|
|
|
+ self.setWindowFlags(Qt.FramelessWindowHint)
|
|
|
+ self.setAttribute(Qt.WA_TranslucentBackground, True)
|
|
|
+
|
|
|
+ effect = QGraphicsDropShadowEffect(blurRadius=12, xOffset=0, yOffset=0)
|
|
|
+ effect.setColor(QColor(25, 25, 25, 170))
|
|
|
+
|
|
|
+
|
|
|
+ def doFadeIn(self):
|
|
|
+
|
|
|
+ self.animation = QPropertyAnimation(self, b'windowOpacity')
|
|
|
+
|
|
|
+ self.animation.setDuration(250)
|
|
|
+ try:
|
|
|
+
|
|
|
+ self.animation.finished.disconnect(self.close)
|
|
|
+ except:
|
|
|
+ pass
|
|
|
+ self.animation.stop()
|
|
|
+
|
|
|
+ self.animation.setEasingCurve(QEasingCurve.InOutCubic)
|
|
|
+ self.animation.setStartValue(0)
|
|
|
+ self.animation.setEndValue(1)
|
|
|
+ self.animation.start()
|
|
|
+
|
|
|
+ def doFadeOut(self):
|
|
|
+ self.animation.stop()
|
|
|
+
|
|
|
+ self.animation.finished.connect(self.close)
|
|
|
+
|
|
|
+ self.animation.setEasingCurve(QEasingCurve.InOutCubic)
|
|
|
+ self.animation.setStartValue(1)
|
|
|
+ self.animation.setEndValue(0)
|
|
|
+ self.animation.start()
|
|
|
+
|
|
|
+ def setWarninginfo(self, text):
|
|
|
+ self.lab_info.setStyleSheet("""
|
|
|
+ .QLabel {
|
|
|
+ border:1px solid
|
|
|
+ border-radius:3px;
|
|
|
+ line-height: 140px;
|
|
|
+ padding: 5px;
|
|
|
+ color:
|
|
|
+ background:
|
|
|
+ }
|
|
|
+ """)
|
|
|
+ self.lab_info.setText(text)
|
|
|
+
|
|
|
+ def setSuccessinfo(self, text):
|
|
|
+ self.lab_info.setStyleSheet("""
|
|
|
+ .QLabel {
|
|
|
+ border:1px solid
|
|
|
+ border-radius:3px;
|
|
|
+ line-height: 140px;
|
|
|
+ padding: 5px;
|
|
|
+ color:
|
|
|
+ background:
|
|
|
+ }
|
|
|
+ """)
|
|
|
+ self.lab_info.setText(text)
|