summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/gui/wizard.py57
1 files changed, 45 insertions, 12 deletions
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index 5c4a6f8e..5f5224ae 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -147,6 +147,26 @@ class Wizard(QtGui.QWizard):
self._load_configured_providers()
+ self._provider_checks_ok = False
+ self._provider_setup_ok = False
+ self.finished.connect(self._wizard_finished)
+
+ @QtCore.Slot()
+ def _wizard_finished(self):
+ """
+ SLOT
+ TRIGGER:
+ self.finished
+
+ This method is called when the wizard is accepted or rejected.
+ Here we do the cleanup needed to use the wizard again reusing the
+ instance.
+ """
+ self._provider_checks_ok = False
+ self._provider_setup_ok = False
+ self.ui.lnProvider.setText('')
+ self.ui.grpCheckProvider.setVisible(False)
+
def _load_configured_providers(self):
"""
Loads the configured providers into the wizard providers combo box.
@@ -195,7 +215,7 @@ class Wizard(QtGui.QWizard):
return self._selected_services
@QtCore.Slot()
- def _enable_check(self):
+ def _enable_check(self, reset=True):
"""
SLOT
TRIGGER:
@@ -207,7 +227,9 @@ class Wizard(QtGui.QWizard):
enabled = len(self.ui.lnProvider.text()) != 0
enabled = enabled and self.ui.rbNewProvider.isChecked()
self.ui.btnCheck.setEnabled(enabled)
- self._reset_provider_check()
+
+ if reset:
+ self._reset_provider_check()
def _focus_password(self):
"""
@@ -350,6 +372,12 @@ class Wizard(QtGui.QWizard):
if len(self.ui.lnProvider.text()) == 0:
return
+ self._provider_checks_ok = False
+
+ # just in case that the user has already setup a provider and
+ # go 'back' to check a provider
+ self._provider_setup_ok = False
+
self.ui.grpCheckProvider.setVisible(True)
self.ui.btnCheck.setEnabled(False)
self.ui.lnProvider.setEnabled(False)
@@ -459,6 +487,7 @@ class Wizard(QtGui.QWizard):
"provider.json")):
self._complete_task(data, self.ui.lblProviderInfo,
True, self.SELECT_PROVIDER_PAGE)
+ self._provider_checks_ok = True
else:
new_data = {
self._provider_bootstrapper.PASSED_KEY: False,
@@ -510,6 +539,7 @@ class Wizard(QtGui.QWizard):
"""
self._complete_task(data, self.ui.lblCheckApiCert,
True, self.SETUP_PROVIDER_PAGE)
+ self._provider_setup_ok = True
def _service_selection_changed(self, service, state):
"""
@@ -568,18 +598,21 @@ class Wizard(QtGui.QWizard):
"""
if pageId == self.SELECT_PROVIDER_PAGE:
skip = self.ui.rbExistingProvider.isChecked()
- self._enable_check()
- self._skip_provider_checks(skip)
+ if not self._provider_checks_ok:
+ self._enable_check()
+ self._skip_provider_checks(skip)
+ else:
+ self._enable_check(reset=False)
if pageId == self.SETUP_PROVIDER_PAGE:
- self._reset_provider_setup()
- self.page(pageId).setSubTitle(self.tr("Gathering configuration "
- "options for %s") %
- (self._provider_config
- .get_name(),))
- self.ui.lblDownloadCaCert.setPixmap(self.QUESTION_ICON)
- self._provider_setup_defer = self._provider_bootstrapper.\
- run_provider_setup_checks(self._provider_config)
+ if not self._provider_setup_ok:
+ self._reset_provider_setup()
+ sub_title = self.tr("Gathering configuration options for {0}")
+ sub_title = sub_title.format(self._provider_config.get_name())
+ self.page(pageId).setSubTitle(sub_title)
+ self.ui.lblDownloadCaCert.setPixmap(self.QUESTION_ICON)
+ self._provider_setup_defer = self._provider_bootstrapper.\
+ run_provider_setup_checks(self._provider_config)
if pageId == self.PRESENT_PROVIDER_PAGE:
self.page(pageId).setSubTitle(self.tr("Description of services "