summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/feature-5506_use-pyside-slot-decorator1
-rw-r--r--src/leap/bitmask/gui/eip_preferenceswindow.py15
-rw-r--r--src/leap/bitmask/gui/eip_status.py20
-rw-r--r--src/leap/bitmask/gui/login.py14
-rw-r--r--src/leap/bitmask/gui/mail_status.py28
-rw-r--r--src/leap/bitmask/gui/mainwindow.py164
-rw-r--r--src/leap/bitmask/gui/preferenceswindow.py28
-rw-r--r--src/leap/bitmask/gui/wizard.py79
-rw-r--r--src/leap/bitmask/services/mail/conductor.py5
9 files changed, 200 insertions, 154 deletions
diff --git a/changes/feature-5506_use-pyside-slot-decorator b/changes/feature-5506_use-pyside-slot-decorator
new file mode 100644
index 00000000..7a9ea20e
--- /dev/null
+++ b/changes/feature-5506_use-pyside-slot-decorator
@@ -0,0 +1 @@
+- Use PySide @Slot decorator instead of 'SLOT' docstring. Closes #5506.
diff --git a/src/leap/bitmask/gui/eip_preferenceswindow.py b/src/leap/bitmask/gui/eip_preferenceswindow.py
index baf17395..530cd38d 100644
--- a/src/leap/bitmask/gui/eip_preferenceswindow.py
+++ b/src/leap/bitmask/gui/eip_preferenceswindow.py
@@ -98,9 +98,9 @@ class EIPPreferencesWindow(QtGui.QDialog):
self._backend.eip_get_initialized_providers(providers)
+ @QtCore.Slot(list)
def _load_providers_in_combo(self, providers):
"""
- SLOT
TRIGGERS:
Signaler.eip_get_initialized_providers
@@ -128,9 +128,9 @@ class EIPPreferencesWindow(QtGui.QDialog):
domain, QtCore.Qt.MatchStartsWith)
self.ui.cbProvidersGateway.setCurrentIndex(provider_index)
+ @QtCore.Slot(str)
def _save_selected_gateway(self, provider):
"""
- SLOT
TRIGGERS:
self.ui.pbSaveGateway.clicked
@@ -153,9 +153,9 @@ 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):
"""
- SLOT
TRIGGERS:
self.ui.cbProvidersGateway.currentIndexChanged[unicode]
@@ -176,12 +176,15 @@ class EIPPreferencesWindow(QtGui.QDialog):
self._backend.eip_get_gateways_list(domain)
+ @QtCore.Slot(list)
def _update_gateways_list(self, gateways):
"""
- SLOT
TRIGGERS:
Signaler.eip_get_gateways_list
+ :param gateways: a list of gateways
+ :type gateways: list of unicode
+
Add the available gateways and select the one stored in configuration
file.
"""
@@ -214,9 +217,9 @@ class EIPPreferencesWindow(QtGui.QDialog):
self.ui.cbGateways.setCurrentIndex(index)
+ @QtCore.Slot()
def _gateways_list_error(self):
"""
- SLOT
TRIGGERS:
Signaler.eip_get_gateways_list_error
@@ -229,9 +232,9 @@ class EIPPreferencesWindow(QtGui.QDialog):
self.ui.pbSaveGateway.setEnabled(False)
self.ui.cbGateways.setEnabled(False)
+ @QtCore.Slot()
def _gateways_list_uninitialized(self):
"""
- SLOT
TRIGGERS:
Signaler.eip_uninitialized_provider
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py
index f24d87c7..0d75b8e5 100644
--- a/src/leap/bitmask/gui/eip_status.py
+++ b/src/leap/bitmask/gui/eip_status.py
@@ -88,11 +88,12 @@ class EIPStatusWidget(QtGui.QWidget):
self.ui.btnUpload.clicked.connect(onclicked)
self.ui.btnDownload.clicked.connect(onclicked)
+ @QtCore.Slot()
def _on_VPN_status_clicked(self):
"""
- SLOT
- TRIGGER: self.ui.btnUpload.clicked
- self.ui.btnDownload.clicked
+ TRIGGERS:
+ self.ui.btnUpload.clicked
+ self.ui.btnDownload.clicked
Toggles between rate and total throughput display for vpn
status figures.
@@ -347,10 +348,11 @@ class EIPStatusWidget(QtGui.QWidget):
self.tr("Traffic is being routed in the clear"))
self.ui.lblEIPStatus.show()
+ @QtCore.Slot(dict)
def update_vpn_status(self, data=None):
"""
- SLOT
- TRIGGER: Signaler.eip_status_changed
+ TRIGGERS:
+ Signaler.eip_status_changed
Updates the download/upload labels based on the data provided by the
VPN thread.
@@ -381,14 +383,18 @@ 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):
"""
- SLOT
- TRIGGER: Signaler.eip_state_changed
+ TRIGGERS:
+ Signaler.eip_state_changed
Updates the displayed VPN state based on the data provided by
the VPN thread.
+ :param vpn_state: the state of the VPN
+ :type vpn_state: dict
+
Emits:
If the vpn_state is connected, we emit EIPConnection.qtsigs.
connected_signal
diff --git a/src/leap/bitmask/gui/login.py b/src/leap/bitmask/gui/login.py
index 4a483c32..ac7ad878 100644
--- a/src/leap/bitmask/gui/login.py
+++ b/src/leap/bitmask/gui/login.py
@@ -259,12 +259,16 @@ class LoginWidget(QtGui.QWidget):
"""
self.ui.lnPassword.setFocus()
- def _current_provider_changed(self, param):
+ @QtCore.Slot(int)
+ def _current_provider_changed(self, idx):
"""
- SLOT
- TRIGGERS: self.ui.cmbProviders.currentIndexChanged
+ TRIGGERS:
+ self.ui.cmbProviders.currentIndexChanged
+
+ :param idx: the index of the new selected item
+ :type idx: int
"""
- if param == (self.ui.cmbProviders.count() - 1):
+ if idx == (self.ui.cmbProviders.count() - 1):
self.show_wizard.emit()
# Leave the previously selected provider in the combobox
prev_provider = 0
@@ -274,7 +278,7 @@ class LoginWidget(QtGui.QWidget):
self.ui.cmbProviders.setCurrentIndex(prev_provider)
self.ui.cmbProviders.blockSignals(False)
else:
- self._selected_provider_index = param
+ self._selected_provider_index = idx
def start_login(self):
"""
diff --git a/src/leap/bitmask/gui/mail_status.py b/src/leap/bitmask/gui/mail_status.py
index 44a138e2..d3346780 100644
--- a/src/leap/bitmask/gui/mail_status.py
+++ b/src/leap/bitmask/gui/mail_status.py
@@ -184,10 +184,10 @@ 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):
"""
- SLOT
- TRIGGER:
+ TRIGGERS:
SoledadBootstrapper.soledad_failed
This method is called whenever soledad has a failure.
@@ -195,10 +195,10 @@ 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):
"""
- SLOT
- TRIGGER:
+ TRIGGERS:
SoledadBootstrapper.soledad_invalid_token
This method is called when the auth token is invalid
@@ -250,10 +250,11 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._soledad_event.emit(req)
+ @QtCore.Slot(object)
def _mail_handle_soledad_events_slot(self, req):
"""
- SLOT
- TRIGGER: _mail_handle_soledad_events
+ TRIGGERS:
+ _mail_handle_soledad_events
Reacts to an Soledad event
@@ -284,10 +285,11 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._keymanager_event.emit(req)
+ @QtCore.Slot(object)
def _mail_handle_keymanager_events_slot(self, req):
"""
- SLOT
- TRIGGER: _mail_handle_keymanager_events
+ TRIGGERS:
+ _mail_handle_keymanager_events
Reacts to an KeyManager event
@@ -330,10 +332,11 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._smtp_event.emit(req)
+ @QtCore.Slot(object)
def _mail_handle_smtp_events_slot(self, req):
"""
- SLOT
- TRIGGER: _mail_handle_smtp_events
+ TRIGGERS:
+ _mail_handle_smtp_events
Reacts to an SMTP event
@@ -364,10 +367,11 @@ class MailStatusWidget(QtGui.QWidget):
"""
self._imap_event.emit(req)
+ @QtCore.Slot(object)
def _mail_handle_imap_events_slot(self, req):
"""
- SLOT
- TRIGGER: _mail_handle_imap_events
+ TRIGGERS:
+ _mail_handle_imap_events
Reacts to an IMAP event
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index e5c11eb7..b911e5d8 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -457,10 +457,11 @@ class MainWindow(QtGui.QMainWindow):
self._backend_connected_signals = {}
+ @QtCore.Slot()
def _rejected_wizard(self):
"""
- SLOT
- TRIGGERS: self._wizard.rejected
+ TRIGGERS:
+ self._wizard.rejected
Called if the wizard has been cancelled or closed before
finishing.
@@ -481,12 +482,12 @@ class MainWindow(QtGui.QMainWindow):
if self._wizard_firstrun:
self._finish_init()
+ @QtCore.Slot()
def _launch_wizard(self):
"""
- SLOT
TRIGGERS:
- self._login_widget.show_wizard
- self.ui.action_wizard.triggered
+ self._login_widget.show_wizard
+ self.ui.action_wizard.triggered
Also called in first run.
@@ -509,11 +510,11 @@ class MainWindow(QtGui.QMainWindow):
self._wizard.finished.connect(self._wizard_finished)
self._settings.set_skip_first_run(True)
+ @QtCore.Slot()
def _wizard_finished(self):
"""
- SLOT
- TRIGGERS
- self._wizard.finished
+ TRIGGERS:
+ self._wizard.finished
Called when the wizard has finished.
"""
@@ -534,11 +535,11 @@ class MainWindow(QtGui.QMainWindow):
return h
return None
+ @QtCore.Slot()
def _show_logger_window(self):
"""
- SLOT
TRIGGERS:
- self.ui.action_show_logs.triggered
+ self.ui.action_show_logs.triggered
Displays the window with the history of messages logged until now
and displays the new ones on arrival.
@@ -555,9 +556,9 @@ class MainWindow(QtGui.QMainWindow):
else:
self._logger_window.setVisible(not self._logger_window.isVisible())
+ @QtCore.Slot()
def _show_AKM(self):
"""
- SLOT
TRIGGERS:
self.ui.action_advanced_key_management.triggered
@@ -569,12 +570,12 @@ class MainWindow(QtGui.QMainWindow):
logged_user, self._keymanager, self._soledad)
self._akm.show()
+ @QtCore.Slot()
def _show_preferences(self):
"""
- SLOT
TRIGGERS:
- self.ui.btnPreferences.clicked (disabled for now)
- self.ui.action_preferences
+ self.ui.btnPreferences.clicked (disabled for now)
+ self.ui.action_preferences
Displays the preferences window.
"""
@@ -586,9 +587,9 @@ class MainWindow(QtGui.QMainWindow):
preferences.show()
preferences.preferences_saved.connect(self._update_eip_enabled_status)
+ @QtCore.Slot()
def _update_eip_enabled_status(self):
"""
- SLOT
TRIGGER:
PreferencesWindow.preferences_saved
@@ -622,12 +623,12 @@ class MainWindow(QtGui.QMainWindow):
return eip_enabled
+ @QtCore.Slot()
def _show_eip_preferences(self):
"""
- SLOT
TRIGGERS:
- self.ui.btnEIPPreferences.clicked
- self.ui.action_eip_preferences (disabled for now)
+ self.ui.btnEIPPreferences.clicked
+ self.ui.action_eip_preferences (disabled for now)
Displays the EIP preferences window.
"""
@@ -647,22 +648,27 @@ class MainWindow(QtGui.QMainWindow):
"""
self.new_updates.emit(req)
+ @QtCore.Slot(object)
def _react_to_new_updates(self, req):
"""
- SLOT
- TRIGGER: self._new_updates_available
+ TRIGGERS:
+ self.new_updates
Displays the new updates label and sets the updates_content
+
+ :param req: Request type
+ :type req: leap.common.events.events_pb2.SignalRequest
"""
self.moveToThread(QtCore.QCoreApplication.instance().thread())
self.ui.lblNewUpdates.setVisible(True)
self.ui.btnMore.setVisible(True)
self._updates_content = req.content
+ @QtCore.Slot()
def _updates_details(self):
"""
- SLOT
- TRIGGER: self.ui.btnMore.clicked
+ TRIGGERS:
+ self.ui.btnMore.clicked
Parses and displays the updates details
"""
@@ -686,11 +692,11 @@ class MainWindow(QtGui.QMainWindow):
self.tr("Updates available"),
msg)
+ @QtCore.Slot()
def _finish_init(self):
"""
- SLOT
TRIGGERS:
- self._wizard.accepted
+ self._wizard.accepted
Also called at the end of the constructor if not first run.
@@ -832,10 +838,14 @@ class MainWindow(QtGui.QMainWindow):
# we wait for the systray to be ready
reactor.callLater(1, hello)
+ @QtCore.Slot(int)
def _tray_activated(self, reason=None):
"""
- SLOT
- TRIGGER: self._systray.activated
+ TRIGGERS:
+ self._systray.activated
+
+ :param reason: the reason why the tray got activated.
+ :type reason: int
Displays the context menu from the tray icon
"""
@@ -862,10 +872,11 @@ class MainWindow(QtGui.QMainWindow):
visible = self.isVisible() and self.isActiveWindow()
self._action_visible.setText(get_action(visible))
+ @QtCore.Slot()
def _toggle_visible(self):
"""
- SLOT
- TRIGGER: self._action_visible.triggered
+ TRIGGERS:
+ self._action_visible.triggered
Toggles the window visibility
"""
@@ -909,10 +920,11 @@ class MainWindow(QtGui.QMainWindow):
if state is not None:
self.restoreState(state)
+ @QtCore.Slot()
def _about(self):
"""
- SLOT
- TRIGGERS: self.ui.action_about_leap.triggered
+ TRIGGERS:
+ self.ui.action_about_leap.triggered
Display the About Bitmask dialog
"""
@@ -936,10 +948,11 @@ class MainWindow(QtGui.QMainWindow):
"<a href='https://leap.se'>More about LEAP"
"</a>") % (VERSION, VERSION_HASH[:10], greet))
+ @QtCore.Slot()
def _help(self):
"""
- SLOT
- TRIGGERS: self.ui.action_help.triggered
+ TRIGGERS:
+ self.ui.action_help.triggered
Display the Bitmask help dialog.
"""
@@ -1036,10 +1049,11 @@ class MainWindow(QtGui.QMainWindow):
provider = self._login_widget.get_selected_provider()
self._backend.setup_provider(provider)
+ @QtCore.Slot(dict)
def _load_provider_config(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_download_provider_info
+ TRIGGERS:
+ self._backend.signaler.prov_download_provider_info
Once the provider config has been downloaded, this loads the
self._provider_config instance with it and starts the second
@@ -1064,11 +1078,11 @@ class MainWindow(QtGui.QMainWindow):
self.tr("Unable to login: Problem with provider"))
self._login_widget.set_enabled(True)
+ @QtCore.Slot()
def _login(self):
"""
- SLOT
TRIGGERS:
- self._login_widget.login
+ self._login_widget.login
Starts the login sequence. Which involves bootstrapping the
selected provider if the selection is valid (not empty), then
@@ -1092,9 +1106,9 @@ class MainWindow(QtGui.QMainWindow):
if self._login_widget.start_login():
self._download_provider_config()
+ @QtCore.Slot(unicode)
def _authentication_error(self, msg):
"""
- SLOT
TRIGGERS:
Signaler.srp_auth_error
Signaler.srp_auth_server_error
@@ -1110,11 +1124,11 @@ class MainWindow(QtGui.QMainWindow):
self._login_widget.set_enabled(True)
self.ui.action_create_new_account.setEnabled(True)
+ @QtCore.Slot()
def _cancel_login(self):
"""
- SLOT
TRIGGERS:
- self._login_widget.cancel_login
+ self._login_widget.cancel_login
Stops the login sequence.
"""
@@ -1134,9 +1148,9 @@ class MainWindow(QtGui.QMainWindow):
self._soledad_defer.cancel()
self._soledad_defer = None
+ @QtCore.Slot()
def _set_login_cancelled(self):
"""
- SLOT
TRIGGERS:
Signaler.prov_cancelled_setup fired by
self._backend.cancel_setup_provider()
@@ -1147,10 +1161,11 @@ class MainWindow(QtGui.QMainWindow):
self._login_widget.set_status(self.tr("Log in cancelled by the user."))
self._login_widget.set_enabled(True)
+ @QtCore.Slot(dict)
def _provider_config_loaded(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_check_api_certificate
+ TRIGGERS:
+ self._backend.signaler.prov_check_api_certificate
Once the provider configuration is loaded, this starts the SRP
authentication
@@ -1171,10 +1186,11 @@ class MainWindow(QtGui.QMainWindow):
logger.error(data[self._backend.ERROR_KEY])
self._login_widget.set_enabled(True)
+ @QtCore.Slot()
def _authentication_finished(self):
"""
- SLOT
- TRIGGER: self._srp_auth.authentication_finished
+ TRIGGERS:
+ self._srp_auth.authentication_finished
Once the user is properly authenticated, try starting the EIP
service
@@ -1285,12 +1301,12 @@ class MainWindow(QtGui.QMainWindow):
###################################################################
# Service control methods: soledad
+ @QtCore.Slot(dict)
def _soledad_intermediate_stage(self, data):
# TODO missing param docstring
"""
- SLOT
TRIGGERS:
- self._soledad_bootstrapper.download_config
+ self._soledad_bootstrapper.download_config
If there was a problem, displays it, otherwise it does nothing.
This is used for intermediate bootstrapping stages, in case
@@ -1320,12 +1336,12 @@ class MainWindow(QtGui.QMainWindow):
logger.warning("Max number of soledad initialization "
"retries reached.")
+ @QtCore.Slot(dict)
def _soledad_bootstrapped_stage(self, data):
"""
- SLOT
TRIGGERS:
- self._soledad_bootstrapper.gen_key
- self._soledad_bootstrapper.local_only_ready
+ self._soledad_bootstrapper.gen_key
+ self._soledad_bootstrapper.local_only_ready
If there was a problem, displays it, otherwise it does nothing.
This is used for intermediate bootstrapping stages, in case
@@ -1364,7 +1380,6 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _start_smtp_bootstrapping(self):
"""
- SLOT
TRIGGERS:
self.soledad_ready
"""
@@ -1385,7 +1400,6 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _stop_smtp_service(self):
"""
- SLOT
TRIGGERS:
self.logout
"""
@@ -1398,7 +1412,6 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _start_imap_service(self):
"""
- SLOT
TRIGGERS:
self.soledad_ready
"""
@@ -1428,7 +1441,6 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _fetch_incoming_mail(self):
"""
- SLOT
TRIGGERS:
self.mail_client_logged_in
"""
@@ -1438,7 +1450,6 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _stop_imap_service(self):
"""
- SLOT
TRIGGERS:
self.logout
"""
@@ -1487,9 +1498,9 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _on_eip_connection_connected(self):
"""
- SLOT
TRIGGERS:
self._eip_status.eip_connection_connected
+
Emits the EIPConnection.qtsigs.connected_signal
This is a little workaround for connecting the vpn-connected
@@ -1589,9 +1600,9 @@ class MainWindow(QtGui.QMainWindow):
self._backend.start_eip()
+ @QtCore.Slot()
def _on_eip_connection_aborted(self):
"""
- SLOT
TRIGGERS:
Signaler.eip_connection_aborted
"""
@@ -1667,7 +1678,6 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _stop_eip(self):
"""
- SLOT
TRIGGERS:
self._eip_connection.qtsigs.do_disconnect_signal (via state machine)
@@ -1697,7 +1707,6 @@ class MainWindow(QtGui.QMainWindow):
def _on_eip_network_unreachable(self):
# XXX Should move to EIP Conductor
"""
- SLOT
TRIGGERS:
self._eip_connection.qtsigs.network_unreachable
@@ -1711,7 +1720,7 @@ class MainWindow(QtGui.QMainWindow):
def _do_eip_restart(self):
# XXX Should move to EIP Conductor
"""
- SLOT
+ TRIGGERS:
self._eip_connection.qtsigs.process_restart
Restart the connection.
@@ -1729,9 +1738,9 @@ class MainWindow(QtGui.QMainWindow):
self._eip_status.set_eip_status("", error=error)
self._eip_status.set_eip_status_icon("error")
+ @QtCore.Slot(int)
def _eip_finished(self, exitCode):
"""
- SLOT
TRIGGERS:
Signaler.eip_process_finished
@@ -1822,10 +1831,11 @@ class MainWindow(QtGui.QMainWindow):
# eip will not start, so we start soledad anyway
self._maybe_run_soledad_setup_checks()
+ @QtCore.Slot(dict)
def _finish_eip_bootstrap(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.eip_client_certificate_ready
+ TRIGGERS:
+ self._backend.signaler.eip_client_certificate_ready
Starts the VPN thread if the eip configuration is properly
loaded
@@ -1842,12 +1852,12 @@ class MainWindow(QtGui.QMainWindow):
# DO START EIP Connection!
self._eip_connection.qtsigs.do_connect_signal.emit()
+ @QtCore.Slot(dict)
def _eip_intermediate_stage(self, data):
# TODO missing param
"""
- SLOT
TRIGGERS:
- self._backend.signaler.eip_config_ready
+ self._backend.signaler.eip_config_ready
If there was a problem, displays it, otherwise it does nothing.
This is used for intermediate bootstrapping stages, in case
@@ -1889,8 +1899,8 @@ class MainWindow(QtGui.QMainWindow):
@QtCore.Slot()
def _logout(self):
"""
- SLOT
- TRIGGER: self._login_widget.logout
+ TRIGGERS:
+ self._login_widget.logout
Starts the logout sequence
"""
@@ -1907,10 +1917,11 @@ class MainWindow(QtGui.QMainWindow):
self._backend.logout()
self.logout.emit()
+ @QtCore.Slot()
def _logout_error(self):
"""
- SLOT
- TRIGGER: self._srp_auth.logout_error
+ TRIGGER:
+ self._srp_auth.logout_error
Inform the user about a logout error.
"""
@@ -1919,10 +1930,11 @@ class MainWindow(QtGui.QMainWindow):
self._login_widget.set_status(
self.tr("Something went wrong with the logout."))
+ @QtCore.Slot()
def _logout_ok(self):
"""
- SLOT
- TRIGGER: self._srp_auth.logout_ok
+ TRIGGER:
+ self._srp_auth.logout_ok
Switches the stackedWidget back to the login stage after
logging out
@@ -1934,15 +1946,15 @@ class MainWindow(QtGui.QMainWindow):
self._login_widget.logged_out()
self._mail_status.mail_state_disabled()
+ @QtCore.Slot(dict)
def _intermediate_stage(self, data):
# TODO this method name is confusing as hell.
"""
- SLOT
TRIGGERS:
- self._backend.signaler.prov_name_resolution
- self._backend.signaler.prov_https_connection
- self._backend.signaler.prov_download_ca_cert
- self._backend.signaler.eip_config_ready
+ self._backend.signaler.prov_name_resolution
+ self._backend.signaler.prov_https_connection
+ self._backend.signaler.prov_download_ca_cert
+ self._backend.signaler.eip_config_ready
If there was a problem, displays it, otherwise it does nothing.
This is used for intermediate bootstrapping stages, in case
@@ -1967,9 +1979,9 @@ class MainWindow(QtGui.QMainWindow):
raise_window_ack()
self.raise_window.emit()
+ @QtCore.Slot()
def _do_raise_mainwindow(self):
"""
- SLOT
TRIGGERS:
self._on_raise_window_event
diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py
index f6bd1ed3..014a0a4f 100644
--- a/src/leap/bitmask/gui/preferenceswindow.py
+++ b/src/leap/bitmask/gui/preferenceswindow.py
@@ -89,9 +89,9 @@ class PreferencesWindow(QtGui.QDialog):
self._select_provider_by_name(domain)
+ @QtCore.Slot()
def _is_logged_in(self):
"""
- SLOT
TRIGGERS:
Signaler.srp_status_logged_in
@@ -123,9 +123,9 @@ class PreferencesWindow(QtGui.QDialog):
self.ui.gbPasswordChange.setEnabled(pw_enabled)
+ @QtCore.Slot()
def _not_logged_in(self):
"""
- SLOT
TRIGGERS:
Signaler.srp_status_not_logged_in
@@ -136,9 +136,9 @@ class PreferencesWindow(QtGui.QDialog):
self._set_password_change_status(msg)
self.ui.gbPasswordChange.setEnabled(False)
+ @QtCore.Slot()
def set_soledad_ready(self):
"""
- SLOT
TRIGGERS:
parent.soledad_ready
@@ -183,9 +183,9 @@ class PreferencesWindow(QtGui.QDialog):
self.ui.leNewPassword2.setEnabled(not disable)
self.ui.pbChangePassword.setEnabled(not disable)
+ @QtCore.Slot()
def _change_password(self):
"""
- SLOT
TRIGGERS:
self.ui.pbChangePassword.clicked
@@ -207,11 +207,11 @@ class PreferencesWindow(QtGui.QDialog):
self._set_changing_password(True)
self._backend.change_password(current_password, new_password)
+ @QtCore.Slot()
def _change_password_ok(self):
"""
- SLOT
TRIGGERS:
- self._backend.signaler.srp_password_change_ok
+ self._backend.signaler.srp_password_change_ok
Callback used to display a successfully changed password.
"""
@@ -229,12 +229,12 @@ class PreferencesWindow(QtGui.QDialog):
self._clear_password_inputs()
self._set_changing_password(False)
+ @QtCore.Slot(unicode)
def _change_password_problem(self, msg):
"""
- SLOT
TRIGGERS:
- self._backend.signaler.srp_password_change_error
- self._backend.signaler.srp_password_change_badpw
+ self._backend.signaler.srp_password_change_error
+ self._backend.signaler.srp_password_change_badpw
Callback used to display an error on changing password.
@@ -287,10 +287,12 @@ class PreferencesWindow(QtGui.QDialog):
provider_index = self.ui.cbProvidersServices.findText(name)
self.ui.cbProvidersServices.setCurrentIndex(provider_index)
+ @QtCore.Slot(str, int)
def _service_selection_changed(self, service, state):
"""
- SLOT
- TRIGGER: service_checkbox.stateChanged
+ TRIGGERS:
+ service_checkbox.stateChanged
+
Adds the service to the state if the state is checked, removes
it otherwise
@@ -309,9 +311,9 @@ class PreferencesWindow(QtGui.QDialog):
# We hide the maybe-visible status label after a change
self.ui.lblProvidersServicesStatus.setVisible(False)
+ @QtCore.Slot(str)
def _populate_services(self, domain):
"""
- SLOT
TRIGGERS:
self.ui.cbProvidersServices.currentIndexChanged[unicode]
@@ -368,9 +370,9 @@ class PreferencesWindow(QtGui.QDialog):
logger.error("Something went wrong while trying to "
"load service %s" % (service,))
+ @QtCore.Slot(str)
def _save_enabled_services(self, provider):
"""
- SLOT
TRIGGERS:
self.ui.pbSaveServices.clicked
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index ebcee400..cc8c2624 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -145,8 +145,7 @@ class Wizard(QtGui.QWizard):
@QtCore.Slot()
def _wizard_finished(self):
"""
- SLOT
- TRIGGER:
+ TRIGGERS:
self.finished
This method is called when the wizard is accepted or rejected.
@@ -210,15 +209,19 @@ class Wizard(QtGui.QWizard):
def get_services(self):
return self._selected_services
- @QtCore.Slot()
+ @QtCore.Slot(unicode)
def _enable_check(self, reset=True):
"""
- SLOT
- TRIGGER:
+ TRIGGERS:
self.ui.lnProvider.textChanged
Enables/disables the 'check' button in the SELECT_PROVIDER_PAGE
depending on the lnProvider content.
+
+ :param reset: this contains the text of the line edit, and when is
+ called directly defines whether we want to reset the
+ checks.
+ :type reset: unicode or bool
"""
enabled = len(self.ui.lnProvider.text()) != 0
enabled = enabled or self.ui.rbExistingProvider.isChecked()
@@ -282,11 +285,11 @@ class Wizard(QtGui.QWizard):
# register button
self.ui.btnRegister.setVisible(visible)
+ @QtCore.Slot()
def _registration_finished(self):
"""
- SLOT
TRIGGERS:
- self._backend.signaler.srp_registration_finished
+ self._backend.signaler.srp_registration_finished
The registration has finished successfully, so we do some final steps.
"""
@@ -308,11 +311,11 @@ class Wizard(QtGui.QWizard):
self.page(self.REGISTER_USER_PAGE).set_completed()
self.button(QtGui.QWizard.BackButton).setEnabled(False)
+ @QtCore.Slot()
def _registration_failed(self):
"""
- SLOT
TRIGGERS:
- self._backend.signaler.srp_registration_failed
+ self._backend.signaler.srp_registration_failed
The registration has failed, so we report the problem.
"""
@@ -322,11 +325,11 @@ class Wizard(QtGui.QWizard):
self._set_register_status(error_msg, error=True)
self.ui.btnRegister.setEnabled(True)
+ @QtCore.Slot()
def _registration_taken(self):
"""
- SLOT
TRIGGERS:
- self._backend.signaler.srp_registration_taken
+ self._backend.signaler.srp_registration_taken
The requested username is taken, warn the user about that.
"""
@@ -368,12 +371,12 @@ class Wizard(QtGui.QWizard):
self.ui.lblCheckCaFpr.setPixmap(None)
self.ui.lblCheckApiCert.setPixmap(None)
+ @QtCore.Slot()
def _check_provider(self):
"""
- SLOT
TRIGGERS:
- self.ui.btnCheck.clicked
- self.ui.lnProvider.returnPressed
+ self.ui.btnCheck.clicked
+ self.ui.lnProvider.returnPressed
Starts the checks for a given provider
"""
@@ -403,10 +406,10 @@ class Wizard(QtGui.QWizard):
self._provider_select_defer = self._backend.\
setup_provider(self._domain)
+ @QtCore.Slot(bool)
def _skip_provider_checks(self, skip):
"""
- SLOT
- Triggered:
+ TRIGGERS:
self.ui.rbExistingProvider.toggled
Allows the user to move to the next page without make any checks,
@@ -447,10 +450,11 @@ class Wizard(QtGui.QWizard):
label.setPixmap(self.ERROR_ICON)
logger.error(error)
+ @QtCore.Slot(dict)
def _name_resolution(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_name_resolution
+ TRIGGERS:
+ self._backend.signaler.prov_name_resolution
Sets the status for the name resolution check
"""
@@ -466,10 +470,11 @@ class Wizard(QtGui.QWizard):
self.ui.btnCheck.setEnabled(not passed)
self.ui.lnProvider.setEnabled(not passed)
+ @QtCore.Slot(dict)
def _https_connection(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_https_connection
+ TRIGGERS:
+ self._backend.signaler.prov_https_connection
Sets the status for the https connection check
"""
@@ -485,10 +490,11 @@ class Wizard(QtGui.QWizard):
self.ui.btnCheck.setEnabled(not passed)
self.ui.lnProvider.setEnabled(not passed)
+ @QtCore.Slot(dict)
def _download_provider_info(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_download_provider_info
+ TRIGGERS:
+ self._backend.signaler.prov_download_provider_info
Sets the status for the provider information download
check. Since this check is the last of this set, it also
@@ -519,10 +525,11 @@ class Wizard(QtGui.QWizard):
else:
self.ui.cbProviders.setEnabled(True)
+ @QtCore.Slot(dict)
def _download_ca_cert(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_download_ca_cert
+ TRIGGERS:
+ self._backend.signaler.prov_download_ca_cert
Sets the status for the download of the CA certificate check
"""
@@ -531,10 +538,11 @@ class Wizard(QtGui.QWizard):
if passed:
self.ui.lblCheckCaFpr.setPixmap(self.QUESTION_ICON)
+ @QtCore.Slot(dict)
def _check_ca_fingerprint(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_check_ca_fingerprint
+ TRIGGERS:
+ self._backend.signaler.prov_check_ca_fingerprint
Sets the status for the CA fingerprint check
"""
@@ -543,10 +551,11 @@ class Wizard(QtGui.QWizard):
if passed:
self.ui.lblCheckApiCert.setPixmap(self.QUESTION_ICON)
+ @QtCore.Slot(dict)
def _check_api_certificate(self, data):
"""
- SLOT
- TRIGGER: self._backend.signaler.prov_check_api_certificate
+ TRIGGERS:
+ self._backend.signaler.prov_check_api_certificate
Sets the status for the API certificate check. Also finishes
the provider bootstrapper thread since it's not needed anymore
@@ -556,10 +565,12 @@ class Wizard(QtGui.QWizard):
True, self.SETUP_PROVIDER_PAGE)
self._provider_setup_ok = True
+ @QtCore.Slot(str, int)
def _service_selection_changed(self, service, state):
"""
- SLOT
- TRIGGER: service_checkbox.stateChanged
+ TRIGGERS:
+ service_checkbox.stateChanged
+
Adds the service to the state if the state is checked, removes
it otherwise
@@ -604,12 +615,16 @@ class Wizard(QtGui.QWizard):
self.tr("Something went wrong while trying to "
"load service %s" % (service,)))
+ @QtCore.Slot(int)
def _current_id_changed(self, pageId):
"""
- SLOT
- TRIGGER: self.currentIdChanged
+ TRIGGERS:
+ self.currentIdChanged
Prepares the pages when they appear
+
+ :param pageId: the new current page id.
+ :type pageId: int
"""
if pageId == self.SELECT_PROVIDER_PAGE:
self._clear_register_widgets()
diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py
index 79f324dc..c1761afa 100644
--- a/src/leap/bitmask/services/mail/conductor.py
+++ b/src/leap/bitmask/services/mail/conductor.py
@@ -238,12 +238,11 @@ class SMTPControl(object):
self._smtp_port.stopListening()
self._smtp_service.doStop()
- @QtCore.Slot()
+ @QtCore.Slot(dict)
def smtp_bootstrapped_stage(self, data):
"""
- SLOT
TRIGGERS:
- self.smtp_bootstrapper.download_config
+ self.smtp_bootstrapper.download_config
If there was a problem, displays it, otherwise it does nothing.
This is used for intermediate bootstrapping stages, in case