summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/mainwindow.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-08-28 23:08:39 +0900
committerkali <kali@leap.se>2012-08-28 23:08:39 +0900
commit06883461f2daa616b2e3c842f53d9422703cd9c7 (patch)
treef3e5728574db03b2f98d0245727972bcfa58fe92 /src/leap/baseapp/mainwindow.py
parent5ddb2ef5a803cc6c01a90b4c3b33c90a51d2666e (diff)
eip_checks called from main app.
removed "configuration" object. checks are called from conductor.
Diffstat (limited to 'src/leap/baseapp/mainwindow.py')
-rw-r--r--src/leap/baseapp/mainwindow.py43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py
index 086e905a..d7f4ecac 100644
--- a/src/leap/baseapp/mainwindow.py
+++ b/src/leap/baseapp/mainwindow.py
@@ -11,18 +11,11 @@ from PyQt4.QtGui import (QMainWindow, QWidget, QVBoxLayout, QMessageBox,
QTextBrowser, qApp)
from PyQt4.QtCore import (pyqtSlot, pyqtSignal, QTimer)
-from leap.base.config import Configuration
-
from leap.baseapp.dialogs import ErrorDialog
-
from leap.eip import exceptions as eip_exceptions
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
@@ -35,9 +28,7 @@ class LeapWindow(QMainWindow):
super(LeapWindow, self).__init__()
self.debugmode = getattr(opts, 'debug', False)
- self.configuration = Configuration()
-
- self.vpn_service_started = False
+ self.eip_service_started = False
self.createWindowHeader()
self.createIconGroupBox()
@@ -69,7 +60,9 @@ class LeapWindow(QMainWindow):
widget.setLayout(mainLayout)
self.trayIcon.show()
- config_file = getattr(opts, 'config_file', None)
+ self.setWindowTitle("LEAP Client")
+ self.resize(400, 300)
+ self.set_statusbarMessage('ready')
#
# conductor is in charge of all
@@ -84,15 +77,19 @@ class LeapWindow(QMainWindow):
status_signals=(self.statusChange.emit, ),
debug=self.debugmode)
+ # XXX remove skip download when sample service is ready
+ self.conductor.run_checks(skip_download=True)
+
+ ####### error checking ################
#
# bunch of self checks.
# XXX move somewhere else alltogether.
#
- if self.configuration.error is True:
+ if self.conductor.missing_definition is True:
dialog = ErrorDialog()
dialog.criticalMessage(
- 'There is a problem with the default '
- 'definition.json file',
+ 'The default '
+ 'definition.json file cannot be found',
'error')
if self.conductor.missing_provider is True:
@@ -144,10 +141,7 @@ class LeapWindow(QMainWindow):
'(<i>DOES NOTHING YET</i>)',
'error')
- self.setWindowTitle("LEAP Client")
- self.resize(400, 300)
-
- self.set_statusbarMessage('ready')
+ ############ end error checking ###################
if self.conductor.autostart:
self.start_or_stopVPN()
@@ -387,9 +381,10 @@ technolust</i>")
"""
stub for running child process with vpn
"""
- if self.vpn_service_started is False:
+ if self.eip_service_started is False:
try:
self.conductor.connect()
+ # XXX move this to error queue
except eip_exceptions.EIPNoCommandError:
dialog = ErrorDialog()
dialog.warningMessage(
@@ -398,7 +393,7 @@ technolust</i>")
'error')
if self.debugmode:
self.startStopButton.setText('&Disconnect')
- self.vpn_service_started = True
+ self.eip_service_started = True
# XXX what is optimum polling interval?
# too little is overkill, too much
@@ -406,13 +401,11 @@ technolust</i>")
self.timer.start(250.0)
return
- if self.vpn_service_started is True:
+ if self.eip_service_started is True:
self.conductor.disconnect()
- # FIXME this should trigger also
- # statuschange event. why isn't working??
if self.debugmode:
self.startStopButton.setText('&Connect')
- self.vpn_service_started = False
+ self.eip_service_started = False
self.timer.stop()
return
@@ -430,7 +423,7 @@ technolust</i>")
# XXX it's too expensive to poll
# continously. move to signal events instead.
- if not self.vpn_service_started:
+ if not self.eip_service_started:
return
# XXX remove all access to manager layer