diff options
-rw-r--r-- | changes/bug_improve_signal_handling | 1 | ||||
-rw-r--r-- | changes/bug_update_ui_when_fails_at_config | 1 | ||||
-rw-r--r-- | src/leap/bitmask/gui/eip_status.py | 40 | ||||
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 14 |
4 files changed, 25 insertions, 31 deletions
diff --git a/changes/bug_improve_signal_handling b/changes/bug_improve_signal_handling new file mode 100644 index 00000000..4f88747f --- /dev/null +++ b/changes/bug_improve_signal_handling @@ -0,0 +1 @@ +- Improve signal handling in the mainwindow and wizard.
\ No newline at end of file diff --git a/changes/bug_update_ui_when_fails_at_config b/changes/bug_update_ui_when_fails_at_config new file mode 100644 index 00000000..84f19401 --- /dev/null +++ b/changes/bug_update_ui_when_fails_at_config @@ -0,0 +1 @@ +- Update EIP UI if it fails to download the config.
\ No newline at end of file diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py index ba041968..e7795083 100644 --- a/src/leap/bitmask/gui/eip_status.py +++ b/src/leap/bitmask/gui/eip_status.py @@ -526,6 +526,14 @@ class EIPStatusWidget(QtGui.QWidget): self.ui.lblEIPMessage.setText( self.tr("Route traffic through: {0}").format(self._provider)) + def aborted(self): + """ + Notify the state machine that EIP was aborted for some reason. + """ + # signal connection_aborted to state machine: + qtsigs = self.eipconnection.qtsigs + qtsigs.connection_aborted_signal.emit() + # # Slots for signals # @@ -544,9 +552,7 @@ class EIPStatusWidget(QtGui.QWidget): self.eip_conductor.eip_name) self.set_eip_status(eip_status_label, error=True) - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_openvpn_already_running(self): self.set_eip_status( @@ -555,9 +561,7 @@ class EIPStatusWidget(QtGui.QWidget): error=True) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_alien_openvpn_already_running(self): self.set_eip_status( @@ -567,9 +571,7 @@ class EIPStatusWidget(QtGui.QWidget): error=True) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_openvpn_not_found_error(self): self.set_eip_status( @@ -577,9 +579,7 @@ class EIPStatusWidget(QtGui.QWidget): error=True) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_vpn_launcher_exception(self): # XXX We should implement again translatable exceptions so @@ -587,9 +587,7 @@ class EIPStatusWidget(QtGui.QWidget): self.set_eip_status("VPN Launcher error.", error=True) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_no_polkit_agent_error(self): self.set_eip_status( @@ -602,9 +600,7 @@ class EIPStatusWidget(QtGui.QWidget): error=True) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_no_pkexec_error(self): self.set_eip_status( @@ -612,9 +608,7 @@ class EIPStatusWidget(QtGui.QWidget): error=True) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() def _on_eip_no_tun_kext_error(self): self.set_eip_status( @@ -623,9 +617,7 @@ class EIPStatusWidget(QtGui.QWidget): "system.").format(self.eip_conductor.eip_name)) self.set_eipstatus_off() - # signal connection_aborted to state machine: - qtsigs = self.eipconnection.qtsigs - qtsigs.connection_aborted_signal.emit() + self.aborted() @QtCore.Slot() def _on_eip_network_unreachable(self): diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index d46ef863..e7406106 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -186,7 +186,7 @@ class MainWindow(QtGui.QMainWindow): # timeout object used to trigger quit self._quit_timeout_callater = None - self._backend_connected_signals = {} + self._backend_connected_signals = [] self._backend_connect() self.ui.action_preferences.triggered.connect(self._show_preferences) @@ -318,7 +318,7 @@ class MainWindow(QtGui.QMainWindow): :param method: the method to call when the signal is triggered. :type method: callable, Slot or Signal """ - self._backend_connected_signals[signal] = method + self._backend_connected_signals.append((signal, method)) signal.connect(method) def _backend_bad_call(self, data): @@ -355,12 +355,12 @@ class MainWindow(QtGui.QMainWindow): conntrack(sig.prov_download_ca_cert, self._intermediate_stage) conntrack(sig.prov_download_provider_info, self._load_provider_config) conntrack(sig.prov_check_api_certificate, self._provider_config_loaded) + conntrack(sig.prov_check_api_certificate, self._get_provider_details) conntrack(sig.prov_problem_with_provider, self._login_problem_provider) conntrack(sig.prov_cancelled_setup, self._set_login_cancelled) - self._connect_and_track(sig.prov_get_details, - self._provider_get_details) + conntrack(sig.prov_get_details, self._provider_get_details) # Login signals conntrack(sig.srp_auth_ok, self._authentication_finished) @@ -399,7 +399,6 @@ class MainWindow(QtGui.QMainWindow): sig.backend_bad_call.connect(self._backend_bad_call) - sig.prov_check_api_certificate.connect(self._get_provider_details) sig.prov_unsupported_client.connect(self._needs_update) sig.prov_unsupported_api.connect(self._incompatible_api) sig.prov_get_all_services.connect(self._provider_get_all_services) @@ -435,13 +434,13 @@ class MainWindow(QtGui.QMainWindow): Some signals are emitted from the wizard, and we want to ignore those. """ - for signal, method in self._backend_connected_signals.items(): + for signal, method in self._backend_connected_signals: try: signal.disconnect(method) except RuntimeError: pass # Signal was not connected - self._backend_connected_signals = {} + self._backend_connected_signals = [] @QtCore.Slot() def _rejected_wizard(self): @@ -1627,6 +1626,7 @@ class MainWindow(QtGui.QMainWindow): self.tr("Unable to connect: Problem with provider")) logger.error(data[self._backend.ERROR_KEY]) self._already_started_eip = False + self._eip_status.aborted() # end of EIP methods --------------------------------------------- |