From 132c8e47b74dd8ee0db51f0558c024fd4066681b Mon Sep 17 00:00:00 2001 From: Tomas Touceda Date: Fri, 10 May 2013 09:57:18 -0300 Subject: Make running Thandy configurable --- src/launcher.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/launcher.py b/src/launcher.py index 7d95336..5b44f92 100644 --- a/src/launcher.py +++ b/src/launcher.py @@ -2,6 +2,7 @@ import os import platform import time import threading +import ConfigParser from leap.app import main as leap_client from leap.common.events import server @@ -15,6 +16,9 @@ bundles_per_platform = { "Linux" : "/bundleinfo/LEAPClient/", } +GENERAL_SECTION = "General" +UPDATES_KEY = "Updates" + class Thandy(threading.Thread): def run(self): while True: @@ -35,14 +39,27 @@ class Thandy(threading.Thread): except Exception as e: print "ERROR:", e finally: + # TODO: Make this delay configurable time.sleep(60) if __name__ == "__main__": server.ensure_server(port=8090) - thandy_thread = Thandy() - thandy_thread.daemon = True - thandy_thread.start() + config = ConfigParser.ConfigParser() + config.read("launcher.conf") + + launch_thandy = False + try: + launch_thandy = config.getboolean(GENERAL_SECTION, UPDATES_KEY) + except ConfigParser.NoSectionError as ns: + pass + except ConfigParser.NoOptionError as no: + pass + + if launch_thandy: + thandy_thread = Thandy() + thandy_thread.daemon = True + thandy_thread.start() leap_client() -- cgit v1.2.3