diff options
author | kali <kali@leap.se> | 2012-11-09 11:21:40 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-11-09 11:21:40 +0900 |
commit | 8118056a244ca74d16380ad26a70e3da40e7e401 (patch) | |
tree | 4363948d180a667a545807b99b2d3199e30b5950 /src/leap/gui/firstrun/register.py | |
parent | b84007d8fec8c949ba4ac1d26695c710a210d797 (diff) |
connect page merged into regvalidation.
Flow nearly working with fake provider, except for authentication.
Diffstat (limited to 'src/leap/gui/firstrun/register.py')
-rw-r--r-- | src/leap/gui/firstrun/register.py | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/src/leap/gui/firstrun/register.py b/src/leap/gui/firstrun/register.py index d7e8db0e..0a7ba34b 100644 --- a/src/leap/gui/firstrun/register.py +++ b/src/leap/gui/firstrun/register.py @@ -17,23 +17,18 @@ from leap.gui.styles import ErrorLabelStyleSheet class RegisterUserPage(QtGui.QWizardPage, UserFormMixIn): - setSigningUpStatus = QtCore.pyqtSignal([]) - def __init__(self, parent=None): super(RegisterUserPage, self).__init__(parent) - # bind wizard page signals - self.setSigningUpStatus.connect( - lambda: self.set_validation_status( - 'validating')) - self.setTitle("Sign Up") self.setPixmap( QtGui.QWizard.LogoPixmap, QtGui.QPixmap(APP_LOGO)) + self.current_page = "signup" + userNameLabel = QtGui.QLabel("User &name:") userNameLineEdit = QtGui.QLineEdit() userNameLineEdit.cursorPositionChanged.connect( @@ -88,18 +83,28 @@ class RegisterUserPage(QtGui.QWizardPage, UserFormMixIn): layout.addWidget(rememberPasswordCheckBox, 4, 3, 4, 4) self.setLayout(layout) - # overwritten methods + # pagewizard methods - def initializePage(self): + def populateErrors(self): + # XXX could move this to ValidationMixin + + #logger.debug('getting errors') + errors = self.wizard().get_validation_error( + self.current_page) + if errors: + #logger.debug('errors! -> %s', errors) + self.validationMsg.setText(errors) + + def paintEvent(self, event): """ - inits wizard page + we hook our populate errors + on paintEvent because we need it to catch + when user enters the page coming from next, + and initializePage does not cover that case. + Maybe there's a better event to hook upon. """ - provider = self.field('provider_domain') - self.setSubTitle( - "Register a new user with provider %s." % - provider) - self.validationMsg.setText('') - self.userPassword2LineEdit.setText('') + super(RegisterUserPage, self).paintEvent(event) + self.populateErrors() def validatePage(self): """ @@ -110,7 +115,6 @@ class RegisterUserPage(QtGui.QWizardPage, UserFormMixIn): and if any errors are thrown there we come back and re-display the validation label. """ - self.setSigningUpStatus.emit() #username = self.userNameLineEdit.text() password = self.userPasswordLineEdit.text() @@ -135,6 +139,17 @@ class RegisterUserPage(QtGui.QWizardPage, UserFormMixIn): return True + def initializePage(self): + """ + inits wizard page + """ + provider = self.field('provider_domain') + self.setSubTitle( + "Register a new user with provider %s." % + provider) + self.validationMsg.setText('') + self.userPassword2LineEdit.setText('') + def nextId(self): wizard = self.wizard() if not wizard: |