summaryrefslogtreecommitdiff
path: root/src/leap/gui/firstrun
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/gui/firstrun')
-rw-r--r--src/leap/gui/firstrun/providerinfo.py42
-rw-r--r--src/leap/gui/firstrun/providersetup.py14
2 files changed, 41 insertions, 15 deletions
diff --git a/src/leap/gui/firstrun/providerinfo.py b/src/leap/gui/firstrun/providerinfo.py
index f5f5518a..52b4873f 100644
--- a/src/leap/gui/firstrun/providerinfo.py
+++ b/src/leap/gui/firstrun/providerinfo.py
@@ -2,22 +2,26 @@
Provider Info Page, used in First run Wizard
"""
+from PyQt4 import QtCore
from PyQt4 import QtGui
+from leap.gui.progress import ValidationPage
+
from leap.gui.constants import APP_LOGO
-class ProviderInfoPage(QtGui.QWizardPage):
+class ProviderInfoPage(ValidationPage):
def __init__(self, parent=None):
super(ProviderInfoPage, self).__init__(parent)
self.setTitle("Provider Info")
- self.setSubTitle("Available information about chosen provider.")
+ #self.setSubTitle("Available information about chosen provider.")
self.setPixmap(
QtGui.QWizard.LogoPixmap,
QtGui.QPixmap(APP_LOGO))
+ def create_info_panel(self):
displayName = QtGui.QLabel("")
description = QtGui.QLabel("")
enrollment_policy = QtGui.QLabel("")
@@ -28,15 +32,18 @@ class ProviderInfoPage(QtGui.QWizardPage):
self.description = description
self.enrollment_policy = enrollment_policy
+ # this trick allows us to reparent
+ QtCore.QObjectCleanupHandler().add(self.layout)
layout = QtGui.QGridLayout()
+
layout.addWidget(displayName, 0, 1)
layout.addWidget(description, 1, 1)
layout.addWidget(enrollment_policy, 2, 1)
self.setLayout(layout)
+ self.update()
- def initializePage(self):
- # XXX move to show info...
+ def show_provider_info(self):
# XXX get multilingual objects
# directly from the config object
@@ -59,9 +66,32 @@ class ProviderInfoPage(QtGui.QWizardPage):
self.enrollment_policy.setText(
'enrollment policy: %s' % enroll)
+ def _do_checks(self, update_signal=None):
+ """
+ executes actual checks in a separate thread
+ """
+ import time
+ update_signal.emit("head_sentinel", 0)
+ time.sleep(0.5)
+ update_signal.emit("something", 10)
+ time.sleep(0.5)
+ update_signal.emit("done", 90)
+ time.sleep(1)
+ update_signal.emit("end_sentinel", 100)
+ time.sleep(1)
+
+ def _do_validation(self):
+ """
+ called after _do_checks has finished
+ (connected to checker thread finished signal)
+ """
+ print 'validation...'
+ self.progress.hide()
+ self.stepsTableWidget.hide()
+ self.create_info_panel()
+ self.show_provider_info()
+
def nextId(self):
wizard = self.wizard()
next_ = "providersetupvalidation"
return wizard.get_page_index(next_)
-
-
diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py
index 63f55d00..c039dfc5 100644
--- a/src/leap/gui/firstrun/providersetup.py
+++ b/src/leap/gui/firstrun/providersetup.py
@@ -21,7 +21,7 @@ class ProviderSetupValidationPage(ValidationPage):
QtGui.QWizard.LogoPixmap,
QtGui.QPixmap(APP_LOGO))
- def _do_checks(self, signal=None):
+ def _do_checks(self, update_signal=None):
"""
executes actual checks in a separate thread
"""
@@ -33,8 +33,7 @@ class ProviderSetupValidationPage(ValidationPage):
pCertChecker = wizard.providercertchecker
certchecker = pCertChecker(domain=domain)
- signal.emit('Fetching CA certificate')
- self.progress.setValue(30)
+ update_signal.emit('Fetching CA certificate', 30)
if pconfig:
ca_cert_uri = pconfig.get('ca_cert_uri').geturl()
@@ -54,8 +53,7 @@ class ProviderSetupValidationPage(ValidationPage):
time.sleep(2)
- signal.emit('Checking CA fingerprint')
- self.progress.setValue(66)
+ update_signal.emit('Checking CA fingerprint', 66)
#ca_cert_fingerprint = pconfig.get('ca_cert_fingerprint', None)
# XXX get fingerprint dict (types)
@@ -69,8 +67,7 @@ class ProviderSetupValidationPage(ValidationPage):
# should catch exception
#return False
- signal.emit('Validating api certificate')
- self.progress.setValue(90)
+ update_signal.emit('Validating api certificate', 90)
#api_uri = pconfig.get('api_uri', None)
#try:
@@ -91,8 +88,7 @@ class ProviderSetupValidationPage(ValidationPage):
time.sleep(0.5)
#ca_cert_path = checker.ca_cert_path
- self.progress.setValue(100)
- signal.emit('end_sentinel')
+ update_signal.emit('end_sentinel', 100)
time.sleep(1)
def _do_validation(self):