bms_login.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. from ui.login import UiBmsLoginPage
  4. from ui.own.frame_theme import MyFrame
  5. from utils.qt import QMessageBox, Signal, Slot
  6. from utils.globalvar import SD
  7. class Win_Login(UiBmsLoginPage, MyFrame):
  8. # 信号传递
  9. login_signal = Signal()
  10. cancel_signal = Signal()
  11. home_show_signal = Signal()
  12. language_signal = Signal(int)
  13. def __init__(self, parent=None):
  14. super(Win_Login, self).__init__(parent)
  15. self.setupUi(self)
  16. @Slot()
  17. def on_btn_login_clicked(self):
  18. self.login_signal.emit()
  19. @Slot()
  20. def on_edt_password_returnPressed(self):
  21. self.login_signal.emit()
  22. @Slot()
  23. def on_btn_cancel_clicked(self):
  24. self.cancel_signal.emit()
  25. @Slot(int)
  26. def on_language_currentIndexChanged(self, index):
  27. self.language_signal.emit(index)
  28. def on_success(self):
  29. SD.CCU_TYPE = self.cb_prj.currentIndex()
  30. self.can_type = self.cb_con_type.currentIndex()
  31. self._can_index = self.cb_index.currentText()
  32. self._can_channel = self.cb_channel.currentText()
  33. self._can_baudrate = self.cb_baudrate.currentText()
  34. SD.CAN_TYPE = self.can_type
  35. can_index = int(self._can_index)
  36. can_channel = int(self._can_channel)
  37. can_baudrate = self._can_baudrate
  38. SD.CAN_CONTROL.set_can_board(SD.CAN_TYPE, can_index, can_channel, can_baudrate)
  39. self.home_show_signal.emit()
  40. self.close()
  41. def on_error(self):
  42. QMessageBox.critical(self, "登录失败" if SD.SYSTEM_LANGUAGE == 0 else "Login Error", "帐号密码错误" if SD.SYSTEM_LANGUAGE == 0 else "UserName or Pwd Error!")