spacepaste

  1.  
  2. from PyQt5 import QtWidgets
  3. from PyQt5.QtCore import pyqtSignal
  4. from helpers import PrimerConn
  5. from .loginGUI import Ui_login as LoginForm
  6. from ui.components.input.line_edit import Input
  7. from ui.components.button.push_button import PushButton
  8. class LoginPage(QtWidgets.QWidget, LoginForm):
  9. login_success = pyqtSignal(int)
  10. def __init__(self, parent=None):
  11. super(LoginPage, self).__init__(parent)
  12. self.setupUi(self)
  13. # User object
  14. self.user_obj = None
  15. # User email input field
  16. self.email_input = Input()
  17. self.email_input.lineEdit.setPlaceholderText("email")
  18. self.email_input.email_validation()
  19. self.loginInputEmailContainer.insertWidget(1, self.email_input)
  20. # User password input field
  21. self.pwd_input = Input()
  22. self.pwd_input.lineEdit.setPlaceholderText("password")
  23. self.pwd_input.echo_mode_pwd()
  24. self.loginInputPasswordContainer.insertWidget(1, self.pwd_input)
  25. # Login button
  26. self.login_btn = PushButton()
  27. self.login_btn.pushButton.setText("login")
  28. self.login_btn.pushButton.setMinimumSize(150, 50)
  29. self.login_btn.set_colors("#C6C6C6", "#e1e1e1")
  30. self.login_btn.set_btn_color("#585858", "#fff", "#0078D7")
  31. self.loginButtonContainer.insertWidget(1, self.login_btn)
  32. self.login_btn.pushButton.clicked.connect(self.login)
  33. # Login Method
  34. # noinspection PyCallByClass,PyTypeChecker
  35. def login(self):
  36. # email = self.email_input.lineEdit.text()
  37. # password = self.pwd_input.lineEdit.text()
  38. # login_res = PrimerConn.login(email, password)
  39. try:
  40. self.login_success.emit(3)
  41. except Exception as e:
  42. print(e)
  43.