From 017ed666038adba315155ad7508f8f3b48368b9f Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 12 Nov 2012 10:16:32 +0900 Subject: add signal to start eip conductor after last checks --- src/leap/gui/firstrun/connect.py | 5 ++++ src/leap/gui/firstrun/regvalidation.py | 49 +++++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 3 deletions(-) (limited to 'src/leap/gui') diff --git a/src/leap/gui/firstrun/connect.py b/src/leap/gui/firstrun/connect.py index 283e81b2..a0fe021c 100644 --- a/src/leap/gui/firstrun/connect.py +++ b/src/leap/gui/firstrun/connect.py @@ -1,6 +1,11 @@ """ Connecting Page, used in First Run Wizard """ +# XXX FIXME +# DEPRECATED. All functionality moved to regvalidation +# This file should be removed after checking that one is ok. +# XXX + import logging from PyQt4 import QtGui diff --git a/src/leap/gui/firstrun/regvalidation.py b/src/leap/gui/firstrun/regvalidation.py index 7f149ae7..e2d6d425 100644 --- a/src/leap/gui/firstrun/regvalidation.py +++ b/src/leap/gui/firstrun/regvalidation.py @@ -1,7 +1,13 @@ """ Provider Setup Validation Page, -used if First Run Wizard +used in First Run Wizard """ +# XXX This page is called regvalidation +# but it's implementing functionality in the former +# connect page. +# We should remame it to connect again, when we integrate +# the login branch of the wizard. + import logging import json import socket @@ -186,6 +192,41 @@ class RegisterUserValidationPage(ValidationPage): update_signal.emit("end_sentinel", 100) pause_for_user() + # here we go! :) + self.run_eip_checks_for_provider_and_connect(domain) + + def run_eip_checks_for_provider_and_connect(self, domain): + wizard = self.wizard() + conductor = wizard.conductor + start_eip_signal = getattr( + wizard, + 'start_eipconnection_signal', None) + + if conductor: + conductor.set_provider_domain(domain) + conductor.run_checks() + self.conductor = conductor + errors = self.eip_error_check() + if not errors and start_eip_signal: + start_eip_signal.emit() + + else: + logger.warning( + "No conductor found. This means that " + "probably the wizard has been launched " + "in an stand-alone way.") + + def eip_error_check(self): + """ + a version of the main app error checker, + but integrated within the connecting page of the wizard. + consumes the conductor error queue. + pops errors, and add those to the wizard page + """ + logger.debug('eip error check from connecting page') + errq = self.conductor.error_queue + # XXX missing! + def _do_validation(self): """ called after _do_checks has finished @@ -196,7 +237,7 @@ class RegisterUserValidationPage(ValidationPage): wizard = self.wizard() if self.errors: - print 'going back with errors' + logger.debug('going back with errors') logger.error(self.errors) name, first_error = self.pop_first_error() wizard.set_validation_error( @@ -204,7 +245,9 @@ class RegisterUserValidationPage(ValidationPage): first_error) self.go_back() else: - print 'going next' + logger.debug('going next') + # check if this "next" interferes + # with the eip signal. self.go_next() def nextId(self): -- cgit v1.2.3