Commit e31a335d authored by Guillaume Seguin's avatar Guillaume Seguin

Allow setting validator/aliaser/... for settings

parent 12f46f94
......@@ -349,10 +349,17 @@ class Settings(object):
return object.__getattribute__(self, name)
return getattr(self, "_" + name).value
def _add(self, setting, callback = None):
def _add(self, setting, callback = None, validate = None,
alias = None, autocomplete_list = None):
setattr(self, setting.name, setting)
if callback:
setattr(self, "_" + setting.name + "_cb", callback)
if validate:
setattr(self, "_" + setting.name + "_validate", validate)
if alias:
setattr(self, "_" + setting.name + "_alias", alias)
if autocomplete_list:
setattr(self, "_" + setting.name + "_list", autocomplete_list)
def _set(self, key, value):
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment