From ad16a72f60ecc84524c22e8912df4eb8a48a2a42 Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 6 Nov 2012 16:26:10 +0900 Subject: split wizard into separate files so we don't go nuts yet. --- src/leap/gui/firstrun/last.py | 89 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/leap/gui/firstrun/last.py (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py new file mode 100644 index 00000000..6f9abbb5 --- /dev/null +++ b/src/leap/gui/firstrun/last.py @@ -0,0 +1,89 @@ +""" +Last Page, used in First Run Wizard +""" +import logging + +from PyQt4 import QtGui + +from leap.util.coroutines import coroutine +from leap.gui.constants import APP_LOGO + +logger = logging.getLogger(__name__) + + +class LastPage(QtGui.QWizardPage): + def __init__(self, parent=None): + super(LastPage, self).__init__(parent) + + self.setTitle("Connecting to Encrypted Internet Proxy service...") + + self.setPixmap( + QtGui.QWizard.LogoPixmap, + QtGui.QPixmap(APP_LOGO)) + + #self.setPixmap( + #QtGui.QWizard.WatermarkPixmap, + #QtGui.QPixmap(':/images/watermark2.png')) + + self.label = QtGui.QLabel() + self.label.setWordWrap(True) + + self.status_line_1 = QtGui.QLabel() + self.status_line_2 = QtGui.QLabel() + self.status_line_3 = QtGui.QLabel() + self.status_line_4 = QtGui.QLabel() + + layout = QtGui.QVBoxLayout() + layout.addWidget(self.label) + + # make loop + layout.addWidget(self.status_line_1) + layout.addWidget(self.status_line_2) + layout.addWidget(self.status_line_3) + layout.addWidget(self.status_line_4) + + self.setLayout(layout) + + def set_status_line(self, line, status): + statusline = getattr(self, 'status_line_%s' % line) + if statusline: + statusline.setText(status) + + def set_finished_status(self): + self.setTitle('You are now using an encrypted connection!') + finishText = self.wizard().buttonText( + QtGui.QWizard.FinishButton) + finishText = finishText.replace('&', '') + self.label.setText( + "Click '%s' to end the wizard and " + "save your settings." % finishText) + + @coroutine + def eip_status_handler(self): + # XXX this can be changed to use + # signals. See progress.py + logger.debug('logging status in last page') + self.validation_done = False + status_count = 0 + try: + while True: + status = (yield) + status_count += 1 + # XXX add to line... + logger.debug('status --> %s', status) + self.set_status_line(status_count, status) + if status == "connected": + self.set_finished_status() + break + except GeneratorExit: + pass + + def initializePage(self): + wizard = self.wizard() + if not wizard: + return + eip_status_handler = self.eip_status_handler() + eip_statuschange_signal = wizard.eip_statuschange_signal + if eip_statuschange_signal: + eip_statuschange_signal.connect( + lambda status: eip_status_handler.send(status)) -- cgit v1.2.3 From d2dcf5a1060d60c451570349a6a06ad102d6924c Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 13 Nov 2012 21:54:04 +0900 Subject: fix missing provider parameter in leapconfig objects chain --- src/leap/gui/firstrun/last.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index 6f9abbb5..13b2f548 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -28,6 +28,7 @@ class LastPage(QtGui.QWizardPage): self.label = QtGui.QLabel() self.label.setWordWrap(True) + # XXX REFACTOR to a Validating Page... self.status_line_1 = QtGui.QLabel() self.status_line_2 = QtGui.QLabel() self.status_line_3 = QtGui.QLabel() -- cgit v1.2.3 From 1bb7e85425f2f427401cd02726c55922874a59a0 Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 27 Nov 2012 03:34:08 +0900 Subject: login validation inline --- src/leap/gui/firstrun/last.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index 13b2f548..d33d2e77 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -78,6 +78,8 @@ class LastPage(QtGui.QWizardPage): break except GeneratorExit: pass + except StopIteration: + pass def initializePage(self): wizard = self.wizard() -- cgit v1.2.3 From 89694babd14a9b2ba76095911b6884e359a12282 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 17 Dec 2012 05:05:37 +0900 Subject: network checker launched by signal fixes problem with provider domain not being defined during first run. --- src/leap/gui/firstrun/last.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index d33d2e77..1d8caca4 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -58,6 +58,8 @@ class LastPage(QtGui.QWizardPage): self.label.setText( "Click '%s' to end the wizard and " "save your settings." % finishText) + # XXX init network checker + # trigger signal @coroutine def eip_status_handler(self): -- cgit v1.2.3 From 8e6a15e2f2d35c606aa0c1a2102c28ceccc23b78 Mon Sep 17 00:00:00 2001 From: antialias Date: Mon, 7 Jan 2013 16:50:52 -0400 Subject: this should be the complete list of userfacing strings. see #665. --- src/leap/gui/firstrun/last.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index 1d8caca4..e097b2ae 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -15,7 +15,7 @@ class LastPage(QtGui.QWizardPage): def __init__(self, parent=None): super(LastPage, self).__init__(parent) - self.setTitle("Connecting to Encrypted Internet Proxy service...") + self.setTitle(self.tr("Connecting to Encrypted Internet Proxy service...")) self.setPixmap( QtGui.QWizard.LogoPixmap, @@ -51,13 +51,13 @@ class LastPage(QtGui.QWizardPage): statusline.setText(status) def set_finished_status(self): - self.setTitle('You are now using an encrypted connection!') + self.setTitle(self.tr('You are now using an encrypted connection!')) finishText = self.wizard().buttonText( QtGui.QWizard.FinishButton) finishText = finishText.replace('&', '') - self.label.setText( + self.label.setText(self.tr( "Click '%s' to end the wizard and " - "save your settings." % finishText) + "save your settings." % finishText)) # XXX init network checker # trigger signal -- cgit v1.2.3 From 407b030bb7d27b797fb27254710a358c9c69f8be Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 24 Jan 2013 01:57:28 +0900 Subject: catch missing messages on last page of wizard --- src/leap/gui/firstrun/last.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/leap/gui/firstrun/last.py') 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 -- cgit v1.2.3 From 71cd4575a2641272f966cdb47a4f9504f31668a5 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 25 Jan 2013 18:13:15 +0900 Subject: disable finish button until connected --- src/leap/gui/firstrun/last.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index 32d98acc..f3e467db 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -29,6 +29,8 @@ class LastPage(QtGui.QWizardPage): self.label = QtGui.QLabel() self.label.setWordWrap(True) + self.wizard_done = False + # XXX REFACTOR to a Validating Page... self.status_line_1 = QtGui.QLabel() self.status_line_2 = QtGui.QLabel() @@ -48,6 +50,9 @@ class LastPage(QtGui.QWizardPage): self.setLayout(layout) + def isComplete(self): + return self.wizard_done + def set_status_line(self, line, status): statusline = getattr(self, 'status_line_%s' % line) if statusline: @@ -61,8 +66,8 @@ class LastPage(QtGui.QWizardPage): self.label.setText(self.tr( "Click '%s' to end the wizard and " "save your settings." % finishText)) - # XXX init network checker - # trigger signal + self.wizard_done = True + self.completeChanged.emit() @coroutine def eip_status_handler(self): @@ -80,7 +85,9 @@ class LastPage(QtGui.QWizardPage): self.set_status_line(status_count, status) if status == "connected": self.set_finished_status() + self.completeChanged.emit() break + self.completeChanged.emit() except GeneratorExit: pass except StopIteration: @@ -89,6 +96,8 @@ class LastPage(QtGui.QWizardPage): def initializePage(self): super(LastPage, self).initializePage() wizard = self.wizard() + wizard.button(QtGui.QWizard.FinishButton).setDisabled(True) + handler = self.eip_status_handler() # get statuses done in prev page @@ -101,6 +110,7 @@ class LastPage(QtGui.QWizardPage): eip_statuschange_signal.connect( lambda status: self.send_status( handler.send, status)) + self.completeChanged.emit() def send_status(self, cb, status): try: -- cgit v1.2.3 From 0f9a1d4bc85def69dae0621eb7daaf5a0ee48004 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 1 Feb 2013 00:49:10 +0900 Subject: add watermark image to wizard --- src/leap/gui/firstrun/last.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/leap/gui/firstrun/last.py') diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py index f3e467db..6a01ba34 100644 --- a/src/leap/gui/firstrun/last.py +++ b/src/leap/gui/firstrun/last.py @@ -6,7 +6,7 @@ import logging from PyQt4 import QtGui from leap.util.coroutines import coroutine -from leap.gui.constants import APP_LOGO +from leap.gui.constants import APP_LOGO, APP_WATERMARK logger = logging.getLogger(__name__) @@ -18,14 +18,14 @@ class LastPage(QtGui.QWizardPage): self.setTitle(self.tr( "Connecting to Encrypted Internet Proxy service...")) + self.setPixmap( + QtGui.QWizard.WatermarkPixmap, + QtGui.QPixmap(APP_WATERMARK)) + self.setPixmap( QtGui.QWizard.LogoPixmap, QtGui.QPixmap(APP_LOGO)) - #self.setPixmap( - #QtGui.QWizard.WatermarkPixmap, - #QtGui.QPixmap(':/images/watermark2.png')) - self.label = QtGui.QLabel() self.label.setWordWrap(True) -- cgit v1.2.3