diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-07-29 17:05:45 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-07-29 17:05:45 +0200 |
commit | 252cf9964a2ebc78a589f75db2a7be0d25cac512 (patch) | |
tree | 0f4cd1a7949f8a3dc87eaed35f248170ee421943 /module/ConfigParser.py | |
parent | many new stuff, some things already working (diff) | |
download | pyload-252cf9964a2ebc78a589f75db2a7be0d25cac512.tar.xz |
more improvements and cleaned some imports
Diffstat (limited to 'module/ConfigParser.py')
-rw-r--r-- | module/ConfigParser.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/module/ConfigParser.py b/module/ConfigParser.py index 974986093..e37d3f521 100644 --- a/module/ConfigParser.py +++ b/module/ConfigParser.py @@ -241,6 +241,7 @@ class ConfigParser: def set(self, section, option, value): """set value""" self.config[section][option]["value"] = value + self.save() #---------------------------------------------------------------------- def getPlugin(self, plugin, option): @@ -251,7 +252,26 @@ class ConfigParser: def setPlugin(self, plugin, option, value): """sets a value for a plugin""" self.plugin[plugin][option]["value"] = value + self.save() + #---------------------------------------------------------------------- + def addPluginConfig(self, config): + """adds config option with tuple (plugin, name, type, desc, default)""" + + if not self.plugin.has_key(config[0]): + self.plugin[config[0]] = { "desc" : config[0], + config[1] : { + "desc" : config[3], + "typ" : config[2], + "value" : config[4] + } } + else: + if not self.plugin[config[0]].has_key(config[1]): + self.plugin[config[0]][config[1]] = { + "desc" : config[3], + "typ" : config[2], + "value" : config[4] + } ######################################################################## class Section: @@ -272,13 +292,13 @@ class Section: def __setitem__(self, item, value): """setitem""" self.parser.set(self.section, item, value) - + if __name__ == "__main__": pypath = "" - from time import time,sleep + from time import time a = time() |