diff options
author | kali <kali@leap.se> | 2012-09-04 06:37:45 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-09-04 06:37:45 +0900 |
commit | 1826d9a0d5400c21a3f7af73eda2e843f0639271 (patch) | |
tree | a65370738b48ad7ab7d4f35e711fddb5c73ad49b /src/leap/baseapp/eip.py | |
parent | b0b2b342b698bbe5851e9312cd830938f8d564a5 (diff) |
add little docstrings to classes
Diffstat (limited to 'src/leap/baseapp/eip.py')
-rw-r--r-- | src/leap/baseapp/eip.py | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index a67fd916..6c3249ff 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -8,19 +8,25 @@ from leap.eip.eipconnection import EIPConnection class EIPConductorApp(object): + """ + initializes an instance of EIPConnection, + gathers errors, and passes status-change signals + from Qt land along to the conductor. + Connects the eip connect/disconnect logic + to the switches in the app (buttons/menu items). + """ def __init__(self, *args, **kwargs): - # - # conductor is in charge of all - # vpn-related configuration / monitoring. - # we pass a tuple of signals that will be - # triggered when status changes. - # opts = kwargs.pop('opts') config_file = getattr(opts, 'config_file', None) self.eip_service_started = False + # conductor (eip connection) is in charge of all + # vpn-related configuration / monitoring. + # we pass a tuple of signals that will be + # triggered when status changes. + self.conductor = EIPConnection( watcher_cb=self.newLogLine.emit, config_file=config_file, @@ -32,20 +38,18 @@ class EIPConductorApp(object): self.error_check() # XXX should receive "ready" signal + # it is called from LeapWindow now. #if self.conductor.autostart: #self.start_or_stopVPN() - # move to eipconductor init? if self.debugmode: self.startStopButton.clicked.connect( lambda: self.start_or_stopVPN()) def error_check(self): - ####### error checking ################ - # - # bunch of self checks. - # XXX move somewhere else alltogether. - # + + # XXX refactor (by #504) + if self.conductor.missing_definition is True: dialog = ErrorDialog() dialog.criticalMessage( @@ -105,22 +109,23 @@ class EIPConductorApp(object): @QtCore.pyqtSlot() def statusUpdate(self): """ - called on timer tick polls status and updates ui with real time info about transferred bytes / connection state. + right now is triggered by a timer tick + (timer controlled by StatusAwareTrayIcon class) """ - # XXX it's too expensive to poll + # TODO I guess it's too expensive to poll # continously. move to signal events instead. + # (i.e., subscribe to connection status changes + # from openvpn manager) if not self.eip_service_started: return - # XXX remove all access to manager layer - # from here. if self.conductor.with_errors: #XXX how to wait on pkexec??? #something better that this workaround, plz!! - time.sleep(5) + time.sleep(2) print('errors. disconnect.') self.start_or_stopVPN() # is stop @@ -173,8 +178,14 @@ class EIPConductorApp(object): # too little is overkill, too much # will miss transition states.. + # XXX decouple! (timer is init by icons class). + # should bring it here? + # to its own class? + + # XXX get constant from somewhere else self.timer.start(250.0) return + if self.eip_service_started is True: self.conductor.disconnect() if self.debugmode: |