diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-03-20 10:41:48 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-04-14 17:17:20 -0300 |
commit | e2ea44e2b042e86c0eb3a02eb52a92457b6bf179 (patch) | |
tree | 119c56e2bd8b7dbee2e3f14d96438156f9723894 /src/leap/bitmask/gui/mainwindow.py | |
parent | 64e25fc8cf8a2f8c1fec6388e1f76312831b5f2a (diff) |
Refactor EIPBootstrapper to the backend
Diffstat (limited to 'src/leap/bitmask/gui/mainwindow.py')
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 56ac1545..61aff5f9 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -61,7 +61,6 @@ from leap.bitmask.services.mail import conductor as mail_conductor from leap.bitmask.services import EIP_SERVICE, MX_SERVICE from leap.bitmask.services.eip import eipconfig from leap.bitmask.services.eip import get_openvpn_management -from leap.bitmask.services.eip.eipbootstrapper import EIPBootstrapper from leap.bitmask.services.eip.connection import EIPConnection from leap.bitmask.services.eip.vpnprocess import VPN from leap.bitmask.services.eip.vpnprocess import OpenVPNAlreadyRunning @@ -230,17 +229,6 @@ class MainWindow(QtGui.QMainWindow): self._backend_connect() - # This thread is similar to the provider bootstrapper - self._eip_bootstrapper = EIPBootstrapper() - - # EIP signals ---- move to eip conductor. - # TODO change the name of "download_config" signal to - # something less confusing (config_ready maybe) - self._eip_bootstrapper.download_config.connect( - self._eip_intermediate_stage) - self._eip_bootstrapper.download_client_certificate.connect( - self._finish_eip_bootstrap) - self._vpn = VPN(openvpn_verb=openvpn_verb) # connect vpn process signals @@ -410,6 +398,9 @@ class MainWindow(QtGui.QMainWindow): sig.prov_cancelled_setup.connect(self._set_login_cancelled) + sig.eip_download_config.connect(self._eip_intermediate_stage) + sig.eip_download_client_certificate.connect(self._finish_eip_bootstrap) + def _backend_disconnect(self): """ Helper to disconnect from backend signals. @@ -1802,17 +1793,16 @@ class MainWindow(QtGui.QMainWindow): Start the EIP bootstrapping sequence if the client is configured to do so. """ - leap_assert(self._eip_bootstrapper, "We need an eip bootstrapper!") - provider_config = self._get_best_provider_config() if self._provides_eip_and_enabled() and not self._already_started_eip: # XXX this should be handled by the state machine. self._eip_status.set_eip_status( self.tr("Starting...")) - self._eip_bootstrapper.run_eip_setup_checks( - provider_config, - download_if_needed=True) + + domain = self._login_widget.get_selected_provider() + self._backend.setup_eip(domain) + self._already_started_eip = True # we want to start soledad anyway after a certain timeout if eip # fails to come up @@ -1834,18 +1824,18 @@ class MainWindow(QtGui.QMainWindow): def _finish_eip_bootstrap(self, data): """ SLOT - TRIGGER: self._eip_bootstrapper.download_client_certificate + TRIGGER: self._backend.signaler.eip_download_client_certificate Starts the VPN thread if the eip configuration is properly loaded """ leap_assert(self._eip_config, "We need an eip config!") - passed = data[self._eip_bootstrapper.PASSED_KEY] + passed = data[self._backend.PASSED_KEY] if not passed: error_msg = self.tr("There was a problem with the provider") self._eip_status.set_eip_status(error_msg, error=True) - logger.error(data[self._eip_bootstrapper.ERROR_KEY]) + logger.error(data[self._backend.ERROR_KEY]) self._already_started_eip = False return @@ -1869,7 +1859,7 @@ class MainWindow(QtGui.QMainWindow): """ SLOT TRIGGERS: - self._eip_bootstrapper.download_config + self._backend.signaler.eip_download_config If there was a problem, displays it, otherwise it does nothing. This is used for intermediate bootstrapping stages, in case @@ -1964,7 +1954,7 @@ class MainWindow(QtGui.QMainWindow): self._backend.signaler.prov_name_resolution self._backend.signaler.prov_https_connection self._backend.signaler.prov_download_ca_cert - self._eip_bootstrapper.download_config + self._backend.signaler.eip_download_config If there was a problem, displays it, otherwise it does nothing. This is used for intermediate bootstrapping stages, in case |