diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-03-11 18:13:55 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-03-11 18:13:55 -0300 |
commit | 77c7e96e2aad4db223e4c7af53ec300d5472829b (patch) | |
tree | 12145e084fc8edf8ccb9007dde2120c439f79df4 | |
parent | b7325ef4527b90ed007a3f3ba7c61ff680076957 (diff) |
Instantiate provider name in the wizard once its set
-rw-r--r-- | src/leap/gui/wizard.py | 37 | ||||
-rw-r--r-- | src/leap/gui/wizardpage.py | 7 |
2 files changed, 38 insertions, 6 deletions
diff --git a/src/leap/gui/wizard.py b/src/leap/gui/wizard.py index 82deab0d..70028581 100644 --- a/src/leap/gui/wizard.py +++ b/src/leap/gui/wizard.py @@ -129,6 +129,7 @@ class Wizard(QtGui.QWizard): def _enable_check(self, text): self.ui.btnCheck.setEnabled(len(self.ui.lnProvider.text()) != 0) + self._reset_provider_check() def _focus_password(self): """ @@ -228,6 +229,14 @@ class Wizard(QtGui.QWizard): """ self.ui.lblRegisterStatus.setText(status) + def _reset_provider_check(self): + self.ui.lblNameResolution.setPixmap(self.QUESTION_ICON) + self.ui.lblHTTPS.setPixmap(self.QUESTION_ICON) + self.ui.lblProviderInfo.setPixmap(self.QUESTION_ICON) + self._domain = None + self.button(QtGui.QWizard.NextButton).setEnabled(False) + self.page(self.SELECT_PROVIDER_PAGE).set_completed(False) + def _check_provider(self): """ SLOT @@ -242,6 +251,8 @@ class Wizard(QtGui.QWizard): self.ui.grpCheckProvider.setVisible(True) self.ui.btnCheck.setEnabled(False) + self.ui.lnProvider.setEnabled(False) + self.button(QtGui.QWizard.BackButton).clearFocus() self._domain = self.ui.lnProvider.text() self._provider_bootstrapper.run_provider_select_checks( @@ -284,10 +295,13 @@ class Wizard(QtGui.QWizard): """ self._complete_task(data, self.ui.lblNameResolution) status = "" - if not data[self._provider_bootstrapper.PASSED_KEY]: + passed = data[self._provider_bootstrapper.PASSED_KEY] + if not passed: status = self.tr("<font color='red'><b>Non-existent " "provider</b></font>") self.ui.lblProviderSelectStatus.setText(status) + self.ui.btnCheck.setEnabled(not passed) + self.ui.lnProvider.setEnabled(not passed) def _https_connection(self, data): """ @@ -298,10 +312,13 @@ class Wizard(QtGui.QWizard): """ self._complete_task(data, self.ui.lblHTTPS) status = "" - if not data[self._provider_bootstrapper.PASSED_KEY]: + passed = data[self._provider_bootstrapper.PASSED_KEY] + if not passed: status = self.tr("<font color='red'><b>Provider does not " "support HTTPS</b></font>") self.ui.lblProviderSelectStatus.setText(status) + self.ui.btnCheck.setEnabled(not passed) + self.ui.lnProvider.setEnabled(not passed) def _download_provider_info(self, data): """ @@ -332,6 +349,7 @@ class Wizard(QtGui.QWizard): "</b></font>") self.ui.lblProviderSelectStatus.setText(status) self.ui.btnCheck.setEnabled(True) + self.ui.lnProvider.setEnabled(True) def _download_ca_cert(self, data): """ @@ -400,6 +418,10 @@ class Wizard(QtGui.QWizard): self._enable_check("") if pageId == self.SETUP_PROVIDER_PAGE: + self.page(pageId).setSubTitle(self.tr("Gathering configuration " + "options for %s") % + (self._provider_config + .get_name(),)) self._provider_bootstrapper.\ run_provider_setup_checks(self._checker_thread, self._provider_config) @@ -409,7 +431,10 @@ class Wizard(QtGui.QWizard): self._provider_config) if pageId == self.PRESENT_PROVIDER_PAGE: - # TODO: get the right lang for these + self.page(pageId).setSubTitle(self.tr("Services offered by %s") % + (self._provider_config + .get_name(),)) + lang = QtCore.QLocale.system().name() self.ui.lblProviderName.setText( "<b>%s</b>" % @@ -421,6 +446,12 @@ class Wizard(QtGui.QWizard): self.ui.lblProviderPolicy.setText(self._provider_config .get_enrollment_policy()) + if pageId == self.REGISTER_USER_PAGE: + self.page(pageId).setSubTitle(self.tr("Register a new user with " + "%s") % + (self._provider_config + .get_name(),)) + def nextId(self): """ Sets the next page id for the wizard based on wether the user diff --git a/src/leap/gui/wizardpage.py b/src/leap/gui/wizardpage.py index 2138ac7b..b2a00028 100644 --- a/src/leap/gui/wizardpage.py +++ b/src/leap/gui/wizardpage.py @@ -27,9 +27,10 @@ class WizardPage(QtGui.QWizardPage): QtGui.QWizardPage.__init__(self) self._completed = False - def set_completed(self): - self._completed = True - self.completeChanged.emit() + def set_completed(self, val=True): + self._completed = val + if val: + self.completeChanged.emit() def isComplete(self): return self._completed |