From 9516f7e34cf265f87abb67e40b9fa76682012c84 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 23 May 2013 22:47:18 +0900 Subject: fix restore from minimized. Closes #2574 --- src/leap/gui/mainwindow.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index 3e8a1c83..a8aa1b1c 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -420,12 +420,21 @@ class MainWindow(QtGui.QMainWindow): Toggles the window visibility """ + get_action = lambda visible: ( + self.tr("Show"), + self.tr("Hide"))[int(visible)] + + minimized = self.isMinimized() + if reason != QtGui.QSystemTrayIcon.Context: + # do show + if minimized: + self.showNormal() self.setVisible(not self.isVisible()) - action_visible_text = self.tr("Hide") - if not self.isVisible(): - action_visible_text = self.tr("Show") - self._action_visible.setText(action_visible_text) + + # set labels + visible = self.isVisible() + self._action_visible.setText(get_action(visible)) def _center_window(self): """ -- cgit v1.2.3