~mvo/ubuntu-sso-client/strawman-lp711413

« back to all changes in this revision

Viewing changes to ubuntu_sso/qt/controllers.py

Fixed the following:
* Updated the Linux test to assert that the ui module is passed as a kwarg.
* Fixed some smelling mistakes.
* Fixed lint and pep8 issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    EMAIL_MISMATCH,
34
34
    EMAIL_INVALID,
35
35
    EXISTING_ACCOUNT_CHOICE_BUTTON,
36
 
    ERROR,
37
36
    FORGOTTEN_PASSWORD_BUTTON,
38
37
    JOIN_HEADER_LABEL,
39
38
    NAME_ENTRY,
45
44
    SET_UP_ACCOUNT_CHOICE_BUTTON,
46
45
    SET_UP_ACCOUNT_BUTTON,
47
46
    SIGN_IN_BUTTON,
48
 
    SUCCESS,
49
47
    SURNAME_ENTRY,
50
48
    TC_BUTTON,
51
49
    VERIFY_EMAIL_TITLE,
57
55
 
58
56
logger = setup_logging('ubuntu_sso.controllers')
59
57
 
 
58
# pylint: disable=W0511
 
59
# disabled warnings about TODO comments
 
60
 
60
61
 
61
62
class BackendController(object):
62
63
    """Represent a controller that talks with the sso backend."""
253
254
        view.terms_and_conditions_button.clicked.connect(
254
255
                                               lambda: self.set_next_tos(view))
255
256
        view.set_up_button.clicked.connect(lambda: self.set_next_validation(
256
 
                                                                         view))
 
257
                                                                view, backend))
257
258
        view.password_edit.textChanged.connect(
258
259
                              lambda x: self.update_password_strength(x, view))
259
260
        view.terms_and_conditions_check_box.stateChanged.connect(
440
441
class UbuntuSSOWizardController(object):
441
442
    """Controller used for the overall wizard."""
442
443
 
443
 
    
444
444
    def __init__(self, app_name='', login_success_callback=NO_OP,
445
445
                 registration_success_callback=NO_OP,
446
446
                 user_cancellation_callback=NO_OP):
447
447
        """Create a new instance."""
448
448
        self.app_name = app_name
449
 
        self.login_success_callback = login_success_callback 
450
 
        self.registration_success_callback = registration_success_callback 
451
 
        self.user_cancellation_callback = user_cancellation_callback 
 
449
        self.login_success_callback = login_success_callback
 
450
        self.registration_success_callback = registration_success_callback
 
451
        self.user_cancellation_callback = user_cancellation_callback
452
452
 
453
453
    def on_user_cancelation(self, view):
454
454
        """Process the cancel action."""
478
478
        else:
479
479
            logger.info('Success in calling the given registration_callback')
480
480
 
 
481
    #pylint: disable=C0103
481
482
    def setupUi(self, view):
482
483
        """Setup the view."""
483
484
        view.button(QWizard.CancelButton).clicked.connect(
484
485
                                        lambda: self.on_user_cancelation(view))
485
486
        view.loginSuccess.connect(self.on_login_success)
486
487
        view.registrationSuccess.connect(self.on_registration_success)
 
488
    #pylint: enable=C0103