diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-08-01 18:09:37 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-08-01 18:09:37 -0300 |
commit | 08a6f880b64b46db5d4efdcfc48c2cddec589f67 (patch) | |
tree | 46e0b34b8075194254a92a9c7109575f4c5df935 /src/leap/gui/login.py | |
parent | 1b9f4c824406f26e135a0d96cad04064b8864615 (diff) | |
parent | 599f6bf0d4f819ab1613bf9449c122025da07c13 (diff) |
Merge remote-tracking branch 'ivan/feature/3318_add-cancel-button-to-login' into develop
Diffstat (limited to 'src/leap/gui/login.py')
-rw-r--r-- | src/leap/gui/login.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/leap/gui/login.py b/src/leap/gui/login.py index 80f2f3db..3eb1fe39 100644 --- a/src/leap/gui/login.py +++ b/src/leap/gui/login.py @@ -19,7 +19,6 @@ Login widget implementation """ import logging -import keyring from PySide import QtCore, QtGui from ui_login import Ui_LoginWidget @@ -37,6 +36,8 @@ class LoginWidget(QtGui.QWidget): # Emitted when the login button is clicked login = QtCore.Signal() + cancel_login = QtCore.Signal() + # Emitted when the user selects "Other..." in the provider # combobox or click "Create Account" show_wizard = QtCore.Signal() @@ -97,7 +98,7 @@ class LoginWidget(QtGui.QWidget): """ self.ui.cmbProviders.blockSignals(True) self.ui.cmbProviders.clear() - self.ui.cmbProviders.addItems(provider_list + ["Other..."]) + self.ui.cmbProviders.addItems(provider_list + [self.tr("Other...")]) self.ui.cmbProviders.blockSignals(False) def select_provider_by_name(self, name): @@ -194,6 +195,26 @@ class LoginWidget(QtGui.QWidget): self.ui.chkRemember.setEnabled(enabled) self.ui.cmbProviders.setEnabled(enabled) + def set_cancel(self, enabled=False): + """ + Enables or disables the cancel action in the "log in" process. + + :param enabled: wether it should be enabled or not + :type enabled: bool + """ + self.ui.btnLogin.setEnabled(enabled) + text = self.tr("Cancel") + login_or_cancel = self.cancel_login + + if not enabled: + text = self.tr("Log In") + login_or_cancel = self.login + + self.ui.btnLogin.setText(text) + + self.ui.btnLogin.clicked.disconnect() + self.ui.btnLogin.clicked.connect(login_or_cancel) + def _focus_password(self): """ Focuses in the password lineedit |