21
21
from PyQt4 import QtGui
23
23
from ubuntu_sso.qt.gui import SSOWizardPage
24
from ubuntu_sso.logger import setup_logging
25
from ubuntu_sso.utils.ui import (
27
EXISTING_ACCOUNT_CHOICE_BUTTON,
28
SET_UP_ACCOUNT_CHOICE_BUTTON,
26
32
_ = gettext.gettext
33
logger = setup_logging('ubuntu_sso.sing_in_page')
29
36
class SignInPage(SSOWizardPage):
30
37
"""Wizard Page that lets the user Sign into Ubuntu One."""
32
def __init__(self, image_pixmap, *args, **kwargs):
33
super(SignInPage, self).__init__(*args, **kwargs)
39
def __init__(self, ui, image_pixmap, *args, **kwargs):
40
super(SignInPage, self).__init__(ui, *args, **kwargs)
34
41
self.ui.image_label.setPixmap(image_pixmap)
42
self._set_up_translated_strings()
43
self._connect_buttons()
45
def _set_up_translated_strings(self):
46
"""Set the correct strings for the UI."""
47
logger.debug('SingInPage._set_up_translated_strings')
48
congratulations = CONGRATULATIONS.format(app_name=self.app_name)
49
self.ui.message_label.setText(congratulations)
50
self.ui.existing_account_button.setText(
51
EXISTING_ACCOUNT_CHOICE_BUTTON)
52
self.ui.setup_account_button.setText(
53
SET_UP_ACCOUNT_CHOICE_BUTTON)
55
def _connect_buttons(self):
56
"""Connect the buttons to the actions to perform."""
57
logger.debug('SingInPage._connect_buttons')
58
self.ui.existing_account_button.clicked.connect(
59
self._set_next_existing)
60
self.ui.setup_account_button.clicked.connect(self._set_next_new)
62
def _set_next_existing(self):
63
"""Set the next id and fire signal."""
64
logger.debug('SignInPage._set_next_existing')
65
self.next = self.wizard().current_user_page_id
68
def _set_next_new(self):
69
"""Set the next id and fire signal."""
70
logger.debug('SignInPage._set_next_new')
71
self.next = self.wizard().setup_account_page_id
36
74
# Invalid names of Qt-inherited methods
37
75
# pylint: disable=C0103