summaryrefslogtreecommitdiff
path: root/src/leap/gui/mainwindow.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-01 18:09:37 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-01 18:09:37 -0300
commit08a6f880b64b46db5d4efdcfc48c2cddec589f67 (patch)
tree46e0b34b8075194254a92a9c7109575f4c5df935 /src/leap/gui/mainwindow.py
parent1b9f4c824406f26e135a0d96cad04064b8864615 (diff)
parent599f6bf0d4f819ab1613bf9449c122025da07c13 (diff)
Merge remote-tracking branch 'ivan/feature/3318_add-cancel-button-to-login' into develop
Diffstat (limited to 'src/leap/gui/mainwindow.py')
-rw-r--r--src/leap/gui/mainwindow.py37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index 1c871aa2..2325ecf0 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -141,6 +141,7 @@ class MainWindow(QtGui.QMainWindow):
self.ui.loginLayout.addWidget(self._login_widget)
self._login_widget.login.connect(self._login)
+ self._login_widget.cancel_login.connect(self._cancel_login)
self._login_widget.show_wizard.connect(
self._launch_wizard)
@@ -274,6 +275,7 @@ class MainWindow(QtGui.QMainWindow):
self._keymanager = None
self._login_defer = None
+ self._download_provider_defer = None
self._smtp_config = SMTPConfig()
@@ -709,9 +711,9 @@ class MainWindow(QtGui.QMainWindow):
"""
provider = self._login_widget.get_selected_provider()
- self._provider_bootstrapper.run_provider_select_checks(
- provider,
- download_if_needed=True)
+ pb = self._provider_bootstrapper
+ d = pb.run_provider_select_checks(provider, download_if_needed=True)
+ self._download_provider_defer = d
def _load_provider_config(self, data):
"""
@@ -754,8 +756,7 @@ class MainWindow(QtGui.QMainWindow):
"""
SLOT
TRIGGERS:
- self.ui.btnLogin.clicked
- self.ui.lnPassword.returnPressed
+ self._login_widget.login
Starts the login sequence. Which involves bootstrapping the
selected provider if the selection is valid (not empty), then
@@ -788,6 +789,7 @@ class MainWindow(QtGui.QMainWindow):
self._login_widget.set_status(self.tr("Logging in..."), error=False)
self._login_widget.set_enabled(False)
+ self._login_widget.set_cancel(True)
if self._login_widget.get_remember() and has_keyring():
# in the keyring and in the settings
@@ -806,6 +808,25 @@ class MainWindow(QtGui.QMainWindow):
self._download_provider_config()
+ def _cancel_login(self):
+ """
+ SLOT
+ TRIGGERS:
+ self._login_widget.cancel_login
+
+ Stops the login sequence.
+ """
+ logger.debug("Cancelling log in.")
+ self._login_widget.set_cancel(False)
+
+ if self._download_provider_defer:
+ logger.debug("Cancelling download provider defer.")
+ self._download_provider_defer.cancel()
+
+ if self._login_defer:
+ logger.debug("Cancelling login defer.")
+ self._login_defer.cancel()
+
def _provider_config_loaded(self, data):
"""
SLOT
@@ -1250,6 +1271,7 @@ class MainWindow(QtGui.QMainWindow):
"""
passed = data[self._provider_bootstrapper.PASSED_KEY]
if not passed:
+ self._login_widget.set_cancel(False)
self._login_widget.set_enabled(True)
self._login_widget.set_status(
data[self._provider_bootstrapper.ERROR_KEY])
@@ -1380,8 +1402,13 @@ class MainWindow(QtGui.QMainWindow):
self._logger_window.close()
if self._login_defer:
+ logger.debug("Cancelling login defer.")
self._login_defer.cancel()
+ if self._download_provider_defer:
+ logger.debug("Cancelling download provider defer.")
+ self._download_provider_defer.cancel()
+
self.close()
if self._quit_callback: