diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-11-07 13:26:36 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-11-07 13:26:36 -0300 |
commit | 46e54dae224817da14a0259282395bd8c6b3e9c1 (patch) | |
tree | ed1dfcfc319df88fb31e5c8229c2292460ebc7e8 | |
parent | a3ab08d4582c4657b759a1d9cc9398edb2e53697 (diff) | |
parent | cf3e98eb1105bbf9a30878f886b276c366b190f3 (diff) |
Merge remote-tracking branch 'ivan/bug/remember-checks-in-wizard' into develop
-rw-r--r-- | changes/bug-remember-checks-in-wizard | 2 | ||||
-rw-r--r-- | src/leap/bitmask/gui/wizard.py | 57 |
2 files changed, 47 insertions, 12 deletions
diff --git a/changes/bug-remember-checks-in-wizard b/changes/bug-remember-checks-in-wizard new file mode 100644 index 00000000..818926e7 --- /dev/null +++ b/changes/bug-remember-checks-in-wizard @@ -0,0 +1,2 @@ +- Remember provider checks in wizard, do not re-run them if the user goes back + and forth through the wizard. Closes #3814 and #3815. 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 " |