node.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import sys
  2. from PyQt5.QtCore import QSize, QTimer
  3. from PyQt5.QtGui import QFont, QBrush, QColor, QPixmap
  4. from PyQt5.QtWidgets import QApplication, QMainWindow, QListWidgetItem
  5. from ui.ui import Ui_MainWindow
  6. from db_helper.db_operation import DBOperation
  7. class MainWindow(QMainWindow, Ui_MainWindow):
  8. def __init__(self, parent=None):
  9. super(MainWindow, self).__init__(parent)
  10. self.setupUi(self)
  11. self.A_listWidget.setGridSize(QSize(335, 60))
  12. self.A_listWidget.setStyleSheet("border:5px solid #014F84;")
  13. self.C_listWidget.setGridSize(QSize(335, 60))
  14. self.C_listWidget.setStyleSheet("border:5px solid #014F84;")
  15. self.image_label.setPixmap(QPixmap('log.jpg'))
  16. self.image_label.setScaledContents(True)
  17. self.image_label.setMaximumHeight(140)
  18. self.image_label.setMaximumWidth(600)
  19. self.timer = QTimer()
  20. self.timer.timeout.connect(self.Switch)
  21. self.timer.start(200)
  22. self.pick_command_dict = {1: [], 2: [], 3: []}
  23. def closeEvent(self, event):
  24. event.accept() # 接受关闭事件
  25. def get_listWidget_item(self, dict):
  26. item = QListWidgetItem()
  27. item.setFont(QFont('微软雅黑', 20, QFont.Bold))
  28. show_str = ""
  29. if (dict["statu"] == 0): # 排队
  30. item.setForeground(QColor(80, 80, 80))
  31. show_str = dict["car_number"] + " 排队中,请稍等片刻"
  32. elif (dict["statu"] == 1): # 工作
  33. item.setForeground(QColor('blue'))
  34. show_str = dict["car_number"] + " 取车中,等待取车结束"
  35. elif (dict["statu"] == 2): # 已完成
  36. item.setForeground(QColor('green'))
  37. show_str = dict["car_number"] + " 已完成,请到 %d 号出口取车" % (dict["export_id"])
  38. item.setText(show_str)
  39. return item
  40. def Switch(self):
  41. pass
  42. if __name__ == '__main__':
  43. app = QApplication(sys.argv)
  44. window = MainWindow()
  45. window.showMaximized()
  46. sys.exit(app.exec_())