12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- from ui.hard import Hard
- from ui.own.frame_theme import MyFrame
- from utils.globalvar import SD
- from utils.qt import QMessageBox, Signal
- from functools import partial
- class Win_Hard(Hard, MyFrame):
- rtc_update_signal = Signal()
- read_hard_signal = Signal()
- write_param_signal = Signal()
- exit_hard_signal = Signal()
- pack_vol_cali_signal = Signal()
- cur_cali_signal = Signal()
- cell_vol_one_cali_signal = Signal()
- cell_vol_all_cali_signal = Signal()
- temp_control_signal = Signal(int, int, int)
- def __init__(self, parent=None):
- super(Win_Hard, self).__init__(parent)
- self.setupUi(self)
- self.btn_rtc.clicked.connect(self._rtc_update)
- self.btn_read_hard_param.clicked.connect(self.on_btn_read_hard)
- self.btn_exit_hard_param.clicked.connect(self.on_btn_exit_hard)
- self.btn_pack_vol_cali.clicked.connect(self._on_btn_pack_vol_cali)
- self.btn_cur_cali.clicked.connect(self._on_btn_cur_cali)
- self.btn_hand.clicked.connect(self._on_btn_hand)
- self.btn_auto.clicked.connect(self._on_btn_auto)
- for index in range(64):
- self.hard_table.cellWidget(index, 2).editingFinished.connect(partial(self.set_diff, index))
-
- for i in range(15):
- for j in range(72):
- self.temp_qscrollarea_layout.itemAtPosition(i + 1, j + 1).widget().layout().itemAt(0).widget().stateChanged.connect(lambda state = self.temp_qscrollarea_layout.itemAtPosition(i + 1, j + 1).widget().layout().itemAt(0).widget(), cmu_id = i + 1, cell_id = j: self._temp_ctl(state, cmu_id, cell_id))
-
- def _rtc_update(self):
- self.rtc_update_signal.emit()
- def on_btn_read_hard(self):
- self.read_hard_signal.emit()
- def on_btn_exit_hard(self):
- self.exit_hard_signal.emit()
- def _on_btn_pack_vol_cali(self):
- self.pack_vol_cali_signal.emit()
- def _on_btn_cur_cali(self):
- self.cur_cali_signal.emit()
- def _on_btn_hand(self):
- self.cell_vol_one_cali_signal.emit()
- def _on_btn_auto(self):
- self.cell_vol_all_cali_signal.emit()
- def set_diff(self, i):
- try:
- diff = int(float(self.hard_table.cellWidget(i, 2).text())) - int(self.hard_table.item(i, 3).text())
- self.hard_table.item(i, 4).setText(str(diff))
- except BaseException:
- return
- def _temp_ctl(self, state, cmu_id, cell_id):
- self.temp_control_signal.emit(cmu_id, cell_id, state)
- def can_connect_error(self):
- QMessageBox.critical(self, "连接状态" if SD.SYSTEM_LANGUAGE == 0 else "Connect State", "CAN 连接失败!" if SD.SYSTEM_LANGUAGE == 0 else "CAN Connect Error!")
- def data_error(self):
- QMessageBox.critical(self, "数据状态" if SD.SYSTEM_LANGUAGE == 0 else "Data State", "数据无效!" if SD.SYSTEM_LANGUAGE == 0 else "Data Error!")
|