From d4d6b0c5476b45629d632debe4527f9d6cb3cb0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 29 May 2014 16:44:25 -0300 Subject: Check openvpn bin path before starting openvpn --- src/leap/bitmask/gui/eip_status.py | 36 ++++++++++++++++++++++++++++++++--- src/leap/bitmask/gui/mainwindow.py | 5 ++--- src/leap/bitmask/gui/statemachines.py | 4 ++++ 3 files changed, 39 insertions(+), 6 deletions(-) (limited to 'src/leap/bitmask/gui') diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py index 04acc167..ba041968 100644 --- a/src/leap/bitmask/gui/eip_status.py +++ b/src/leap/bitmask/gui/eip_status.py @@ -102,6 +102,8 @@ class EIPStatusWidget(QtGui.QWidget): self._on_eip_vpn_launcher_exception) signaler.eip_no_polkit_agent_error.connect( self._on_eip_no_polkit_agent_error) + signaler.eip_connection_aborted.connect( + self._on_eip_connection_aborted) signaler.eip_no_pkexec_error.connect(self._on_eip_no_pkexec_error) signaler.eip_no_tun_kext_error.connect(self._on_eip_no_tun_kext_error) @@ -539,11 +541,11 @@ class EIPStatusWidget(QtGui.QWidget): eip_status_label = self.tr("Could not load {0} configuration.") eip_status_label = eip_status_label.format( - self._eip_conductor.eip_name) + 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 = self.eipconnection.qtsigs qtsigs.connection_aborted_signal.emit() def _on_eip_openvpn_already_running(self): @@ -553,6 +555,10 @@ 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() + def _on_eip_alien_openvpn_already_running(self): self.set_eip_status( self.tr("Another openvpn instance is already running, and " @@ -561,18 +567,30 @@ 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() + def _on_eip_openvpn_not_found_error(self): self.set_eip_status( self.tr("We could not find openvpn binary."), error=True) self.set_eipstatus_off() + # signal connection_aborted to state machine: + qtsigs = self.eipconnection.qtsigs + qtsigs.connection_aborted_signal.emit() + def _on_eip_vpn_launcher_exception(self): # XXX We should implement again translatable exceptions so # we can pass a translatable string to the panel (usermessage attr) 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() + def _on_eip_no_polkit_agent_error(self): self.set_eip_status( # XXX this should change to polkit-kde where @@ -584,19 +602,31 @@ 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() + def _on_eip_no_pkexec_error(self): self.set_eip_status( self.tr("We could not find pkexec in your system."), error=True) self.set_eipstatus_off() + # signal connection_aborted to state machine: + qtsigs = self.eipconnection.qtsigs + qtsigs.connection_aborted_signal.emit() + def _on_eip_no_tun_kext_error(self): self.set_eip_status( self.tr("{0} cannot be started because the tuntap extension is " "not installed properly in your " - "system.").format(self._eip_conductor.eip_name)) + "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() + @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 1d467e60..a0eb84a2 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -597,7 +597,7 @@ class MainWindow(QtGui.QMainWindow): default_provider = settings.get_defaultprovider() if default_provider is None: - logger.warning("Trying toupdate eip enabled status but there's no" + logger.warning("Trying to update eip enabled status but there's no" " default provider. Disabling EIP for the time" " being...") self._backend_cannot_start_eip() @@ -637,7 +637,6 @@ class MainWindow(QtGui.QMainWindow): # so the user needs to log in first self._eip_status.disable_eip_start() else: - self._stop_eip() self._eip_status.disable_eip_start() self._eip_status.set_eip_status(self.tr("Disabled")) @@ -664,7 +663,6 @@ class MainWindow(QtGui.QMainWindow): # so the user needs to log in first self._eip_status.disable_eip_start() else: - self._stop_eip() self._eip_status.disable_eip_start() self._eip_status.set_eip_status(self.tr("Disabled")) @@ -1566,6 +1564,7 @@ class MainWindow(QtGui.QMainWindow): # XXX this should be handled by the state machine. self._eip_status.set_eip_status( self.tr("Starting...")) + self._eip_status.eip_button.setEnabled(False) domain = self._login_widget.get_selected_provider() self._backend.eip_setup(domain) diff --git a/src/leap/bitmask/gui/statemachines.py b/src/leap/bitmask/gui/statemachines.py index f8e5479d..00a1387e 100644 --- a/src/leap/bitmask/gui/statemachines.py +++ b/src/leap/bitmask/gui/statemachines.py @@ -565,11 +565,15 @@ class ConnectionMachineBuilder(object): button, 'text', off_label) off.assignProperty( button, 'enabled', True) + off.assignProperty( + button, 'visible', True) if action: off.assignProperty( action, 'text', off_label) off.assignProperty( action, 'enabled', True) + off.assignProperty( + action, 'visible', True) off.setObjectName(_OFF) states[_OFF] = off -- cgit v1.2.3