bms_main.py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.pre_check_box.stateChanged.connect(self._prev_check)
  42. self.under_widget.center_check_box.stateChanged.connect(self._do4)
  43. self.under_widget.dlq_check_box.stateChanged.connect(self._do5)
  44. self.under_widget.do6_check_box.stateChanged.connect(self._do6)
  45. self.under_widget.do7_check_box.stateChanged.connect(self._do7)
  46. self.under_widget.do8_check_box.stateChanged.connect(self._do8)
  47. self.under_widget.fault_check_box.stateChanged.connect(self._fault)
  48. self.under_widget.again_check_box.stateChanged.connect(self._against)
  49. self.under_widget.again_one_check_box.stateChanged.connect(self._again_one)
  50. self.under_widget.chg_check_box.stateChanged.connect(self._chg)
  51. self.under_widget.dchg_check_box.stateChanged.connect(self._dchg)
  52. # self.under_widget.pre_check_box.stateChanged.connect(self._pre)
  53. self.under_widget.gjd1_check_box.stateChanged.connect(self._gjd1)
  54. self.under_widget.gjd2_check_box.stateChanged.connect(self._gjd2)
  55. self.under_widget.qiangzhi_chg_check_box.stateChanged.connect(self._qiangzhi_chg)
  56. self.under_widget.sleep_check_box.stateChanged.connect(self._sleep)
  57. self.under_widget.reset_check_box.stateChanged.connect(self._reset)
  58. self.under_widget.clear_balance_check_box.stateChanged.connect(self._clear)
  59. self.under_widget.fan_check_box.stateChanged.connect(self._fan)
  60. def _sys_up(self):
  61. self.up_signal.emit()
  62. def _sys_down(self):
  63. self.down_signal.emit()
  64. def _controll_sys(self, data):
  65. self.controll_signal.emit(data)
  66. def _do1(self, data):
  67. self.do1_signal.emit(data)
  68. def _do2(self, data):
  69. self.do2_signal.emit(data)
  70. def _do3(self, data):
  71. self.do3_signal.emit(data)
  72. def _do4(self, data):
  73. self.do4_signal.emit(data)
  74. def _do5(self, data):
  75. self.do5_signal.emit(data)
  76. def _do6(self, data):
  77. self.do6_signal.emit(data)
  78. def _do7(self, data):
  79. self.do7_signal.emit(data)
  80. def _do8(self, data):
  81. self.do8_signal.emit(data)
  82. def _fault(self, data):
  83. self.fault_release_signal.emit(data)
  84. def _against(self, data):
  85. self.jy_signal.emit(data)
  86. def _again_one(self, data):
  87. self.jy_one_signal.emit(data)
  88. def _chg(self, data):
  89. self.chg_mos_signal.emit(data)
  90. def _dchg(self, data):
  91. self.dchg_mos_signal.emit(data)
  92. def _pre(self, data):
  93. self.pre_mos_signal.emit(data)
  94. def _gjd1(self, data):
  95. self.gjd1_signal.emit(data)
  96. def _gjd2(self, data):
  97. self.gjd2_signal.emit(data)
  98. def _qiangzhi_chg(self, data):
  99. self.chg_signal.emit(data)
  100. def _sleep(self, data):
  101. self.sleep_signal.emit(data)
  102. def _reset(self, data):
  103. self.reset_signal.emit(data)
  104. def _clear(self, data):
  105. self.clear_balance_signal.emit(data)
  106. def _fan(self, data):
  107. self.fan_signal.emit(data)
  108. def _prev_check(self,data):
  109. if SD.CCU_TYPE == 1:
  110. self._do3(data)
  111. else:
  112. self._pre(data)
  113. def can_connect_error(self):
  114. QMessageBox.critical(self, "连接状态" if SD.SYSTEM_LANGUAGE == 0 else "Connect State", "CAN 连接失败!" if SD.SYSTEM_LANGUAGE == 0 else "CAN Connect Error!")