bms_status_bar.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. from ui.own.frame_theme import MyFrame
  4. from ui.statusbar import UiStatusBar
  5. from utils.globalvar import SD
  6. from utils.qt import QMessageBox, QFileDialog, QTimer, QDateTime
  7. class Win_Bms_Status_Bar(UiStatusBar, MyFrame):
  8. def __init__(self, parent=None):
  9. super(Win_Bms_Status_Bar, self).__init__(parent)
  10. self.setupUi(self)
  11. self.lb_bms_version.setText("V" + ''.join((str(SD.MAJOR_VERSION_NUMBER), '.', str(SD.MINOR_VERSION_NUMBER))))
  12. self.timer = QTimer()
  13. self.timer.timeout.connect(self._show_local_data_time)
  14. self.timer.start(1000)
  15. self._show_local_data_time()
  16. def _show_local_data_time(self):
  17. text = QDateTime.currentDateTime().toString("yyyy-MM-dd HH:mm:ss")
  18. self.lb_local_time.setText(text)
  19. def bms_error(self):
  20. QMessageBox.warning(self, "警告" if SD.SYSTEM_LANGUAGE == 0 else "Warning", "请连接BMS!" if SD.SYSTEM_LANGUAGE == 0 else "No BMS!")
  21. def h86_error(self):
  22. QMessageBox.critical(self, "错误" if SD.SYSTEM_LANGUAGE == 0 else "Error", "不是标准的h86文件!" if SD.SYSTEM_LANGUAGE == 0 else "H86 Error!")
  23. def hex_error(self):
  24. QMessageBox.critical(self, "错误" if SD.SYSTEM_LANGUAGE == 0 else "Error", "不是标准的hex文件!" if SD.SYSTEM_LANGUAGE == 0 else "Hex Error!")
  25. def s19_error(self):
  26. QMessageBox.critical(self, "错误" if SD.SYSTEM_LANGUAGE == 0 else "Error", "不是标准的s19文件!" if SD.SYSTEM_LANGUAGE == 0 else "S19 Error!")
  27. def bmu_can_file(self):
  28. return QFileDialog.getOpenFileName(self, "选取文件" if SD.SYSTEM_LANGUAGE == 0 else "Chose File", SD.FILE_PATH, "Text Files (*.hex)")
  29. def ccu_can_file(self):
  30. return QFileDialog.getOpenFileName(self, "选取文件" if SD.SYSTEM_LANGUAGE == 0 else "Chose File", SD.FILE_PATH, "Text Files (*.h86 , *.hex , *.s19)")
  31. def bams_can_file(self):
  32. return QFileDialog.getOpenFileName(self, "选取文件" if SD.SYSTEM_LANGUAGE == 0 else "Chose File", SD.FILE_PATH, "Text Files (*.hex)")
  33. def bams_net_file(self):
  34. return QFileDialog.getOpenFileName(self, "选取文件" if SD.SYSTEM_LANGUAGE == 0 else "Chose File", SD.FILE_PATH, "Text Files (*.bin)")