~ubuntu-branches/ubuntu/precise/ubuntu-sso-client/precise

« back to all changes in this revision

Viewing changes to ubuntu_sso/qt/current_user_sign_in_page.py

  • Committer: Package Import Robot
  • Author(s): Natalia Bidart (nessita)
  • Date: 2012-02-22 16:53:51 UTC
  • mfrom: (1.1.32)
  • Revision ID: package-import@ubuntu.com-20120222165351-fvzfkcni6bq18goo
Tags: 2.99.5-0ubuntu1
* New upstream release:
  - Captcha loading is no longer failing for the Qt UI (LP: #933679).
  - Added stylesheets for the Qt UI.
  - Fixed: Qt UI: must call the backend passing reply_handler
    and error_handler (LP: #931452).
  - Make gettext return unicode strings. Also, transform arguments passed
    to the GLib spawnner to bytes (LP: #933632).
  - Try to load the qt main/ implementation when possible, if not default
    to the glib (LP: #933534).
  - Make the bin_dir discoverable when running from the system installation
    (LP: #933039).
  - Implement (so far dummy) timeout_func for the Qt frontend (LP: #933758).
* debian/control:
  - adding missing dependency on gnome-keyring for python-ubuntu-sso-client
    (LP: #938693).
* debian/patches/fix-938626.patch:
  - No more strings coming up from the Designer ui files so we ensure that
    those are marked for translation (LP: #938626).
* debian/watch: updated milestone to 2.99.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Page to allow the user to login into Ubuntu Single Sign On."""
18
18
 
 
19
from functools import partial
 
20
 
19
21
from PyQt4 import QtGui, QtCore
20
22
from twisted.internet import defer
21
23
 
 
24
from ubuntu_sso import NO_OP
22
25
from ubuntu_sso.qt import build_general_error_message
23
26
from ubuntu_sso.qt.gui import SSOWizardPage
24
27
from ubuntu_sso.logger import setup_logging
32
35
)
33
36
 
34
37
 
35
 
FORGOTTEN_PASSWORD_LINK_STYLE = '<a href="#">{forgotten_text}</a>'
 
38
FORGOTTEN_PASSWORD_LINK_STYLE = ('<a href="#" style="color:#dd4814;">'
 
39
                                 '{forgotten_text}</a>')
36
40
 
37
41
 
38
42
logger = setup_logging('ubuntu_sso.current_user_sign_in_page')
100
104
        self.ui.sign_in_button.style().polish(
101
105
            self.ui.sign_in_button)
102
106
 
 
107
    def cleanupPage(self):
 
108
        """Reset the wizard buttons."""
 
109
        self.wizard().setButtonLayout([QtGui.QWizard.Stretch])
 
110
 
103
111
    def _set_translated_strings(self):
104
112
        """Set the translated strings."""
105
113
        logger.debug('CurrentUserSignInPage._set_translated_strings')
144
152
            args = args + (self.ping_url,)
145
153
        else:
146
154
            f = self.backend.login
147
 
        f(*args)
 
155
 
 
156
        self.overlay.show()
 
157
        error_handler = partial(self._handle_error, f, self.on_login_error)
 
158
        f(*args, reply_handler=NO_OP, error_handler=error_handler)
148
159
 
149
160
    def on_login_error(self, app_name, error):
150
161
        """There was an error when login in."""
151
162
        # let the user know
152
163
        logger.error('Got error when login %s, error: %s',
153
164
            self.app_name, error)
 
165
        self.overlay.hide()
154
166
        self.message_box.critical(self, self.app_name,
155
167
            build_general_error_message(error))
156
168
 
157
169
    def on_logged_in(self, app_name, result):
158
170
        """We managed to log in."""
159
171
        logger.info('Logged in for %s', app_name)
 
172
        self.overlay.hide()
160
173
        email = unicode(self.ui.email_edit.text())
161
174
        self.userLoggedIn.emit(app_name, email)
162
175
        logger.debug('Wizard.loginSuccess emitted.')