From 655cec1fec89eb30fc17bdc0a5f527e5a91ba5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Tue, 4 Jun 2013 12:56:17 -0300 Subject: Remove CheckerThread from SRPAuth Also, some pep8 fixes --- src/leap/crypto/srpauth.py | 60 ------------------------------ src/leap/gui/mainwindow.py | 6 +-- src/leap/services/abstractbootstrapper.py | 1 - src/leap/services/eip/eipbootstrapper.py | 3 +- src/leap/services/mail/smtpbootstrapper.py | 3 +- 5 files changed, 7 insertions(+), 66 deletions(-) diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py index f1897e1d..28086279 100644 --- a/src/leap/crypto/srpauth.py +++ b/src/leap/crypto/srpauth.py @@ -29,7 +29,6 @@ from PySide import QtCore, QtGui from leap.common.check import leap_assert from leap.config.providerconfig import ProviderConfig -from leap.util.checkerthread import CheckerThread from leap.util.request_helpers import get_content from leap.common.events import signal as events_signal from leap.common.events import events_pb2 as proto @@ -456,62 +455,3 @@ class SRPAuth(QtCore.QObject): except Exception as e: self.logout_finished.emit(False, "%s" % (e,)) return False - - -if __name__ == "__main__": - import signal - import sys - - from functools import partial - app = QtGui.QApplication(sys.argv) - - if not len(sys.argv) == 3: - print 'Usage: srpauth.py ' - sys.exit(0) - - _user = sys.argv[1] - _pass = sys.argv[2] - - def sigint_handler(*args, **kwargs): - logger.debug('SIGINT catched. shutting down...') - checker = args[0] - checker.set_should_quit() - QtGui.QApplication.quit() - - def signal_tester(d): - print d - - logger = logging.getLogger(name='leap') - logger.setLevel(logging.DEBUG) - console = logging.StreamHandler() - console.setLevel(logging.DEBUG) - formatter = logging.Formatter( - '%(asctime)s ' - '- %(name)s - %(levelname)s - %(message)s') - console.setFormatter(formatter) - logger.addHandler(console) - - checker = CheckerThread() - - sigint = partial(sigint_handler, checker) - signal.signal(signal.SIGINT, sigint) - - timer = QtCore.QTimer() - timer.start(500) - timer.timeout.connect(lambda: None) - app.connect(app, QtCore.SIGNAL("aboutToQuit()"), - checker.set_should_quit) - w = QtGui.QWidget() - w.resize(100, 100) - w.show() - - checker.start() - - provider = ProviderConfig() - if provider.load("leap/providers/bitmask.net/provider.json"): - auth = SRPAuth(provider) - auth_instantiated = partial(auth.authenticate, _user, _pass) - - checker.add_checks([auth_instantiated, auth.logout]) - - sys.exit(app.exec_()) diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index 25478aa1..89f06a1c 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -815,12 +815,12 @@ class MainWindow(QtGui.QMainWindow): True) else: if self._enabled_services.count(self.MX_SERVICE) > 0: - pass # TODO: show MX status + pass # TODO: show MX status #self._set_eip_status(self.tr("%s does not support MX") % - # (self._provider_config.get_domain(),), + # (self._provider_config.get_domain(),), # error=True) else: - pass # TODO: show MX status + pass # TODO: show MX status #self._set_eip_status(self.tr("MX is disabled")) def _smtp_bootstrapped_stage(self, data): diff --git a/src/leap/services/abstractbootstrapper.py b/src/leap/services/abstractbootstrapper.py index bce03e6b..7bebdc15 100644 --- a/src/leap/services/abstractbootstrapper.py +++ b/src/leap/services/abstractbootstrapper.py @@ -152,4 +152,3 @@ class AbstractBootstrapper(QtCore.QObject): d.addErrback(self._errback, signal=sig) d.addCallback(self._gui_notify, signal=sig) d.addErrback(self._gui_errback) - diff --git a/src/leap/services/eip/eipbootstrapper.py b/src/leap/services/eip/eipbootstrapper.py index 7216bb80..51c3dab4 100644 --- a/src/leap/services/eip/eipbootstrapper.py +++ b/src/leap/services/eip/eipbootstrapper.py @@ -173,7 +173,8 @@ class EIPBootstrapper(AbstractBootstrapper): cb_chain = [ (self._download_config, self.download_config), - (self._download_client_certificates, self.download_client_certificate) + (self._download_client_certificates, \ + self.download_client_certificate) ] self.addCallbackChain(cb_chain) diff --git a/src/leap/services/mail/smtpbootstrapper.py b/src/leap/services/mail/smtpbootstrapper.py index 64bf3153..ea480c6d 100644 --- a/src/leap/services/mail/smtpbootstrapper.py +++ b/src/leap/services/mail/smtpbootstrapper.py @@ -96,7 +96,8 @@ class SMTPBootstrapper(AbstractBootstrapper): logger.debug("SMTP definition has not been modified") self._smtp_config.load(os.path.join("leap", "providers", - self._provider_config.get_domain(), + self._provider_config.\ + get_domain(), "smtp-service.json")) else: smtp_definition, mtime = get_content(res) -- cgit v1.2.3