diff options
author | kali <kali@leap.se> | 2013-01-24 01:57:28 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2013-01-24 01:57:28 +0900 |
commit | 407b030bb7d27b797fb27254710a358c9c69f8be (patch) | |
tree | eb600cb7c6cfe33c4f991fb0929e017a0882dd93 /src/leap/gui/firstrun | |
parent | 8226d6032b6db0c15ff70e377f87f4acfdd21787 (diff) |
catch missing messages on last page of wizard
Diffstat (limited to 'src/leap/gui/firstrun')
-rw-r--r-- | src/leap/gui/firstrun/connect.py | 51 | ||||
-rw-r--r-- | src/leap/gui/firstrun/last.py | 27 | ||||
-rw-r--r-- | src/leap/gui/firstrun/providersetup.py | 8 | ||||
-rwxr-xr-x | src/leap/gui/firstrun/wizard.py | 1 |
4 files changed, 55 insertions, 32 deletions
diff --git a/src/leap/gui/firstrun/connect.py b/src/leap/gui/firstrun/connect.py index b7688380..9d89b7ab 100644 --- a/src/leap/gui/firstrun/connect.py +++ b/src/leap/gui/firstrun/connect.py @@ -120,9 +120,11 @@ class ConnectionPage(ValidationPage): called after _do_checks has finished (connected to checker thread finished signal) """ - # this should be called CONNECT PAGE AGAIN. # here we go! :) if self.is_done(): + nextbutton = self.wizard().button(QtGui.QWizard.NextButton) + nextbutton.setFocus() + full_domain = self.field('provider_domain') domain, port = get_https_domain_and_port(full_domain) _domain = u"%s:%s" % ( @@ -138,10 +140,15 @@ class ConnectionPage(ValidationPage): 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: + # we could run some of the checks to be + # sure everything is in order, but + # I see no point in doing it, we assume + # we've gone thru all checks during the wizard. + #conductor.run_checks() + #self.conductor = conductor + #errors = self.eip_error_check() + #if not errors and start_eip_signal: + if start_eip_signal: start_eip_signal.emit() else: @@ -150,12 +157,6 @@ class ConnectionPage(ValidationPage): "probably the wizard has been launched " "in an stand-alone way.") - # XXX look for a better place to signal - # we are done. - # We could probably have a fake validatePage - # that checks if the domain transfer has been - # done to conductor object, triggers the start_signal - # and does the go_next() self.set_done() def eip_error_check(self): @@ -165,9 +166,13 @@ class ConnectionPage(ValidationPage): 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! + # TODO handle errors. + # We should redirect them to the log viewer + # with a brief message. + # XXX move to LAST PAGE instead. + #logger.debug('eip error check from connecting page') + #errq = self.conductor.error_queue + pass def _do_validation(self): """ @@ -186,17 +191,25 @@ class ConnectionPage(ValidationPage): prevpage, first_error) self.go_back() - else: - logger.debug('should go next, wait for user to click next') - #self.go_next() def nextId(self): wizard = self.wizard() - #if not wizard: - #return return wizard.get_page_index('lastpage') def initializePage(self): super(ConnectionPage, self).initializePage() self.set_undone() + cancelbutton = self.wizard().button(QtGui.QWizard.CancelButton) + cancelbutton.hide() self.completeChanged.emit() + + wizard = self.wizard() + eip_statuschange_signal = wizard.eip_statuschange_signal + if eip_statuschange_signal: + eip_statuschange_signal.connect( + lambda status: self.send_status( + status)) + + def send_status(self, status): + wizard = self.wizard() + wizard.openvpn_status.append(status) diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index e097b2ae..32d98acc 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -15,7 +15,8 @@ class LastPage(QtGui.QWizardPage): def __init__(self, parent=None): super(LastPage, self).__init__(parent) - self.setTitle(self.tr("Connecting to Encrypted Internet Proxy service...")) + self.setTitle(self.tr( + "Connecting to Encrypted Internet Proxy service...")) self.setPixmap( QtGui.QWizard.LogoPixmap, @@ -33,6 +34,7 @@ class LastPage(QtGui.QWizardPage): self.status_line_2 = QtGui.QLabel() self.status_line_3 = QtGui.QLabel() self.status_line_4 = QtGui.QLabel() + self.status_line_5 = QtGui.QLabel() layout = QtGui.QVBoxLayout() layout.addWidget(self.label) @@ -42,6 +44,7 @@ class LastPage(QtGui.QWizardPage): layout.addWidget(self.status_line_2) layout.addWidget(self.status_line_3) layout.addWidget(self.status_line_4) + layout.addWidget(self.status_line_5) self.setLayout(layout) @@ -67,7 +70,7 @@ class LastPage(QtGui.QWizardPage): # signals. See progress.py logger.debug('logging status in last page') self.validation_done = False - status_count = 0 + status_count = 1 try: while True: status = (yield) @@ -84,11 +87,23 @@ class LastPage(QtGui.QWizardPage): pass def initializePage(self): + super(LastPage, self).initializePage() wizard = self.wizard() - if not wizard: - return - eip_status_handler = self.eip_status_handler() + handler = self.eip_status_handler() + + # get statuses done in prev page + for st in wizard.openvpn_status: + self.send_status(handler.send, st) + + # bind signal for events yet to come eip_statuschange_signal = wizard.eip_statuschange_signal if eip_statuschange_signal: eip_statuschange_signal.connect( - lambda status: eip_status_handler.send(status)) + lambda status: self.send_status( + handler.send, status)) + + def send_status(self, cb, status): + try: + cb(status) + except StopIteration: + pass diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 981e3214..6017e4d3 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -141,18 +141,12 @@ class ProviderSetupValidationPage(ValidationPage): wizard.set_validation_error( prevpage, first_error) - # XXX don't go back, signal error - #self.go_back() - else: - logger.debug('should be going next, wait on user') - #self.go_next() def nextId(self): wizard = self.wizard() from_login = wizard.from_login if from_login: - # XXX bad name. change to connect again. - next_ = 'signupvalidation' + next_ = 'connect' else: next_ = 'signup' return wizard.get_page_index(next_) diff --git a/src/leap/gui/firstrun/wizard.py b/src/leap/gui/firstrun/wizard.py index 427f9df8..f198dca0 100755 --- a/src/leap/gui/firstrun/wizard.py +++ b/src/leap/gui/firstrun/wizard.py @@ -136,6 +136,7 @@ class FirstRunWizard(QtGui.QWizard): self.add_pages_from_dict(pages_dict) self.validation_errors = {} + self.openvpn_status = [] self.setPixmap( QtGui.QWizard.BannerPixmap, |