123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- from ui.protect import Protect
- from ui.own.frame_theme import MyFrame
- from utils.globalvar import SD
- from utils.qt import QMessageBox, Signal, QTimer
- class Win_Protect(Protect, MyFrame):
- # 信号传递
- read_param_signal = Signal()
- write_param_signal = Signal()
- exit_param_signal = Signal()
- reset_param_signal = Signal()
- def __init__(self, parent=None):
- super(Win_Protect, self).__init__(parent)
- self.setupUi(self)
- self.btn_read_param.clicked.connect(self.on_btn_read_param)
- self.btn_write_param.clicked.connect(self.on_btn_write_param)
- self.btn_exit_param.clicked.connect(self.on_btn_exit_param)
- self.btn_reset_param.clicked.connect(self.on_btn_reset_param)
- self.protect_table.itemClicked.connect(self._param_item_clicked)
- self.timer = QTimer()
- self.timer.timeout.connect(self.over_time)
- def start_timer(self):
- self.timer.start(3000)
-
- def end_timer(self):
- self.timer.stop()
-
- def on_btn_read_param(self):
- self.read_param_signal.emit()
- def on_btn_write_param(self):
- self.write_param_signal.emit()
- def on_btn_exit_param(self):
- self.exit_param_signal.emit()
- def on_btn_reset_param(self):
- self.reset_param_signal.emit()
- def _param_item_clicked(self, index):
- self.qline_name.setText(self.protect_table.item(index.row(), 0).text())
- self.qline_addr.setText(self.protect_table.item(index.row(), 3).text())
- self.qline_data_long.setText(self.protect_table.item(index.row(), 5).text())
- self.qline_fbl.setText(self.protect_table.item(index.row(), 6).text())
- self.qline_offset.setText(self.protect_table.item(index.row(), 7).text())
- self.qline_dw.setText(self.protect_table.item(index.row(), 2).text())
- self.qline_data.setText(self.protect_table.item(index.row(), 8).text())
- self.qline_data_set.setText(self.protect_table.item(index.row(), 1).text())
- def set_error(self):
- QMessageBox.critical(self, "错误" if SD.SYSTEM_LANGUAGE == 0 else "Error", "参数无效!" if SD.SYSTEM_LANGUAGE == 0 else "Param Error!")
- 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 over_time(self):
- self.timer.stop()
- QMessageBox.critical(self, "错误" if SD.SYSTEM_LANGUAGE == 0 else "Error", "参数设置超时!" if SD.SYSTEM_LANGUAGE == 0 else "Param Set OverTime!")
|