summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui/wizard.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/gui/wizard.py')
-rw-r--r--src/leap/bitmask/gui/wizard.py46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index 4f67958f..be5bde52 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -24,6 +24,10 @@ from functools import partial
from PySide import QtCore, QtGui
+# TODO: we should use a more granular signaling instead of passing error/ok as
+# a result.
+from leap.bitmask.backend.leapbackend import ERROR_KEY, PASSED_KEY
+
from leap.bitmask.config import flags
from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.services import get_service_display_name, get_supported
@@ -49,16 +53,12 @@ class Wizard(QtGui.QWizard):
REGISTER_USER_PAGE = 4
SERVICES_PAGE = 5
- def __init__(self, backend, bypass_checks=False):
+ def __init__(self, backend, leap_signaler):
"""
Constructor for the main Wizard.
:param backend: Backend being used
:type backend: Backend
- :param bypass_checks: Set to true if the app should bypass
- first round of checks for CA
- certificates at bootstrap
- :type bypass_checks: bool
"""
QtGui.QWizard.__init__(self)
@@ -86,6 +86,8 @@ class Wizard(QtGui.QWizard):
self._connect_and_track(self.ui.lnProvider.returnPressed,
self._check_provider)
+ self._leap_signaler = leap_signaler
+
self._backend = backend
self._backend_connect()
@@ -325,7 +327,8 @@ class Wizard(QtGui.QWizard):
if user_ok and pass_ok:
self._set_register_status(self.tr("Starting registration..."))
- self._backend.user_register(self._domain, username, password)
+ self._backend.user_register(provider=self._domain,
+ username=username, password=password)
self._username = username
self._password = password
else:
@@ -477,7 +480,7 @@ class Wizard(QtGui.QWizard):
self.ui.lblNameResolution.setPixmap(self.QUESTION_ICON)
self._provider_select_defer = self._backend.\
- provider_setup(self._domain)
+ provider_setup(provider=self._domain)
@QtCore.Slot(bool)
def _skip_provider_checks(self, skip):
@@ -512,8 +515,8 @@ class Wizard(QtGui.QWizard):
:param complete_page: page id to complete
:type complete_page: int
"""
- passed = data[self._backend.PASSED_KEY]
- error = data[self._backend.ERROR_KEY]
+ passed = data[PASSED_KEY]
+ error = data[ERROR_KEY]
if passed:
label.setPixmap(self.OK_ICON)
if complete:
@@ -533,7 +536,7 @@ class Wizard(QtGui.QWizard):
"""
self._complete_task(data, self.ui.lblNameResolution)
status = ""
- passed = data[self._backend.PASSED_KEY]
+ passed = data[PASSED_KEY]
if not passed:
status = self.tr("<font color='red'><b>Non-existent "
"provider</b></font>")
@@ -553,10 +556,10 @@ class Wizard(QtGui.QWizard):
"""
self._complete_task(data, self.ui.lblHTTPS)
status = ""
- passed = data[self._backend.PASSED_KEY]
+ passed = data[PASSED_KEY]
if not passed:
status = self.tr("<font color='red'><b>%s</b></font>") \
- % (data[self._backend.ERROR_KEY])
+ % (data[ERROR_KEY])
self.ui.lblProviderSelectStatus.setText(status)
else:
self.ui.lblProviderInfo.setPixmap(self.QUESTION_ICON)
@@ -573,22 +576,21 @@ class Wizard(QtGui.QWizard):
check. Since this check is the last of this set, it also
completes the page if passed
"""
- if data[self._backend.PASSED_KEY]:
+ if data[PASSED_KEY]:
self._complete_task(data, self.ui.lblProviderInfo,
True, self.SELECT_PROVIDER_PAGE)
self._provider_checks_ok = True
lang = QtCore.QLocale.system().name()
- self._backend.provider_get_details(self._domain, lang)
+ self._backend.provider_get_details(domain=self._domain, lang=lang)
else:
new_data = {
- self._backend.PASSED_KEY: False,
- self._backend.ERROR_KEY:
- self.tr("Unable to load provider configuration")
+ PASSED_KEY: False,
+ ERROR_KEY: self.tr("Unable to load provider configuration")
}
self._complete_task(new_data, self.ui.lblProviderInfo)
status = ""
- if not data[self._backend.PASSED_KEY]:
+ if not data[PASSED_KEY]:
status = self.tr("<font color='red'><b>Not a valid provider"
"</b></font>")
self.ui.lblProviderSelectStatus.setText(status)
@@ -619,7 +621,7 @@ class Wizard(QtGui.QWizard):
Sets the status for the download of the CA certificate check
"""
self._complete_task(data, self.ui.lblDownloadCaCert)
- passed = data[self._backend.PASSED_KEY]
+ passed = data[PASSED_KEY]
if passed:
self.ui.lblCheckCaFpr.setPixmap(self.QUESTION_ICON)
@@ -632,7 +634,7 @@ class Wizard(QtGui.QWizard):
Sets the status for the CA fingerprint check
"""
self._complete_task(data, self.ui.lblCheckCaFpr)
- passed = data[self._backend.PASSED_KEY]
+ passed = data[PASSED_KEY]
if passed:
self.ui.lblCheckApiCert.setPixmap(self.QUESTION_ICON)
@@ -726,7 +728,7 @@ class Wizard(QtGui.QWizard):
self.page(pageId).setSubTitle(sub_title)
self.ui.lblDownloadCaCert.setPixmap(self.QUESTION_ICON)
self._provider_setup_defer = self._backend.\
- provider_bootstrap(self._domain)
+ provider_bootstrap(provider=self._domain)
if pageId == self.PRESENT_PROVIDER_PAGE:
sub_title = self.tr("Description of services offered by {0}")
@@ -789,7 +791,7 @@ class Wizard(QtGui.QWizard):
"""
Connects all the backend signals with the wizard.
"""
- sig = self._backend.signaler
+ sig = self._leap_signaler
conntrack = self._connect_and_track
conntrack(sig.prov_name_resolution, self._name_resolution)
conntrack(sig.prov_https_connection, self._https_connection)