import sys from PyQt5.QtCore import QSize, QTimer from PyQt5.QtGui import QFont, QBrush, QColor, QPixmap from PyQt5.QtWidgets import QApplication, QMainWindow, QListWidgetItem from ui.ui import Ui_MainWindow from db_helper.db_operation import DBOperation class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.A_listWidget.setGridSize(QSize(335, 60)) self.A_listWidget.setStyleSheet("border:5px solid #014F84;") self.C_listWidget.setGridSize(QSize(335, 60)) self.C_listWidget.setStyleSheet("border:5px solid #014F84;") self.image_label.setPixmap(QPixmap('log.jpg')) self.image_label.setScaledContents(True) self.image_label.setMaximumHeight(140) self.image_label.setMaximumWidth(600) self.timer = QTimer() self.timer.timeout.connect(self.Switch) self.timer.start(200) self.pick_command_dict = {1: [], 2: [], 3: []} def closeEvent(self, event): event.accept() # 接受关闭事件 def get_listWidget_item(self, dict): item = QListWidgetItem() item.setFont(QFont('微软雅黑', 20, QFont.Bold)) show_str = "" if (dict["statu"] == 0): # 排队 item.setForeground(QColor(80, 80, 80)) show_str = dict["car_number"] + " 排队中,请稍等片刻" elif (dict["statu"] == 1): # 工作 item.setForeground(QColor('blue')) show_str = dict["car_number"] + " 取车中,等待取车结束" elif (dict["statu"] == 2): # 已完成 item.setForeground(QColor('green')) show_str = dict["car_number"] + " 已完成,请到 %d 号出口取车" % (dict["export_id"]) item.setText(show_str) return item def Switch(self): pass if __name__ == '__main__': app = QApplication(sys.argv) window = MainWindow() window.showMaximized() sys.exit(app.exec_())