diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-11-15 10:35:43 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-11-15 10:35:43 -0300 |
commit | d51d6bedfecd41491f2c8243235e7d3db043a4d7 (patch) | |
tree | 3d6152565be983d0e6ddc1fb0ce764bee060fc25 /src/leap/bitmask/gui/eip_status.py | |
parent | 23e9034664edf6b2a01a677c4fa4e6efd880e364 (diff) | |
parent | 72f53cc32bf20b00bcbd5f28bab5fc25250215bf (diff) |
Merge branch 'release-0.3.7'
Diffstat (limited to 'src/leap/bitmask/gui/eip_status.py')
-rw-r--r-- | src/leap/bitmask/gui/eip_status.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py index 324586c0..1899d6a4 100644 --- a/src/leap/bitmask/gui/eip_status.py +++ b/src/leap/bitmask/gui/eip_status.py @@ -26,6 +26,7 @@ from PySide import QtCore, QtGui from leap.bitmask.services.eip.connection import EIPConnection from leap.bitmask.services.eip.vpnprocess import VPNManager +from leap.bitmask.services import get_service_display_name, EIP_SERVICE from leap.bitmask.platform_init import IS_LINUX from leap.bitmask.util.averages import RateMovingAverage from leap.common.check import leap_assert_type @@ -58,6 +59,7 @@ class EIPStatusWidget(QtGui.QWidget): # set systray tooltip status self._eip_status = "" + self._service_name = get_service_display_name(EIP_SERVICE) self.ui.eip_bandwidth.hide() @@ -181,21 +183,24 @@ class EIPStatusWidget(QtGui.QWidget): def set_systray(self, systray): """ - Sets the systray object to use. + Sets the systray object to use and adds the service line for EIP. :param systray: Systray object :type systray: QtGui.QSystemTrayIcon """ leap_assert_type(systray, QtGui.QSystemTrayIcon) self._systray = systray - self._systray.setToolTip(self.tr("All services are OFF")) + eip_status = self.tr("{0}: OFF").format(self._service_name) + self._systray.set_service_tooltip(EIP_SERVICE, eip_status) def _update_systray_tooltip(self): """ - Updates the system tray icon tooltip using the eip and mx status. + Updates the system tray tooltip using the eip status. """ - status = self.tr("Encrypted Internet: {0}").format(self._eip_status) - self._systray.setToolTip(status) + if self._systray is not None: + eip_status = u"{0}: {1}".format( + self._service_name, self._eip_status) + self._systray.set_service_tooltip(EIP_SERVICE, eip_status) def set_action_eip_startstop(self, action_eip_startstop): """ @@ -245,7 +250,7 @@ class EIPStatusWidget(QtGui.QWidget): # probably the best thing would be to make a transitional # transition there, but that's more involved. self.eip_button.hide() - msg = self.tr("You must login to use Encrypted Internet") + msg = self.tr("You must login to use {0}".format(self._service_name)) self.eip_label.setText(msg) @QtCore.Slot() @@ -393,10 +398,8 @@ class EIPStatusWidget(QtGui.QWidget): # the UI won't update properly QtCore.QTimer.singleShot( 0, self.eipconnection.qtsigs.do_disconnect_signal) - QtCore.QTimer.singleShot(0, partial(self.set_eip_status, - self.tr("Unable to start VPN, " - "it's already " - "running."))) + msg = self.tr("Unable to start VPN, it's already running.") + QtCore.QTimer.singleShot(0, partial(self.set_eip_status, msg)) else: self.set_eip_status(status) @@ -418,14 +421,15 @@ class EIPStatusWidget(QtGui.QWidget): """ selected_pixmap = self.ERROR_ICON selected_pixmap_tray = self.ERROR_ICON_TRAY - tray_message = self.tr("Encrypted Internet: OFF") + tray_message = self.tr("{0}: OFF".format(self._service_name)) if status in ("WAIT", "AUTH", "GET_CONFIG", "RECONNECTING", "ASSIGN_IP"): selected_pixmap = self.CONNECTING_ICON selected_pixmap_tray = self.CONNECTING_ICON_TRAY - tray_message = self.tr("Encrypted Internet: Starting...") + tray_message = self.tr("{0}: Starting...").format( + self._service_name) elif status in ("CONNECTED"): - tray_message = self.tr("Encrypted Internet: ON") + tray_message = self.tr("{0}: ON".format(self._service_name)) selected_pixmap = self.CONNECTED_ICON selected_pixmap_tray = self.CONNECTED_ICON_TRAY self._eip_status = 'ON' |