summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/mainwindow.py
diff options
context:
space:
mode:
authorantialias <antialias@leap.se>2012-08-22 19:47:41 -0700
committerantialias <antialias@leap.se>2012-08-22 19:47:41 -0700
commitdc10833bedcdecf081a7c79678614c5521445164 (patch)
tree582a57e67b99336024f2ebe3c207f4a385486559 /src/leap/baseapp/mainwindow.py
parent9891fc2f6869db7fc56503087ce124d74f5fc3b7 (diff)
grabs a definition.json file if one isn't present. includes some basic error handling and tests.
uses the requests library for network interactions and mocks for simulating network states.
Diffstat (limited to 'src/leap/baseapp/mainwindow.py')
-rw-r--r--src/leap/baseapp/mainwindow.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py
index bc844437..912a51b6 100644
--- a/src/leap/baseapp/mainwindow.py
+++ b/src/leap/baseapp/mainwindow.py
@@ -11,6 +11,8 @@ from PyQt4.QtGui import (QMainWindow, QWidget, QVBoxLayout, QMessageBox,
QTextBrowser, qApp)
from PyQt4.QtCore import (pyqtSlot, pyqtSignal, QTimer)
+from leap.base.configuration import Configuration
+
from leap.baseapp.dialogs import ErrorDialog
from leap.eip import exceptions as eip_exceptions
@@ -18,6 +20,9 @@ from leap.eip.eipconnection import EIPConnection
from leap.gui import mainwindow_rc
+#TODO: Get rid of this and do something clever
+DEFAULT_PROVIDER_URL = "http://localhost/definition.json"
+
class LeapWindow(QMainWindow):
#XXX tbd: refactor into model / view / controller
@@ -30,6 +35,8 @@ class LeapWindow(QMainWindow):
super(LeapWindow, self).__init__()
self.debugmode = getattr(opts, 'debug', False)
+ self.configuration = Configuration()
+
self.vpn_service_started = False
self.createWindowHeader()
@@ -81,6 +88,12 @@ class LeapWindow(QMainWindow):
# bunch of self checks.
# XXX move somewhere else alltogether.
#
+ if self.configuration.error is True:
+ dialog = ErrorDialog()
+ dialog.criticalMessage(
+ 'There is a problem with the default '
+ 'definition.json file',
+ 'error')
if self.conductor.missing_provider is True:
dialog = ErrorDialog()