statusbar.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @文件 :statusbar.py
  5. @时间 :2022/01/22 09:55:34
  6. @作者 :None
  7. @版本 :1.0
  8. @说明 :状态栏页面
  9. '''
  10. from utils.qt import QStatusBar, QLabel, QFrame, QMetaObject, QCoreApplication
  11. class UiStatusBar(object):
  12. def setupUi(self, pcs_status):
  13. self.statusbar = QStatusBar()
  14. # pcs连接状态
  15. self.label_pcs_connect = QLabel()
  16. self.label_pcs_connect.setFrameStyle(QFrame.Panel | QFrame.Raised)
  17. self.label_pcs_connect.setLineWidth(3)
  18. self.label_pcs_connect.setMidLineWidth(3)
  19. # pcs发送状态
  20. self.label_pcs_send = QLabel()
  21. self.label_pcs_send.setFrameStyle(QFrame.Panel | QFrame.Raised)
  22. self.label_pcs_send.setLineWidth(3)
  23. self.label_pcs_send.setMidLineWidth(3)
  24. # pcs发送状态
  25. self.label_pcs_received = QLabel()
  26. self.label_pcs_received.setFrameStyle(QFrame.Panel | QFrame.Raised)
  27. self.label_pcs_received.setLineWidth(3)
  28. self.label_pcs_received.setMidLineWidth(3)
  29. # pcs软件版本号
  30. self.label_pcs_version = QLabel()
  31. self.label_pcs_version.setFrameStyle(QFrame.Panel | QFrame.Raised)
  32. self.label_pcs_version.setLineWidth(3)
  33. self.label_pcs_version.setMidLineWidth(3)
  34. # 往状态栏中添加组件(stretch应该是拉伸组件宽度)
  35. self.statusbar.addWidget(self.label_pcs_connect, stretch=0)
  36. self.statusbar.addWidget(self.label_pcs_send, stretch=0)
  37. self.statusbar.addWidget(self.label_pcs_received, stretch=0)
  38. self.statusbar.addPermanentWidget(self.label_pcs_version, stretch=0)
  39. self.statusbar.setSizeGripEnabled(False)
  40. self.retranslateUi(pcs_status)
  41. QMetaObject.connectSlotsByName(pcs_status)
  42. def retranslateUi(self, pcs_status):
  43. _translate = QCoreApplication.translate
  44. self.label_pcs_connect.setText(_translate("pcs_status", "未连接"))
  45. self.label_pcs_send.setText(_translate("pcs_status", "发送未启动"))
  46. self.label_pcs_received.setText(_translate("pcs_status", "接收未启动"))