summaryrefslogtreecommitdiff
path: root/src/leap/gui/mainwindow.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/gui/mainwindow.py')
-rw-r--r--src/leap/gui/mainwindow.py46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index ca6f1a8b..863640ef 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -18,31 +18,33 @@
"""
Main window for the leap client
"""
-import os
import logging
+import os
+import platform
import tempfile
-import keyring
-
-from PySide import QtCore, QtGui
from functools import partial
-from ui_mainwindow import Ui_MainWindow
+import keyring
+from PySide import QtCore, QtGui
from leap.common.check import leap_assert
from leap.config.leapsettings import LeapSettings
from leap.config.providerconfig import ProviderConfig
from leap.crypto.srpauth import SRPAuth
+from leap.gui.wizard import Wizard
+from leap.services.eip.eipbootstrapper import EIPBootstrapper
+from leap.services.eip.eipconfig import EIPConfig
+from leap.services.eip.providerbootstrapper import ProviderBootstrapper
from leap.platform_init.initializers import init_platform
from leap.services.eip.vpn import VPN
from leap.services.eip.vpnlaunchers import (VPNLauncherException,
OpenVPNNotFoundException,
EIPNoPkexecAvailable,
EIPNoPolkitAuthAgentAvailable)
-from leap.services.eip.providerbootstrapper import ProviderBootstrapper
-from leap.services.eip.eipbootstrapper import EIPBootstrapper
-from leap.services.eip.eipconfig import EIPConfig
-from leap.gui.wizard import Wizard
-from leap.util.checkerthread import CheckerThread
from leap.util import __version__ as VERSION
+from leap.util.checkerthread import CheckerThread
+
+from ui_mainwindow import Ui_MainWindow
+
logger = logging.getLogger(__name__)
@@ -291,18 +293,19 @@ class MainWindow(QtGui.QMainWindow):
self._vpn_systray.setIcon(QtGui.QIcon(self.ERROR_ICON))
self._vpn_systray.setVisible(False)
- def _toggle_visible(self):
+ def _toggle_visible(self, reason=None):
"""
SLOT
TRIGGER: self._systray.activated
Toggles the window visibility
"""
- 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)
+ if reason != QtGui.QSystemTrayIcon.Context:
+ 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)
def _center_window(self):
"""
@@ -609,9 +612,14 @@ class MainWindow(QtGui.QMainWindow):
"""
# TODO: make this properly multiplatform
- host = os.path.join(tempfile.mkdtemp(prefix="leap-tmp"),
- 'openvpn.socket')
- port = "unix"
+
+ if platform.system() == "Windows":
+ host = "localhost"
+ port = "9876"
+ else:
+ host = os.path.join(tempfile.mkdtemp(prefix="leap-tmp"),
+ 'openvpn.socket')
+ port = "unix"
return host, port