bms_main.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. from ui.main.main import Main
  4. from ui.own.frame_theme import MyFrame
  5. from utils.globalvar import SD
  6. from utils.qt import QMessageBox, Signal
  7. class Win_Main(Main, MyFrame):
  8. up_signal = Signal()
  9. down_signal = Signal()
  10. controll_signal = Signal(int)
  11. do1_signal = Signal(int)
  12. do2_signal = Signal(int)
  13. do3_signal = Signal(int)
  14. do4_signal = Signal(int)
  15. do5_signal = Signal(int)
  16. do6_signal = Signal(int)
  17. do7_signal = Signal(int)
  18. do8_signal = Signal(int)
  19. fault_release_signal = Signal(int)
  20. jy_signal = Signal(int)
  21. jy_one_signal = Signal(int)
  22. chg_mos_signal = Signal(int)
  23. dchg_mos_signal = Signal(int)
  24. pre_mos_signal = Signal(int)
  25. gjd1_signal = Signal(int)
  26. gjd2_signal = Signal(int)
  27. chg_signal = Signal(int)
  28. sleep_signal = Signal(int)
  29. reset_signal = Signal(int)
  30. clear_balance_signal = Signal(int)
  31. fan_signal = Signal(int)
  32. def __init__(self, parent=None):
  33. super(Win_Main, self).__init__(parent)
  34. self.setupUi(self)
  35. self.under_widget.btn_up.clicked.connect(self._sys_up)
  36. self.under_widget.btn_down.clicked.connect(self._sys_down)
  37. self.under_widget.snkz_check_box.stateChanged.connect(self._controll_sys)
  38. self.under_widget.p_check_box.stateChanged.connect(self._do1)
  39. self.under_widget.n_check_box.stateChanged.connect(self._do2)
  40. self.under_widget.pre_check_box.stateChanged.connect(self._do3)
  41. self.under_widget.center_check_box.stateChanged.connect(self._do4)
  42. self.under_widget.dlq_check_box.stateChanged.connect(self._do5)
  43. self.under_widget.do6_check_box.stateChanged.connect(self._do6)
  44. self.under_widget.do7_check_box.stateChanged.connect(self._do7)
  45. self.under_widget.do8_check_box.stateChanged.connect(self._do8)
  46. self.under_widget.fault_check_box.stateChanged.connect(self._fault)
  47. self.under_widget.again_check_box.stateChanged.connect(self._against)
  48. self.under_widget.again_one_check_box.stateChanged.connect(self._again_one)
  49. self.under_widget.chg_check_box.stateChanged.connect(self._chg)
  50. self.under_widget.dchg_check_box.stateChanged.connect(self._dchg)
  51. self.under_widget.pre_check_box.stateChanged.connect(self._pre)
  52. self.under_widget.gjd1_check_box.stateChanged.connect(self._gjd1)
  53. self.under_widget.gjd2_check_box.stateChanged.connect(self._gjd2)
  54. self.under_widget.qiangzhi_chg_check_box.stateChanged.connect(self._qiangzhi_chg)
  55. self.under_widget.sleep_check_box.stateChanged.connect(self._sleep)
  56. self.under_widget.reset_check_box.stateChanged.connect(self._reset)
  57. self.under_widget.clear_balance_check_box.stateChanged.connect(self._clear)
  58. self.under_widget.fan_check_box.stateChanged.connect(self._fan)
  59. def _sys_up(self):
  60. self.up_signal.emit()
  61. def _sys_down(self):
  62. self.down_signal.emit()
  63. def _controll_sys(self, data):
  64. self.controll_signal.emit(data)
  65. def _do1(self, data):
  66. self.do1_signal.emit(data)
  67. def _do2(self, data):
  68. self.do2_signal.emit(data)
  69. def _do3(self, data):
  70. self.do3_signal.emit(data)
  71. def _do4(self, data):
  72. self.do4_signal.emit(data)
  73. def _do5(self, data):
  74. self.do5_signal.emit(data)
  75. def _do6(self, data):
  76. self.do6_signal.emit(data)
  77. def _do7(self, data):
  78. self.do7_signal.emit(data)
  79. def _do8(self, data):
  80. self.do8_signal.emit(data)
  81. def _fault(self, data):
  82. self.fault_release_signal.emit(data)
  83. def _against(self, data):
  84. self.jy_signal.emit(data)
  85. def _again_one(self, data):
  86. self.jy_one_signal.emit(data)
  87. def _chg(self, data):
  88. self.chg_mos_signal.emit(data)
  89. def _dchg(self, data):
  90. self.dchg_mos_signal.emit(data)
  91. def _pre(self, data):
  92. self.pre_mos_signal.emit(data)
  93. def _gjd1(self, data):
  94. self.gjd1_signal.emit(data)
  95. def _gjd2(self, data):
  96. self.gjd2_signal.emit(data)
  97. def _qiangzhi_chg(self, data):
  98. self.chg_signal.emit(data)
  99. def _sleep(self, data):
  100. self.sleep_signal.emit(data)
  101. def _reset(self, data):
  102. self.reset_signal.emit(data)
  103. def _clear(self, data):
  104. self.clear_balance_signal.emit(data)
  105. def _fan(self, data):
  106. self.fan_signal.emit(data)
  107. def can_connect_error(self):
  108. QMessageBox.critical(self, "连接状态" if SD.SYSTEM_LANGUAGE == 0 else "Connect State", "CAN 连接失败!" if SD.SYSTEM_LANGUAGE == 0 else "CAN Connect Error!")