From: <z3...@us...> - 2010-09-12 21:29:29
|
Revision: 316 http://spd.svn.sourceforge.net/spd/?rev=316&view=rev Author: z3po Date: 2010-09-12 21:29:23 +0000 (Sun, 12 Sep 2010) Log Message: ----------- added clientmode option in configfile Modified Paths: -------------- branches/spd-ng/src/spdCLI.py branches/spd-ng/src/spdCheck.py branches/spd-ng/src/spdConfig.py branches/spd-ng/src/spdInterface.py Modified: branches/spd-ng/src/spdCLI.py =================================================================== --- branches/spd-ng/src/spdCLI.py 2010-09-07 20:42:10 UTC (rev 315) +++ branches/spd-ng/src/spdCLI.py 2010-09-12 21:29:23 UTC (rev 316) @@ -1,6 +1,5 @@ #!/usr/bin/python -import string from optparse import OptionParser class Cli(object): # {{{ Modified: branches/spd-ng/src/spdCheck.py =================================================================== --- branches/spd-ng/src/spdCheck.py 2010-09-07 20:42:10 UTC (rev 315) +++ branches/spd-ng/src/spdCheck.py 2010-09-12 21:29:23 UTC (rev 316) @@ -8,6 +8,7 @@ Checks if everything is there to perform :)""" spddir = os.path.expanduser('~/.spd/') + config = spdConfig.Config() def __init__(self,module): # {{{ """Do the initial checks. @@ -16,6 +17,7 @@ if module == "spdInterface": self.checkSPDdir() self.checkConfigFile() + self.getClientmode() elif module == "spdCore": pass # }}} @@ -30,7 +32,7 @@ def checkConfigFile(self): # {{{ """Check the configfile.""" - config = spdConfig.Config() + config = self.config if config.checkConfigFileExist(): if config.checkConfigFileReadable(): if config.hasSection("Main"): @@ -54,6 +56,14 @@ config.ErrorHandler("CONFIGFILE PATH NOT WRITEABLE") # }}} + def getClientmode(self): + config = self.config + if config.getOption('Main','clientmode'): + self.clientmode = config.getOption('Main','clientmode') + else: + config.setOption('Main','clientmode','CLI') + self.clientmode = config.getOption('Main','clientmode') + # }}} class Defaults(object): # {{{ Modified: branches/spd-ng/src/spdConfig.py =================================================================== --- branches/spd-ng/src/spdConfig.py 2010-09-07 20:42:10 UTC (rev 315) +++ branches/spd-ng/src/spdConfig.py 2010-09-12 21:29:23 UTC (rev 316) @@ -124,8 +124,8 @@ config = self.hasSection(section) if config: - if config.has_option("Main","version"): - return config.get("Main","version") + if config.has_option(section,option): + return config.get(section,option) else: return False else: Modified: branches/spd-ng/src/spdInterface.py =================================================================== --- branches/spd-ng/src/spdInterface.py 2010-09-07 20:42:10 UTC (rev 315) +++ branches/spd-ng/src/spdInterface.py 2010-09-12 21:29:23 UTC (rev 316) @@ -4,6 +4,7 @@ import spdCore import spdCLI import string +from sys import exit version = "0.3-alpha" @@ -11,16 +12,24 @@ """The Interface Module. Connection between Output and Core.""" - def __init__(self,version,clientmode="CLI"): # {{{ + def __init__(self,version,clientmode=False): # {{{ """init procedure""" self.version = version - check = spdCheck.Check("spdInterface") - del check + initcheck = spdCheck.Check("spdInterface") + if not clientmode: + if initcheck.clientmode: + clientmode = initcheck.clientmode + else: + clientmode = 'CLI' + del initcheck if clientmode == 'CLI': self.client = spdCLI.Cli() + else: + print 'CLIENTMODE \'not yet\' available' + exit(2) self.core = spdCore.Core() # }}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |