summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-06 14:45:21 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-06 17:19:25 -0300
commita6abc1ea31319d23ca14763f6058784ae69b4830 (patch)
treebc2b17976d8df6925f7bd74831c24a743585a56e
parentd6bf9b3e11ff87488a5f508acebf8f20ad026166 (diff)
Update hide/show menu text when visibility changes
-rw-r--r--changes/bug_update_hideshow2
-rw-r--r--src/leap/gui/mainwindow.py23
2 files changed, 18 insertions, 7 deletions
diff --git a/changes/bug_update_hideshow b/changes/bug_update_hideshow
new file mode 100644
index 00000000..6ebbaaf1
--- /dev/null
+++ b/changes/bug_update_hideshow
@@ -0,0 +1,2 @@
+ o Update text from the tray menu based on the visibility of the
+ window. Fixes #3400. \ No newline at end of file
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index 87dd4f5c..72f86e09 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -580,13 +580,7 @@ class MainWindow(QtGui.QMainWindow):
Displays the context menu from the tray icon
"""
- get_action = lambda visible: (
- self.tr("Show Main Window"),
- self.tr("Hide Main Window"))[int(visible)]
-
- # set labels
- visible = self.isVisible()
- self._action_visible.setText(get_action(visible))
+ self._update_hideshow_menu()
context_menu = self._systray.contextMenu()
if not IS_MAC:
@@ -596,6 +590,19 @@ class MainWindow(QtGui.QMainWindow):
# this works however.
context_menu.exec_(self._systray.geometry().center())
+ def _update_hideshow_menu(self):
+ """
+ Updates the Hide/Show main window menu text based on the
+ visibility of the window.
+ """
+ get_action = lambda visible: (
+ self.tr("Show Main Window"),
+ self.tr("Hide Main Window"))[int(visible)]
+
+ # set labels
+ visible = self.isVisible()
+ self._action_visible.setText(get_action(visible))
+
def _toggle_visible(self):
"""
SLOT
@@ -609,6 +616,8 @@ class MainWindow(QtGui.QMainWindow):
else:
self.hide()
+ self._update_hideshow_menu()
+
def _center_window(self):
"""
Centers the mainwindow based on the desktop geometry