bms_login.py 1.8 KB

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