summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-02-05 16:23:05 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-02-05 16:23:05 -0300
commit91f0a38f5911d0f26210f62a94ab46e741e30189 (patch)
treeb1ca4bcfab84ba9a8cec6baf9daf2c70cc22b6cd /src
parente046eeb7355a2ce3856eedee08bbc3d73ed7bbaa (diff)
parent1fa295ecd6af5c2ea64e76418bd144f9ddf4c803 (diff)
Merge branch 'release/0.8.x' into develop
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/config/tests/test_providerconfig.py12
-rw-r--r--src/leap/bitmask/crypto/tests/test_srpauth.py60
-rw-r--r--src/leap/bitmask/gui/advanced_key_management.py8
-rw-r--r--src/leap/bitmask/gui/app.py1
-rw-r--r--src/leap/bitmask/gui/eip_preferenceswindow.py6
-rw-r--r--src/leap/bitmask/gui/eip_status.py8
-rw-r--r--src/leap/bitmask/gui/login.py13
-rw-r--r--src/leap/bitmask/gui/mail_status.py12
-rw-r--r--src/leap/bitmask/gui/mainwindow.py200
-rw-r--r--src/leap/bitmask/gui/passwordwindow.py7
-rw-r--r--src/leap/bitmask/gui/preferences_account_page.py3
-rw-r--r--src/leap/bitmask/gui/preferences_vpn_page.py4
-rw-r--r--src/leap/bitmask/gui/preferenceswindow.py2
-rw-r--r--src/leap/bitmask/gui/providers.py1
-rw-r--r--src/leap/bitmask/gui/signaltracker.py1
-rw-r--r--src/leap/bitmask/gui/wizard.py49
-rw-r--r--src/leap/bitmask/provider/providerbootstrapper.py41
-rw-r--r--src/leap/bitmask/provider/tests/test_providerbootstrapper.py3
-rw-r--r--src/leap/bitmask/services/eip/conductor.py5
-rw-r--r--src/leap/bitmask/services/eip/eipbootstrapper.py11
-rw-r--r--src/leap/bitmask/services/eip/eipconfig.py2
-rw-r--r--src/leap/bitmask/util/polkit_agent.py18
22 files changed, 155 insertions, 312 deletions
diff --git a/src/leap/bitmask/config/tests/test_providerconfig.py b/src/leap/bitmask/config/tests/test_providerconfig.py
index fe27e683..7bc30f9c 100644
--- a/src/leap/bitmask/config/tests/test_providerconfig.py
+++ b/src/leap/bitmask/config/tests/test_providerconfig.py
@@ -258,18 +258,6 @@ class ProviderConfigTest(BaseLeapTest):
pc.load(data=json_string)
self.assertTrue('unknown' in pc.get_services())
- def test_get_services_string(self):
- pc = self._provider_config
- config = copy.deepcopy(sample_config)
- config['services'] = [
- 'openvpn', 'asdf', 'openvpn', 'not_supported_service']
- json_string = json.dumps(config)
- pc.load(data=json_string)
-
- self.assertEqual(pc.get_services_string(),
- "Encrypted Internet, asdf, Encrypted Internet,"
- " not_supported_service")
-
if __name__ == "__main__":
unittest.main()
diff --git a/src/leap/bitmask/crypto/tests/test_srpauth.py b/src/leap/bitmask/crypto/tests/test_srpauth.py
index 511a12ed..d420ef93 100644
--- a/src/leap/bitmask/crypto/tests/test_srpauth.py
+++ b/src/leap/bitmask/crypto/tests/test_srpauth.py
@@ -27,6 +27,7 @@ import sys
import binascii
import requests
import mock
+import shutil
from functools import partial
@@ -42,6 +43,7 @@ from leap.bitmask.crypto import srpregister, srpauth
from leap.bitmask.crypto.tests import fake_provider
from leap.bitmask.util.request_helpers import get_content
from leap.common.testing.https_server import where
+from leap.common.files import mkdir_p
log.startLogging(sys.stdout)
@@ -118,6 +120,10 @@ class SRPAuthTestCase(unittest.TestCase):
self.old_cookie_get = self.auth_backend._session.cookies.get
self.old_auth = self.auth_backend.authenticate
+ # HACK: this is needed since it seems that the backend settings path is
+ # not using the right path
+ mkdir_p('config/leap')
+
def tearDown(self):
self.auth_backend._session.post = self.old_post
self.auth_backend._session.put = self.old_put
@@ -132,6 +138,10 @@ class SRPAuthTestCase(unittest.TestCase):
self.auth_backend._session.cookies.get = self.old_cookie_get
self.auth_backend.authenticate = self.old_auth
+ # HACK: see 'setUp'
+ if os.path.exists('config'):
+ shutil.rmtree('config')
+
# helper methods
def _get_https_uri(self):
@@ -711,56 +721,6 @@ class SRPAuthSingletonTestCase(unittest.TestCase):
self.assertEqual(obj1._SRPAuth__instance, obj2._SRPAuth__instance)
@deferred()
- def test_authenticate_notifies_gui(self):
- auth = srpauth.SRPAuth(ProviderConfig())
- auth._SRPAuth__instance.authenticate = mock.create_autospec(
- auth._SRPAuth__instance.authenticate,
- return_value=threads.deferToThread(lambda: None))
- auth._gui_notify = mock.create_autospec(
- auth._gui_notify)
-
- d = auth.authenticate("", "")
-
- def check(*args):
- auth._gui_notify.assert_called_once_with(None)
-
- d.addCallback(check)
- return d
-
- @deferred()
- def test_authenticate_errsback(self):
- auth = srpauth.SRPAuth(ProviderConfig())
- auth._SRPAuth__instance.authenticate = mock.create_autospec(
- auth._SRPAuth__instance.authenticate,
- return_value=threads.deferToThread(MagicMock(
- side_effect=Exception())))
- auth._gui_notify = mock.create_autospec(
- auth._gui_notify)
- auth._errback = mock.create_autospec(
- auth._errback)
-
- d = auth.authenticate("", "")
-
- def check(*args):
- self.assertFalse(auth._gui_notify.called)
- self.assertEqual(auth._errback.call_count, 1)
-
- d.addCallback(check)
- return d
-
- @deferred()
- def test_authenticate_runs_cleanly_when_raises(self):
- auth = srpauth.SRPAuth(ProviderConfig())
- auth._SRPAuth__instance.authenticate = mock.create_autospec(
- auth._SRPAuth__instance.authenticate,
- return_value=threads.deferToThread(MagicMock(
- side_effect=Exception())))
-
- d = auth.authenticate("", "")
-
- return d
-
- @deferred()
def test_authenticate_runs_cleanly(self):
auth = srpauth.SRPAuth(ProviderConfig())
auth._SRPAuth__instance.authenticate = mock.create_autospec(
diff --git a/src/leap/bitmask/gui/advanced_key_management.py b/src/leap/bitmask/gui/advanced_key_management.py
index 48a1db93..7d147b7b 100644
--- a/src/leap/bitmask/gui/advanced_key_management.py
+++ b/src/leap/bitmask/gui/advanced_key_management.py
@@ -132,7 +132,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
else:
logger.debug('Import canceled by the user.')
- @QtCore.Slot()
def _keymanager_import_ok(self):
"""
TRIGGERS:
@@ -144,7 +143,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
self, self.tr("Import Successful"),
self.tr("The key pair was imported successfully."))
- @QtCore.Slot()
def _import_ioerror(self):
"""
TRIGGERS:
@@ -157,7 +155,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
self.tr("There was an error accessing the file.\n"
"Import canceled."))
- @QtCore.Slot()
def _import_datamismatch(self):
"""
TRIGGERS:
@@ -171,7 +168,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
"same address and fingerprint.\n"
"Import canceled."))
- @QtCore.Slot()
def _import_missingkey(self):
"""
TRIGGERS:
@@ -185,7 +181,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
"key in the same file.\n"
"Import canceled."))
- @QtCore.Slot()
def _import_addressmismatch(self):
"""
TRIGGERS:
@@ -212,7 +207,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
else:
logger.debug('Export canceled by the user.')
- @QtCore.Slot()
def _keymanager_export_ok(self):
"""
TRIGGERS:
@@ -225,7 +219,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
self.tr("The key pair was exported successfully.\n"
"Please, store your private key in a safe place."))
- @QtCore.Slot()
def _keymanager_export_error(self):
"""
TRIGGERS:
@@ -238,7 +231,6 @@ class AdvancedKeyManagement(QtGui.QDialog):
self.tr("There was an error accessing the file.\n"
"Export canceled."))
- @QtCore.Slot()
def _keymanager_keys_list(self, keys):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py
index 75dc4a38..5fe031b1 100644
--- a/src/leap/bitmask/gui/app.py
+++ b/src/leap/bitmask/gui/app.py
@@ -50,7 +50,6 @@ class App(QtGui.QWidget):
self._backend_checker.timeout.connect(self._check_backend_status)
self._backend_checker.start(2000)
- @QtCore.Slot()
def _check_backend_status(self):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/eip_preferenceswindow.py b/src/leap/bitmask/gui/eip_preferenceswindow.py
index b5788f3c..8939c709 100644
--- a/src/leap/bitmask/gui/eip_preferenceswindow.py
+++ b/src/leap/bitmask/gui/eip_preferenceswindow.py
@@ -99,7 +99,6 @@ class EIPPreferencesWindow(QtGui.QDialog):
self._backend.eip_get_initialized_providers(domains=providers)
- @QtCore.Slot(list)
def _load_providers_in_combo(self, providers):
"""
TRIGGERS:
@@ -132,7 +131,6 @@ class EIPPreferencesWindow(QtGui.QDialog):
domain, QtCore.Qt.MatchStartsWith)
self.ui.cbProvidersGateway.setCurrentIndex(provider_index)
- @QtCore.Slot(str)
def _save_selected_gateway(self, provider):
"""
TRIGGERS:
@@ -159,7 +157,6 @@ class EIPPreferencesWindow(QtGui.QDialog):
"Gateway settings for provider '{0}' saved.").format(provider)
self._set_providers_gateway_status(msg, success=True)
- @QtCore.Slot(int)
def _populate_gateways(self, domain_idx):
"""
TRIGGERS:
@@ -182,7 +179,6 @@ class EIPPreferencesWindow(QtGui.QDialog):
self._backend.eip_get_gateways_list(domain=domain)
- @QtCore.Slot(list)
def _update_gateways_list(self, gateways):
"""
TRIGGERS:
@@ -223,7 +219,6 @@ class EIPPreferencesWindow(QtGui.QDialog):
self.ui.cbGateways.setCurrentIndex(index)
- @QtCore.Slot()
def _gateways_list_error(self):
"""
TRIGGERS:
@@ -238,7 +233,6 @@ class EIPPreferencesWindow(QtGui.QDialog):
self.ui.pbSaveGateway.setEnabled(False)
self.ui.cbGateways.setEnabled(False)
- @QtCore.Slot()
def _gateways_list_uninitialized(self):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py
index 14ff5972..83490cac 100644
--- a/src/leap/bitmask/gui/eip_status.py
+++ b/src/leap/bitmask/gui/eip_status.py
@@ -137,7 +137,6 @@ class EIPStatusWidget(QtGui.QWidget):
self.ui.btnUpload.clicked.connect(onclicked)
self.ui.btnDownload.clicked.connect(onclicked)
- @QtCore.Slot()
def _on_VPN_status_clicked(self):
"""
TRIGGERS:
@@ -295,7 +294,6 @@ class EIPStatusWidget(QtGui.QWidget):
msg = self.tr("Encrypted Internet is starting")
self.set_eip_message(msg)
- @QtCore.Slot()
def disable_eip_start(self):
"""
Triggered when a default provider_config has not been found.
@@ -327,7 +325,6 @@ class EIPStatusWidget(QtGui.QWidget):
self._eip_disabled_action)
self._eip_status_menu.menuAction().setVisible(False)
- @QtCore.Slot()
def enable_eip_start(self):
"""
Triggered after a successful login.
@@ -452,7 +449,6 @@ class EIPStatusWidget(QtGui.QWidget):
self.user_cancelled = True
self.hide_eip_cancel_button()
- @QtCore.Slot(dict)
def eip_stopped(self, restart=False, failed=False):
"""
TRIGGERS:
@@ -500,7 +496,6 @@ class EIPStatusWidget(QtGui.QWidget):
"unencrypted traffic."))
self.show_fw_down_button()
- @QtCore.Slot(dict)
def update_vpn_status(self, data=None):
"""
TRIGGERS:
@@ -535,7 +530,6 @@ class EIPStatusWidget(QtGui.QWidget):
self.ui.btnUpload.setText(upload_str)
self.ui.btnDownload.setText(download_str)
- @QtCore.Slot(dict)
def update_vpn_state(self, vpn_state):
"""
TRIGGERS:
@@ -674,7 +668,6 @@ class EIPStatusWidget(QtGui.QWidget):
# Slots for signals
#
- @QtCore.Slot()
def _on_eip_connection_aborted(self):
"""
TRIGGERS:
@@ -773,7 +766,6 @@ class EIPStatusWidget(QtGui.QWidget):
"""
self.eip_conductor.reconnect_stop_signal()
- @QtCore.Slot()
def _on_eip_network_unreachable(self):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/login.py b/src/leap/bitmask/gui/login.py
index 7487e888..90df0b73 100644
--- a/src/leap/bitmask/gui/login.py
+++ b/src/leap/bitmask/gui/login.py
@@ -133,7 +133,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self._set_logged_out()
- @QtCore.Slot(int)
def _remember_state_changed(self, state):
"""
Save the remember state in the LeapSettings.
@@ -145,7 +144,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
# are: Checked, Unchecked and PartiallyChecked
self._settings.set_remember(state == QtCore.Qt.Checked)
- @QtCore.Slot(unicode)
def _credentials_changed(self, text):
"""
TRIGGER:
@@ -431,7 +429,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self._backend.user_cancel_login()
self._set_logged_out()
- @QtCore.Slot()
def _set_login_cancelled(self):
"""
TRIGGERS:
@@ -443,7 +440,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self.set_status(self.tr("Log in cancelled by the user."))
self.set_enabled(True)
- @QtCore.Slot(dict)
def _provider_setup_intermediate(self, data):
"""
TRIGGERS:
@@ -457,7 +453,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
logger.error(data[ERROR_KEY])
self._login_problem_provider()
- @QtCore.Slot()
def _login_problem_provider(self):
"""
Warn the user about a problem with the provider during login.
@@ -465,7 +460,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self.set_status(self.tr("Unable to login: Problem with provider"))
self.set_enabled(True)
- @QtCore.Slot(dict)
def _load_provider_config(self, data):
"""
TRIGGERS:
@@ -485,7 +479,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self._backend.provider_bootstrap(provider=self._provider)
- @QtCore.Slot(dict)
def _provider_config_loaded(self, data):
"""
TRIGGERS:
@@ -528,7 +521,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self.ui.logged_widget.show()
self.ui.lblUser.setText(fullname)
- @QtCore.Slot()
def _authentication_finished(self):
"""
TRIGGERS:
@@ -538,11 +530,11 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
"""
self.set_status(self.tr("Succeeded"), error=False)
self._set_logged_in()
+ self.disconnect_and_untrack()
if not flags.OFFLINE:
self.login_finished.emit()
- @QtCore.Slot(unicode)
def _authentication_error(self, msg):
"""
TRIGGERS:
@@ -574,7 +566,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self.set_enabled(True)
self.set_status("", error=False)
- @QtCore.Slot()
def do_logout(self):
"""
TRIGGER:
@@ -612,7 +603,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self.ui.btnLogout.setEnabled(True)
self.ui.clblErrorMsg.hide()
- @QtCore.Slot()
def _logout_error(self):
"""
TRIGGER:
@@ -623,7 +613,6 @@ class LoginWidget(QtGui.QWidget, SignalTracker):
self._set_logging_out(False)
self.set_status(self.tr("Something went wrong with the logout."))
- @QtCore.Slot()
def _logout_ok(self):
"""
TRIGGER:
diff --git a/src/leap/bitmask/gui/mail_status.py b/src/leap/bitmask/gui/mail_status.py
index 92e1e4c4..bbfbafb5 100644
--- a/src/leap/bitmask/gui/mail_status.py
+++ b/src/leap/bitmask/gui/mail_status.py
@@ -184,7 +184,6 @@ class MailStatusWidget(QtGui.QWidget):
leap_assert_type(action_mail_status, QtGui.QAction)
self._action_mail_status = action_mail_status
- @QtCore.Slot()
def set_soledad_failed(self):
"""
TRIGGERS:
@@ -195,7 +194,6 @@ class MailStatusWidget(QtGui.QWidget):
msg = self.tr("There was an unexpected problem with Soledad.")
self._set_mail_status(msg, ready=-1)
- @QtCore.Slot()
def set_soledad_invalid_auth_token(self):
"""
TRIGGERS:
@@ -250,7 +248,6 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._soledad_event.emit(req)
- @QtCore.Slot(object)
def _mail_handle_soledad_events_slot(self, req):
"""
TRIGGERS:
@@ -285,7 +282,6 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._keymanager_event.emit(req)
- @QtCore.Slot(object)
def _mail_handle_keymanager_events_slot(self, req):
"""
TRIGGERS:
@@ -332,7 +328,6 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._smtp_event.emit(req)
- @QtCore.Slot(object)
def _mail_handle_smtp_events_slot(self, req):
"""
TRIGGERS:
@@ -367,7 +362,6 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._imap_event.emit(req)
- @QtCore.Slot(object)
def _mail_handle_imap_events_slot(self, req):
"""
TRIGGERS:
@@ -419,7 +413,6 @@ class MailStatusWidget(QtGui.QWidget):
# XXX make the signal emit the label and state.
- @QtCore.Slot()
def mail_state_disconnected(self):
"""
Display the correct UI for the disconnected state.
@@ -431,7 +424,6 @@ class MailStatusWidget(QtGui.QWidget):
else:
self._set_mail_status(self.tr("OFF"), -1)
- @QtCore.Slot()
def mail_state_connecting(self):
"""
Display the correct UI for the connecting state.
@@ -440,21 +432,18 @@ class MailStatusWidget(QtGui.QWidget):
self._started = True
self._set_mail_status(self.tr("Starting..."), 1)
- @QtCore.Slot()
def mail_state_disconnecting(self):
"""
Display the correct UI for the connecting state.
"""
self._set_mail_status(self.tr("Disconnecting..."), 1)
- @QtCore.Slot()
def mail_state_connected(self):
"""
Display the correct UI for the connected state.
"""
self._set_mail_status(self.tr("ON"), 2)
- @QtCore.Slot()
def mail_state_disabled(self):
"""
Display the correct UI for the disabled state.
@@ -464,7 +453,6 @@ class MailStatusWidget(QtGui.QWidget):
self._service_name)
self._set_mail_status(status, -1)
- @QtCore.Slot()
def soledad_invalid_auth_token(self):
"""
Display the correct UI for the invalid token state
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index b0826303..f5983abb 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -207,7 +207,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self.ui.action_preferences.triggered.connect(self._show_preferences)
self.ui.action_about_leap.triggered.connect(self._about)
self.ui.action_quit.triggered.connect(self.quit)
- self.ui.action_wizard.triggered.connect(self._launch_wizard)
+ self.ui.action_wizard.triggered.connect(self._show_wizard)
self.ui.action_show_logs.triggered.connect(self._show_logger_window)
# XXX hide the help menu since it only shows email information and
@@ -288,17 +288,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
if self._first_run():
self._wizard_firstrun = True
-
- # HACK FIX: disconnection of signals triggers a reconnection later
- # chich segfaults on wizard quit
- # self.disconnect_and_untrack()
-
- self._wizard = Wizard(backend=self._backend,
- leap_signaler=self._leap_signaler)
- # Give this window time to finish init and then show the wizard
- QtDelayedCall(1, self._launch_wizard)
- self._wizard.accepted.connect(self._finish_init)
- self._wizard.rejected.connect(self._rejected_wizard)
+ self._show_wizard()
else:
# during finish_init, we disable the eip start button
# so this has to be done after eip_machine is started
@@ -346,7 +336,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# XXX does this goes in here? this will be triggered when the login or
# wizard requests provider data
- # XXX - here segfaults if we did a disconnect_and_untrack
conntrack(sig.prov_check_api_certificate, self._get_provider_details)
conntrack(sig.prov_get_details, self._provider_get_details)
@@ -402,54 +391,26 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# TODO: connect this with something
# sig.soledad_cancelled_bootstrap.connect()
- @QtCore.Slot()
- def _rejected_wizard(self):
- """
- TRIGGERS:
- self._wizard.rejected
-
- Called if the wizard has been cancelled or closed before
- finishing.
- This is executed for the first run wizard only. Any other execution of
- the wizard won't reach this point.
- """
- providers = self._settings.get_configured_providers()
- has_provider_on_disk = len(providers) != 0
- if not has_provider_on_disk:
- # if we don't have any provider configured (included a pinned
- # one) we can't use the application, so quit.
- self.quit()
- else:
- # This happens if the user finishes the provider
- # setup but does not register
- self._wizard = None
-
- # HACK FIX: disconnection of signals triggers a reconnection later
- # chich segfaults on wizard quit
- # self._backend_connect(only_tracked=True)
-
- if self._wizard_firstrun:
- self._finish_init()
-
- @QtCore.Slot()
- def _launch_wizard(self):
+ def _show_wizard(self):
"""
TRIGGERS:
self.ui.action_wizard.triggered
- Also called in first run.
+ This is called during the Bitmask's first run.
- Launches the wizard, creating the object itself if not already
- there.
+ Open the wizard window, hiding the mainwindow window.
+ This reuses an existing wizard object or creates a new one if needed.
"""
+ # Disconnect signals to avoid conflicts between mainwindow and wizard
+ # connections
+ self.disconnect_and_untrack()
+
if self._wizard is None:
- # HACK FIX: disconnection of signals triggers a reconnection later
- # chich segfaults on wizard quit
- # self.disconnect_and_untrack()
self._wizard = Wizard(backend=self._backend,
leap_signaler=self._leap_signaler)
- self._wizard.accepted.connect(self._finish_init)
- self._wizard.rejected.connect(self._rejected_wizard)
+ self._wizard.accepted.connect(self._wizard_accepted)
+ self._wizard.rejected.connect(self._wizard_rejected)
+ self._wizard.finished.connect(self._wizard_finished)
self.setVisible(False)
# Do NOT use exec_, it will use a child event loop!
@@ -457,10 +418,8 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._wizard.show()
if IS_MAC:
self._wizard.raise_()
- self._wizard.finished.connect(self._wizard_finished)
self._settings.set_skip_first_run(True)
- @QtCore.Slot()
def _wizard_finished(self):
"""
TRIGGERS:
@@ -469,6 +428,72 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
Called when the wizard has finished.
"""
self.setVisible(True)
+ self._backend_connect(only_tracked=True)
+
+ def _wizard_rejected(self):
+ """
+ TRIGGERS:
+ self._wizard.rejected
+
+ Called if the wizard has been cancelled or closed before finishing.
+ """
+ # NOTE: We need to verify if we have configured providers.
+ # If not then we should quit
+ # see self._rejected_wizard()
+ providers = self._settings.get_configured_providers()
+ has_provider_on_disk = len(providers) != 0
+ if not has_provider_on_disk:
+ # if we don't have any provider configured (included a pinned
+ # one) we can't use the application, so quit.
+ self._wizard = None
+ self.quit()
+ else:
+ # This happens if the user finishes the provider
+ # setup but does not register
+ self._wizard = None
+
+ # self._backend_connect(only_tracked=True)
+ # if self._wizard_firstrun:
+ # self._finish_init()
+
+ def _wizard_accepted(self):
+ """
+ TRIGGERS:
+ self._wizard.accepted
+
+ Called when the wizard has accepted.
+ """
+ self.setVisible(True)
+ self._finish_init()
+
+ def _load_from_wizard(self):
+ """
+ Load the resulting information of the user going through the Wizard.
+ Trigger the login sequence if needed.
+ """
+ possible_username = self._wizard.get_username()
+ possible_password = self._wizard.get_password()
+
+ # select the configured provider in the combo box
+ domain = self._wizard.get_domain()
+ self._providers.select_provider_by_name(domain)
+ self._login_widget.set_provider(domain)
+
+ self._login_widget.set_remember(self._wizard.get_remember())
+ self._enabled_services = list(self._wizard.get_services())
+ self._settings.set_enabled_services(
+ self._providers.get_selected_provider(),
+ self._enabled_services)
+
+ if possible_username is not None:
+ self._login_widget.set_user(possible_username)
+ if possible_password is not None:
+ self._login_widget.set_password(possible_password)
+ self._login()
+ else:
+ self.eip_needs_login.emit()
+
+ self._wizard = None
def _get_leap_logging_handler(self):
"""
@@ -485,7 +510,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
return h
return None
- @QtCore.Slot()
def _show_logger_window(self):
"""
TRIGGERS:
@@ -502,7 +526,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
lw = LoggerWindow(self, handler=leap_log_handler)
lw.show()
- @QtCore.Slot()
def _show_AKM(self):
"""
TRIGGERS:
@@ -522,7 +545,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._backend, self._soledad_started)
akm.show()
- @QtCore.Slot()
def _show_preferences(self):
"""
TRIGGERS:
@@ -542,7 +564,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
pref_win = PreferencesWindow(self, account, self.app)
pref_win.show()
- @QtCore.Slot(object, list)
def _update_eip_enabled_status(self, account=None, services=None):
"""
TRIGGER:
@@ -649,7 +670,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# so we must update it, otherwise we're in a deadlock.
self._trying_to_start_eip = False
- @QtCore.Slot()
def _disable_eip_missing_helpers(self):
"""
TRIGGERS:
@@ -672,7 +692,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
"""
self.new_updates.emit(req)
- @QtCore.Slot(object)
def _react_to_new_updates(self, req):
"""
TRIGGERS:
@@ -688,7 +707,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self.ui.btnMore.setVisible(True)
self._updates_content = req.content
- @QtCore.Slot()
def _updates_details(self):
"""
TRIGGERS:
@@ -716,7 +734,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self.tr("Updates available"),
msg)
- @QtCore.Slot()
def _finish_init(self):
"""
TRIGGERS:
@@ -729,7 +746,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
the wizard has been executed.
"""
# XXX: May be this can be divided into two methods?
-
providers = self._settings.get_configured_providers()
self._providers.set_providers(providers)
@@ -755,30 +771,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
QtDelayedCall(1, self._update_eip_enabled_status)
if self._wizard:
- possible_username = self._wizard.get_username()
- possible_password = self._wizard.get_password()
-
- # select the configured provider in the combo box
- domain = self._wizard.get_domain()
- self._providers.select_provider_by_name(domain)
-
- self._login_widget.set_remember(self._wizard.get_remember())
- self._enabled_services = list(self._wizard.get_services())
- self._settings.set_enabled_services(
- self._providers.get_selected_provider(),
- self._enabled_services)
- if possible_username is not None:
- self._login_widget.set_user(possible_username)
- if possible_password is not None:
- self._login_widget.set_password(possible_password)
- self._login()
- else:
- self.eip_needs_login.emit()
-
- self._wizard = None
- # HACK FIX: disconnection of signals triggers a reconnection later
- # chich segfaults on wizard quit
- # self._backend_connect(only_tracked=True)
+ self._load_from_wizard()
else:
domain = self._settings.get_provider()
if domain is not None:
@@ -887,7 +880,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# we wait for the systray to be ready
QtDelayedCall(1000, hello)
- @QtCore.Slot(int)
def _tray_activated(self, reason=None):
"""
TRIGGERS:
@@ -906,7 +898,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# this works however.
context_menu.exec_(self._systray.geometry().center())
- @QtCore.Slot()
def _ensure_visible(self):
"""
TRIGGERS:
@@ -925,7 +916,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self.activateWindow()
self.raise_()
- @QtCore.Slot()
def _ensure_invisible(self):
"""
TRIGGERS:
@@ -961,7 +951,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
if state is not None:
self.restoreState(state)
- @QtCore.Slot()
def _about(self):
"""
TRIGGERS:
@@ -989,7 +978,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
msg = msg.format(ver=VERSION, ver_hash=VERSION_HASH[:10], greet=greet)
QtGui.QMessageBox.about(self, title, msg)
- @QtCore.Slot()
def _help(self):
"""
TRIGGERS:
@@ -1091,7 +1079,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
skip_first_run = self._settings.get_skip_first_run()
return not (has_provider_on_disk and skip_first_run)
- @QtCore.Slot()
def _disconnect_login_wait(self):
"""
Disconnect the EIP finishing signal to the wait flag on the login
@@ -1109,7 +1096,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# signal not connected
pass
- @QtCore.Slot(object)
def _on_provider_changed(self, wizard=True):
"""
TRIGGERS:
@@ -1132,7 +1118,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
if not something_runing:
if wizard:
- self._launch_wizard()
+ self._show_wizard()
else:
self._settings.set_provider(provider)
self._settings.set_defaultprovider(provider)
@@ -1161,13 +1147,12 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._update_eip_enabled_status()
self._eip_conductor.qtsigs.do_disconnect_signal.emit()
if wizard:
- self._launch_wizard()
+ self._show_wizard()
else:
if not wizard:
# if wizard, the widget restores itself
self._providers.restore_previous_provider()
- @QtCore.Slot()
def _login(self):
"""
TRIGGERS:
@@ -1195,7 +1180,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._soledad_started = False
- @QtCore.Slot()
def _on_user_logged_in(self):
"""
TRIGGERS:
@@ -1224,7 +1208,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
if MX_SERVICE not in self._provider_details['services']:
self._set_mx_visible(False)
- @QtCore.Slot()
def _on_user_logged_out(self):
"""
TRIGGER:
@@ -1253,8 +1236,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._maybe_start_eip()
- @QtCore.Slot()
- def _get_provider_details(self):
+ def _get_provider_details(self, data):
"""
TRIGGERS:
prov_check_api_certificate
@@ -1267,7 +1249,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
lang = QtCore.QLocale.system().name()
self._backend.provider_get_details(domain=domain, lang=lang)
- @QtCore.Slot()
def _provider_get_details(self, details):
"""
Set the details for the just downloaded provider.
@@ -1311,7 +1292,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
return eip_enabled and eip_provided
- @QtCore.Slot()
def _maybe_run_soledad_setup_checks(self):
"""
TRIGGERS:
@@ -1352,7 +1332,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
###################################################################
# Service control methods: soledad
- @QtCore.Slot()
def _on_soledad_ready(self):
"""
TRIGGERS:
@@ -1367,7 +1346,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
###################################################################
# Service control methods: mail
- @QtCore.Slot()
def _start_mail_service(self):
if self._provides_mx_and_enabled() or flags.OFFLINE:
self._mail_conductor.start_mail_service(download_if_needed=True,
@@ -1376,14 +1354,12 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
###################################################################
# Service control methods: eip
- @QtCore.Slot()
def _disable_eip_start_action(self):
"""
Disable the EIP start action in the systray menu.
"""
self._action_eip_startstop.setEnabled(False)
- @QtCore.Slot()
def _enable_eip_start_action(self):
"""
Enable the EIP start action in the systray menu.
@@ -1391,7 +1367,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._action_eip_startstop.setEnabled(True)
self._eip_status.enable_eip_start()
- @QtCore.Slot()
def _on_eip_connecting(self):
"""
TRIGGERS:
@@ -1415,7 +1390,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
eip_sigs.connection_aborted_signal.connect(slot)
eip_sigs.connection_died_signal.connect(slot)
- @QtCore.Slot()
def _on_eip_connection_connected(self):
"""
TRIGGERS:
@@ -1435,7 +1409,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# check for connectivity
self._backend.eip_check_dns(domain=domain)
- @QtCore.Slot()
def _on_eip_connection_disconnected(self):
"""
TRIGGERS:
@@ -1445,7 +1418,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
"""
self._already_started_eip = False
- @QtCore.Slot()
def _set_eip_provider(self, country_code=None):
"""
TRIGGERS:
@@ -1457,7 +1429,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
domain = self._providers.get_selected_provider()
self._eip_status.set_provider(domain, country_code)
- @QtCore.Slot()
def _eip_dns_error(self):
"""
Trigger this if we don't have a working DNS resolver.
@@ -1549,7 +1520,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# eip will not start, so we start soledad anyway
self._maybe_run_soledad_setup_checks()
- @QtCore.Slot(dict)
def _finish_eip_bootstrap(self, data):
"""
TRIGGERS:
@@ -1570,7 +1540,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
# DO START EIP Connection!
self._eip_conductor.do_connect()
- @QtCore.Slot(dict)
def _eip_intermediate_stage(self, data):
# TODO missing param documentation
"""
@@ -1604,7 +1573,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
locks.raise_window_ack()
self.raise_window.emit()
- @QtCore.Slot()
def _do_raise_mainwindow(self):
"""
TRIGGERS:
@@ -1707,7 +1675,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
logger.debug("Killing backend")
psutil.Process(self._backend_pid).kill()
- @QtCore.Slot()
def _remove_service(self, service):
"""
Remove the given service from the waiting list and check if we have
@@ -1724,7 +1691,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
logger.debug("All services stopped.")
self.all_services_stopped.emit()
- @QtCore.Slot()
def final_quit(self):
"""
Final steps to quit the app, starting from here we don't care about
diff --git a/src/leap/bitmask/gui/passwordwindow.py b/src/leap/bitmask/gui/passwordwindow.py
index f7ef079e..88565829 100644
--- a/src/leap/bitmask/gui/passwordwindow.py
+++ b/src/leap/bitmask/gui/passwordwindow.py
@@ -149,7 +149,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
self._soledad_ready = False
sig.soledad_bootstrap_finished.connect(self._on_soledad_ready)
- @QtCore.Slot()
def _change_password(self):
"""
TRIGGERS:
@@ -194,7 +193,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
PasswordWindow._current_window = None
self.deleteLater()
- @QtCore.Slot()
def _srp_change_password_ok(self):
"""
TRIGGERS:
@@ -210,7 +208,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
else:
self._change_password_success()
- @QtCore.Slot()
def _srp_password_change_error(self):
"""
TRIGGERS:
@@ -223,7 +220,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
self._enable_password_widgets(True)
self.flash_error(msg)
- @QtCore.Slot()
def _srp_password_change_badpw(self):
"""
TRIGGERS:
@@ -237,7 +233,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
self.flash_error(msg)
self.ui.current_password_lineedit.setFocus()
- @QtCore.Slot()
def _soledad_change_password_ok(self):
"""
TRIGGERS:
@@ -248,7 +243,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
logger.debug("Soledad password changed successfully.")
self._change_password_success()
- @QtCore.Slot(unicode)
def _soledad_change_password_problem(self, msg):
"""
TRIGGERS:
@@ -263,7 +257,6 @@ class PasswordWindow(QtGui.QDialog, Flashable):
self._enable_password_widgets(True)
self.flash_error(msg)
- @QtCore.Slot()
def _on_soledad_ready(self):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/preferences_account_page.py b/src/leap/bitmask/gui/preferences_account_page.py
index ec6a7716..cab90eec 100644
--- a/src/leap/bitmask/gui/preferences_account_page.py
+++ b/src/leap/bitmask/gui/preferences_account_page.py
@@ -63,7 +63,6 @@ class PreferencesAccountPage(QtGui.QWidget):
self.ui.change_password_label.setVisible(True)
self.ui.change_password_button.setEnabled(False)
- @QtCore.Slot(str, int)
def _service_selection_changed(self, service, state):
"""
TRIGGERS:
@@ -94,7 +93,6 @@ class PreferencesAccountPage(QtGui.QWidget):
# emit signal alerting change
self.app.service_selection_changed.emit(self.account, services)
- @QtCore.Slot(str)
def _load_services(self, services):
"""
TRIGGERS:
@@ -133,7 +131,6 @@ class PreferencesAccountPage(QtGui.QWidget):
logger.error("Something went wrong while trying to "
"load service %s" % (service,))
- @QtCore.Slot()
def _show_change_password(self):
change_password_window = PasswordWindow(self, self.account, self.app)
change_password_window.show()
diff --git a/src/leap/bitmask/gui/preferences_vpn_page.py b/src/leap/bitmask/gui/preferences_vpn_page.py
index 901116b4..5b5c9604 100644
--- a/src/leap/bitmask/gui/preferences_vpn_page.py
+++ b/src/leap/bitmask/gui/preferences_vpn_page.py
@@ -64,7 +64,6 @@ class PreferencesVpnPage(QtGui.QWidget, Flashable):
# Trigger update
self.app.backend.eip_get_gateways_list(domain=self.account.domain)
- @QtCore.Slot(str)
def _save_selected_gateway(self, index):
"""
TRIGGERS:
@@ -86,7 +85,6 @@ class PreferencesVpnPage(QtGui.QWidget, Flashable):
provider=self.account.domain,
gateway=gateway)
- @QtCore.Slot(list)
def _update_gateways_list(self, gateways):
"""
TRIGGERS:
@@ -116,7 +114,6 @@ class PreferencesVpnPage(QtGui.QWidget, Flashable):
index = idx + 1
self.ui.gateways_list.setCurrentRow(index)
- @QtCore.Slot()
def _gateways_list_error(self):
"""
TRIGGERS:
@@ -129,7 +126,6 @@ class PreferencesVpnPage(QtGui.QWidget, Flashable):
self.tr("Error loading configuration file."))
self.ui.gateways_list.setEnabled(False)
- @QtCore.Slot()
def _gateways_list_uninitialized(self):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py
index f1252301..daad08b0 100644
--- a/src/leap/bitmask/gui/preferenceswindow.py
+++ b/src/leap/bitmask/gui/preferenceswindow.py
@@ -152,7 +152,6 @@ class PreferencesWindow(QtGui.QDialog):
self._email_page.deleteLater()
self.deleteLater()
- @QtCore.Slot()
def _change_page(self, current, previous):
"""
TRIGGERS:
@@ -170,7 +169,6 @@ class PreferencesWindow(QtGui.QDialog):
current = previous
self.ui.pages_widget.setCurrentIndex(self.ui.nav_widget.row(current))
- @QtCore.Slot(object, list)
def _update_icons(self, account, services):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/providers.py b/src/leap/bitmask/gui/providers.py
index 6954411f..4a6f961a 100644
--- a/src/leap/bitmask/gui/providers.py
+++ b/src/leap/bitmask/gui/providers.py
@@ -98,7 +98,6 @@ class Providers(QtCore.QObject):
self._combo.setCurrentIndex(prev_provider)
self._combo.blockSignals(False)
- @QtCore.Slot(int)
def _current_provider_changed(self, idx):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/gui/signaltracker.py b/src/leap/bitmask/gui/signaltracker.py
index c83359c4..0e3b2dce 100644
--- a/src/leap/bitmask/gui/signaltracker.py
+++ b/src/leap/bitmask/gui/signaltracker.py
@@ -57,7 +57,6 @@ class SignalTracker(QtCore.QObject):
try:
signal.disconnect(method)
except (TypeError, RuntimeError) as e:
- # most likely the signal was not connected
logger.warning("Disconnect error: {0!r}".format(e))
logger.warning("Signal: {0!r} -> {1!r}".format(signal, method))
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index 35043a68..5da021d1 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -82,9 +82,8 @@ class Wizard(QtGui.QWizard, SignalTracker):
self._use_existing_provider = False
self.ui.grpCheckProvider.setVisible(False)
- conntrack = self.connect_and_track
- conntrack(self.ui.btnCheck.clicked, self._check_provider)
- conntrack(self.ui.lnProvider.returnPressed, self._check_provider)
+ self.ui.btnCheck.clicked.connect(self._check_provider)
+ self.ui.lnProvider.returnPressed.connect(self._check_provider)
self._leap_signaler = leap_signaler
@@ -96,22 +95,19 @@ class Wizard(QtGui.QWizard, SignalTracker):
# this details are set when the provider download is complete.
self._provider_details = None
- conntrack(self.currentIdChanged, self._current_id_changed)
+ self.currentIdChanged.connect(self._current_id_changed)
- conntrack(self.ui.lnProvider.textChanged, self._enable_check)
- conntrack(self.ui.rbNewProvider.toggled,
- lambda x: self._enable_check())
- conntrack(self.ui.cbProviders.currentIndexChanged[int],
- self._reset_provider_check)
+ self.ui.lnProvider.textChanged.connect(self._enable_check)
+ self.ui.rbNewProvider.toggled.connect(lambda x: self._enable_check())
+ self.ui.cbProviders.currentIndexChanged[int].connect(
+ self._reset_provider_check)
- conntrack(self.ui.lblUser.returnPressed, self._focus_password)
- conntrack(self.ui.lblPassword.returnPressed,
- self._focus_second_password)
- conntrack(self.ui.lblPassword2.returnPressed, self._register)
- conntrack(self.ui.btnRegister.clicked, self._register)
+ self.ui.lblUser.returnPressed.connect(self._focus_password)
+ self.ui.lblPassword.returnPressed.connect(self._focus_second_password)
+ self.ui.lblPassword2.returnPressed.connect(self._register)
+ self.ui.btnRegister.clicked.connect(self._register)
- conntrack(self.ui.rbExistingProvider.toggled,
- self._skip_provider_checks)
+ self.ui.rbExistingProvider.toggled.connect(self._skip_provider_checks)
usernameRe = QtCore.QRegExp(USERNAME_REGEX)
self.ui.lblUser.setValidator(
@@ -136,9 +132,8 @@ class Wizard(QtGui.QWizard, SignalTracker):
self._provider_checks_ok = False
self._provider_setup_ok = False
- conntrack(self.finished, self._wizard_finished)
+ self.finished.connect(self._wizard_finished)
- @QtCore.Slot()
def _wizard_finished(self):
"""
TRIGGERS:
@@ -152,8 +147,7 @@ class Wizard(QtGui.QWizard, SignalTracker):
self._provider_setup_ok = False
self.ui.lnProvider.setText('')
self.ui.grpCheckProvider.setVisible(False)
- # HACK FIX: disconnection of signals triggers a segfault on quit
- # self.disconnect_and_untrack()
+ self.disconnect_and_untrack()
def _load_configured_providers(self):
"""
@@ -250,7 +244,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
def get_services(self):
return self._selected_services
- @QtCore.Slot(unicode)
def _enable_check(self, reset=True):
"""
TRIGGERS:
@@ -340,7 +333,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
# register button
self.ui.btnRegister.setVisible(visible)
- @QtCore.Slot()
def _registration_finished(self):
"""
TRIGGERS:
@@ -366,7 +358,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self.page(self.REGISTER_USER_PAGE).set_completed()
self.button(QtGui.QWizard.BackButton).setEnabled(False)
- @QtCore.Slot()
def _registration_failed(self):
"""
TRIGGERS:
@@ -380,7 +371,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self._set_register_status(error_msg, error=True)
self.ui.btnRegister.setEnabled(True)
- @QtCore.Slot()
def _registration_taken(self):
"""
TRIGGERS:
@@ -427,7 +417,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self.ui.lblCheckCaFpr.setPixmap(None)
self.ui.lblCheckApiCert.setPixmap(None)
- @QtCore.Slot()
def _check_provider(self):
"""
TRIGGERS:
@@ -461,7 +450,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self.ui.lblNameResolution.setPixmap(self.QUESTION_ICON)
self._backend.provider_setup(provider=self._domain)
- @QtCore.Slot(bool)
def _skip_provider_checks(self, skip):
"""
TRIGGERS:
@@ -505,7 +493,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
label.setPixmap(self.ERROR_ICON)
logger.error(error)
- @QtCore.Slot(dict)
def _name_resolution(self, data):
"""
TRIGGERS:
@@ -525,7 +512,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self.ui.btnCheck.setEnabled(not passed)
self.ui.lnProvider.setEnabled(not passed)
- @QtCore.Slot(dict)
def _https_connection(self, data):
"""
TRIGGERS:
@@ -545,7 +531,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self.ui.btnCheck.setEnabled(not passed)
self.ui.lnProvider.setEnabled(not passed)
- @QtCore.Slot(dict)
def _download_provider_info(self, data):
"""
TRIGGERS:
@@ -581,7 +566,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
else:
self.ui.cbProviders.setEnabled(True)
- @QtCore.Slot()
def _provider_get_details(self, details):
"""
Set the details for the just downloaded provider.
@@ -591,7 +575,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
"""
self._provider_details = details
- @QtCore.Slot(dict)
def _download_ca_cert(self, data):
"""
TRIGGERS:
@@ -604,7 +587,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
if passed:
self.ui.lblCheckCaFpr.setPixmap(self.QUESTION_ICON)
- @QtCore.Slot(dict)
def _check_ca_fingerprint(self, data):
"""
TRIGGERS:
@@ -617,7 +599,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
if passed:
self.ui.lblCheckApiCert.setPixmap(self.QUESTION_ICON)
- @QtCore.Slot(dict)
def _check_api_certificate(self, data):
"""
TRIGGERS:
@@ -631,7 +612,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
True, self.SETUP_PROVIDER_PAGE)
self._provider_setup_ok = True
- @QtCore.Slot(str, int)
def _service_selection_changed(self, service, state):
"""
TRIGGERS:
@@ -680,7 +660,6 @@ class Wizard(QtGui.QWizard, SignalTracker):
self.tr("Something went wrong while trying to "
"load service %s" % (service,)))
- @QtCore.Slot(int)
def _current_id_changed(self, pageId):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py
index 8eefb9d9..efba29f9 100644
--- a/src/leap/bitmask/provider/providerbootstrapper.py
+++ b/src/leap/bitmask/provider/providerbootstrapper.py
@@ -225,8 +225,9 @@ class ProviderBootstrapper(AbstractBootstrapper):
if flags.APP_VERSION_CHECK:
# TODO split
if not provider.supports_client(min_client_version):
- self._signaler.signal(
- self._signaler.prov_unsupported_client)
+ if self._signaler is not None:
+ self._signaler.signal(
+ self._signaler.prov_unsupported_client)
raise UnsupportedClientVersionError()
provider_definition, mtime = get_content(res)
@@ -248,7 +249,9 @@ class ProviderBootstrapper(AbstractBootstrapper):
'Found: {1}.').format(api_supported, api_version)
logger.error(error)
- self._signaler.signal(self._signaler.prov_unsupported_api)
+ if self._signaler is not None:
+ self._signaler.signal(
+ self._signaler.prov_unsupported_api)
raise UnsupportedProviderAPI(error)
def run_provider_select_checks(self, domain, download_if_needed=False):
@@ -267,12 +270,18 @@ class ProviderBootstrapper(AbstractBootstrapper):
self._domain = ProviderConfig.sanitize_path_component(domain)
self._download_if_needed = download_if_needed
+ name_resolution = None
+ https_connection = None
+ down_provider_info = None
+ if self._signaler is not None:
+ name_resolution = self._signaler.prov_name_resolution
+ https_connection = self._signaler.prov_https_connection
+ down_provider_info = self._signaler.prov_download_provider_info
+
cb_chain = [
- (self._check_name_resolution,
- self._signaler.prov_name_resolution),
- (self._check_https, self._signaler.prov_https_connection),
- (self._download_provider_info,
- self._signaler.prov_download_provider_info)
+ (self._check_name_resolution, name_resolution),
+ (self._check_https, https_connection),
+ (self._download_provider_info, down_provider_info)
]
return self.addCallbackChain(cb_chain)
@@ -398,12 +407,18 @@ class ProviderBootstrapper(AbstractBootstrapper):
self._provider_config = provider_config
self._download_if_needed = download_if_needed
+ download_ca_cert = None
+ check_ca_fingerprint = None
+ check_api_certificate = None
+ if self._signaler is not None:
+ download_ca_cert = self._signaler.prov_download_ca_cert
+ check_ca_fingerprint = self._signaler.prov_check_ca_fingerprint
+ check_api_certificate = self._signaler.prov_check_api_certificate
+
cb_chain = [
- (self._download_ca_cert, self._signaler.prov_download_ca_cert),
- (self._check_ca_fingerprint,
- self._signaler.prov_check_ca_fingerprint),
- (self._check_api_certificate,
- self._signaler.prov_check_api_certificate)
+ (self._download_ca_cert, download_ca_cert),
+ (self._check_ca_fingerprint, check_ca_fingerprint),
+ (self._check_api_certificate, check_api_certificate)
]
return self.addCallbackChain(cb_chain)
diff --git a/src/leap/bitmask/provider/tests/test_providerbootstrapper.py b/src/leap/bitmask/provider/tests/test_providerbootstrapper.py
index 6cf3e469..e694e456 100644
--- a/src/leap/bitmask/provider/tests/test_providerbootstrapper.py
+++ b/src/leap/bitmask/provider/tests/test_providerbootstrapper.py
@@ -38,7 +38,6 @@ from requests.models import Response
from leap.bitmask import provider
from leap.bitmask import util
-from leap.bitmask.backend import Signaler
from leap.bitmask.config.providerconfig import ProviderConfig
from leap.bitmask.crypto.tests import fake_provider
from leap.bitmask.provider.providerbootstrapper import ProviderBootstrapper
@@ -51,7 +50,7 @@ from leap.common.testing.https_server import where
class ProviderBootstrapperTest(BaseLeapTest):
def setUp(self):
- self.pb = ProviderBootstrapper(Signaler())
+ self.pb = ProviderBootstrapper()
def tearDown(self):
pass
diff --git a/src/leap/bitmask/services/eip/conductor.py b/src/leap/bitmask/services/eip/conductor.py
index 01dd7449..3fc88724 100644
--- a/src/leap/bitmask/services/eip/conductor.py
+++ b/src/leap/bitmask/services/eip/conductor.py
@@ -130,7 +130,6 @@ class EIPConductor(object):
"""
self.qtsigs.do_disconnect_signal.emit()
- @QtCore.Slot()
def _start_eip(self):
"""
Start EIP.
@@ -174,7 +173,6 @@ class EIPConductor(object):
self.qtsigs.disconnecting_signal.disconnect()
self.qtsigs.disconnecting_signal.connect(do_stop)
- @QtCore.Slot()
def _stop_eip(self, restart=False, failed=False):
"""
TRIGGERS:
@@ -244,7 +242,6 @@ class EIPConductor(object):
if restart:
QtDelayedCall(2000, self.reconnect_stop_signal)
- @QtCore.Slot()
def _do_eip_restart(self):
"""
TRIGGERS:
@@ -266,7 +263,6 @@ class EIPConductor(object):
self.qtsigs.disconnecting_signal.connect(do_stop)
self.qtsigs.do_disconnect_signal.emit()
- @QtCore.Slot()
def _do_eip_failed(self):
"""
Stop EIP after a failure to start.
@@ -278,7 +274,6 @@ class EIPConductor(object):
self.qtsigs.connection_died_signal.emit()
QtDelayedCall(1000, self._eip_status.eip_failed_to_connect)
- @QtCore.Slot(int)
def _eip_finished(self, exitCode):
"""
TRIGGERS:
diff --git a/src/leap/bitmask/services/eip/eipbootstrapper.py b/src/leap/bitmask/services/eip/eipbootstrapper.py
index 264eac2e..f78113bc 100644
--- a/src/leap/bitmask/services/eip/eipbootstrapper.py
+++ b/src/leap/bitmask/services/eip/eipbootstrapper.py
@@ -115,10 +115,15 @@ class EIPBootstrapper(AbstractBootstrapper):
self._provider_config = provider_config
self._download_if_needed = download_if_needed
+ eip_config_ready = None
+ eip_certificate_ready = None
+ if self._signaler is not None:
+ eip_config_ready = self._signaler.eip_config_ready
+ eip_certificate_ready = self._signaler.eip_client_certificate_ready
+
cb_chain = [
- (self._download_config, self._signaler.eip_config_ready),
- (self._download_client_certificates,
- self._signaler.eip_client_certificate_ready)
+ (self._download_config, eip_config_ready),
+ (self._download_client_certificates, eip_certificate_ready)
]
return self.addCallbackChain(cb_chain)
diff --git a/src/leap/bitmask/services/eip/eipconfig.py b/src/leap/bitmask/services/eip/eipconfig.py
index 659ca1b1..f4d6b216 100644
--- a/src/leap/bitmask/services/eip/eipconfig.py
+++ b/src/leap/bitmask/services/eip/eipconfig.py
@@ -118,6 +118,8 @@ class VPNGatewaySelector(object):
"""
gateways_timezones = []
locations = self._eipconfig.get_locations()
+ if not locations:
+ locations = {}
gateways = self._eipconfig.get_gateways()
for idx, gateway in enumerate(gateways):
diff --git a/src/leap/bitmask/util/polkit_agent.py b/src/leap/bitmask/util/polkit_agent.py
index af5e431c..e512bffa 100644
--- a/src/leap/bitmask/util/polkit_agent.py
+++ b/src/leap/bitmask/util/polkit_agent.py
@@ -23,22 +23,18 @@ import subprocess
import daemon
+# TODO --- logger won't work when daemoninzed. Log to syslog instead?
logger = logging.getLogger(__name__)
-AUTH_FILE = "polkit-%s-authentication-agent-1"
-BASE_PATH_GNO = "/usr/lib/policykit-1-gnome/"
-BASE_PATH_KDE = "/usr/lib/kde4/libexec/"
-GNO_PATH = BASE_PATH_GNO + AUTH_FILE % ("gnome",)
-KDE_PATH = BASE_PATH_KDE + AUTH_FILE % ("kde",)
-
-POLKIT_PATHS = {
+POLKIT_PATHS = (
'/usr/lib/lxpolkit/lxpolkit',
- '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1',
+ '/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1',
'/usr/lib/mate-polkit/polkit-mate-authentication-agent-1',
'/usr/lib/kde4/libexec/polkit-kde-authentication-agent-1',
-}
+)
+# TODO write tests for this piece.
def _get_polkit_agent():
"""
Return a valid polkit agent to use.
@@ -62,7 +58,7 @@ def _launch_agent():
polkit_agent = _get_polkit_agent()
if polkit_agent is None:
- logger.erro("No usable polkit was found.")
+ logger.error("No usable polkit was found.")
return
logger.debug('Launching polkit auth agent')
@@ -81,4 +77,6 @@ def launch():
_launch_agent()
if __name__ == "__main__":
+ # TODO pass a --nodaemon flag so that we can launch this in the foreground
+ # and debug this module, getting errors to stderr.
launch()