summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-09 17:14:40 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-09 17:14:40 -0300
commit51392198f87a271ddc0080370cc8b6b203774123 (patch)
tree63ff37515eb399bb0b806f0825a573d966500faf /src/leap/bitmask/gui
parentdffaa3c58d12c91e31d5a95d3cf43c00a9ce4604 (diff)
parent785380dfa7b3f6205b52be2a90afa9b0afa04c5e (diff)
Merge remote-tracking branch 'refs/remotes/ivan/feature/4636_warn-user-if-outdated-app' into develop
Diffstat (limited to 'src/leap/bitmask/gui')
-rw-r--r--src/leap/bitmask/gui/mainwindow.py72
1 files changed, 46 insertions, 26 deletions
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index f954006d..8c512ad2 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -21,7 +21,6 @@ import logging
from PySide import QtCore, QtGui
from datetime import datetime
-from functools import partial
from twisted.internet import threads
from zope.proxy import ProxyBase, setProxiedObject
@@ -362,23 +361,20 @@ class MainWindow(QtGui.QMainWindow):
"""
Helper to connect to backend signals
"""
- self._backend.signaler.prov_name_resolution.connect(
- self._intermediate_stage)
- self._backend.signaler.prov_https_connection.connect(
- self._intermediate_stage)
- self._backend.signaler.prov_download_ca_cert.connect(
- self._intermediate_stage)
+ sig = self._backend.signaler
+ sig.prov_name_resolution.connect(self._intermediate_stage)
+ sig.prov_https_connection.connect(self._intermediate_stage)
+ sig.prov_download_ca_cert.connect(self._intermediate_stage)
- self._backend.signaler.prov_download_provider_info.connect(
- self._load_provider_config)
- self._backend.signaler.prov_check_api_certificate.connect(
- self._provider_config_loaded)
+ sig.prov_download_provider_info.connect(self._load_provider_config)
+ sig.prov_check_api_certificate.connect(self._provider_config_loaded)
# Only used at login, no need to disconnect this like we do
# with the other
- self._backend.signaler.prov_problem_with_provider.connect(
- partial(self._login_widget.set_status,
- self.tr("Unable to login: Problem with provider")))
+ sig.prov_problem_with_provider.connect(self._login_problem_provider)
+
+ sig.prov_unsupported_client.connect(self._needs_update)
+ sig.prov_unsupported_api.connect(self._incompatible_api)
def _backend_disconnect(self):
"""
@@ -387,17 +383,13 @@ class MainWindow(QtGui.QMainWindow):
Some signals are emitted from the wizard, and we want to
ignore those.
"""
- self._backend.signaler.prov_name_resolution.disconnect(
- self._intermediate_stage)
- self._backend.signaler.prov_https_connection.disconnect(
- self._intermediate_stage)
- self._backend.signaler.prov_download_ca_cert.disconnect(
- self._intermediate_stage)
+ sig = self._backend.signaler
+ sig.prov_name_resolution.disconnect(self._intermediate_stage)
+ sig.prov_https_connection.disconnect(self._intermediate_stage)
+ sig.prov_download_ca_cert.disconnect(self._intermediate_stage)
- self._backend.signaler.prov_download_provider_info.disconnect(
- self._load_provider_config)
- self._backend.signaler.prov_check_api_certificate.disconnect(
- self._provider_config_loaded)
+ sig.prov_download_provider_info.disconnect(self._load_provider_config)
+ sig.prov_check_api_certificate.disconnect(self._provider_config_loaded)
def _rejected_wizard(self):
"""
@@ -856,6 +848,28 @@ class MainWindow(QtGui.QMainWindow):
"<a href='https://leap.se'>More about LEAP"
"</a>") % (VERSION, VERSION_HASH[:10], greet))
+ def _needs_update(self):
+ """
+ Display a warning dialog to inform the user that the app needs update.
+ """
+ url = "https://dl.bitmask.net/"
+ msg = self.tr(
+ "The current client version is not supported "
+ "by this provider.<br>"
+ "Please update to latest version.<br><br>"
+ "You can get the latest version from {0}").format(url)
+ QtGui.QMessageBox.warning(self, self.tr("Update Needed"), msg)
+
+ def _incompatible_api(self):
+ """
+ Display a warning dialog to inform the user that the provider has an
+ incompatible API.
+ """
+ msg = self.tr(
+ "This provider is not compatible with the client.<br><br>"
+ "Error: API version incompatible.")
+ QtGui.QMessageBox.warning(self, self.tr("Incompatible Provider"), msg)
+
def changeEvent(self, e):
"""
Reimplements the changeEvent method to minimize to tray
@@ -923,11 +937,17 @@ class MainWindow(QtGui.QMainWindow):
selected_provider = self._login_widget.get_selected_provider()
self._backend.provider_bootstrap(selected_provider)
else:
- self._login_widget.set_status(
- self.tr("Unable to login: Problem with provider"))
logger.error(data[self._backend.ERROR_KEY])
self._login_widget.set_enabled(True)
+ def _login_problem_provider(self):
+ """
+ Warns the user about a problem with the provider during login.
+ """
+ self._login_widget.set_status(
+ self.tr("Unable to login: Problem with provider"))
+ self._login_widget.set_enabled(True)
+
def _login(self):
"""
SLOT