Add scanning animation effect

This commit is contained in:
zhaoyafan 2025-04-12 09:48:26 +08:00
parent ecc18d0754
commit e4d2f4863b
1 changed files with 8 additions and 5 deletions

View File

@ -452,10 +452,13 @@ class MainWindow(QMainWindow):
palette = self.labels_status.palette()
if status == 'wait':
palette.setColor(QPalette.WindowText, Qt.white)
palette.setColor(QPalette.Window, QColor(100, 100, 100))
palette.setColor(QPalette.Window, QColor(80, 80, 80))
self.labels_status.setPalette(palette)
if status == 'pass':
palette.setColor(QPalette.WindowText, Qt.black)
palette.setColor(QPalette.Window, QColor(0, 255, 0))
palette.setColor(QPalette.WindowText, Qt.white)
palette.setColor(QPalette.Window, QColor(101, 200, 68))
self.labels_status.setPalette(palette)
QTimer.singleShot(500, lambda: [palette.setColor(QPalette.Window, QColor(80, 80, 80)), self.labels_status.setPalette(palette)][0])
self.inputs_scan.setStyleSheet("""
QLineEdit {
background: #2a2a2a;
@ -467,9 +470,9 @@ class MainWindow(QMainWindow):
""")
if status == 'fail':
palette.setColor(QPalette.WindowText, Qt.white)
palette.setColor(QPalette.Window, QColor(255, 0, 0))
self.inputs_scan.setStyleSheet('border: 2px solid red;')
palette.setColor(QPalette.Window, QColor(222, 61, 66))
self.labels_status.setPalette(palette)
self.inputs_scan.setStyleSheet('border: 2px solid red;')
self.labels_status.setText(message if message else '')
def set_operators(self, data):