diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-11-08 16:50:49 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-11-08 16:50:49 -0300 |
commit | b2d1e649f2e8bb18e63355c305f8efa75f66cb04 (patch) | |
tree | 26f8bb7922632c793bc1198c340daf34ee7113ef /src/leap/bitmask/gui/eip_status.py | |
parent | 9d3dff5cc21cffc14dde9d4ab901f47fcd56cf87 (diff) | |
parent | 13470807d96cfb6e10bc647aab8111a2b61bb6ea (diff) |
Merge remote-tracking branch 'ivan/bug/3998_shared-systray-tooltip' into develop
Diffstat (limited to 'src/leap/bitmask/gui/eip_status.py')
-rw-r--r-- | src/leap/bitmask/gui/eip_status.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py index 324586c0..c41d9706 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,22 @@ 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) + 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 +248,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 +396,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 +419,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' |