generic properties api
This commit is contained in:
parent
e2bcac1c01
commit
9604fd15ec
@ -138,37 +138,22 @@ class Config(object):
|
||||
def _cfgimpl_has_properties(self):
|
||||
return bool(len(self._cfgimpl_properties))
|
||||
|
||||
def cfgimpl_hide(self):
|
||||
def _cfgimpl_has_property(self, propname):
|
||||
return propname in self._cfgimpl_properties
|
||||
|
||||
def cfgimpl_enable_property(self, propname):
|
||||
if self._cfgimpl_parent != None:
|
||||
raise MethodCallError("this method root_hide() shall not be"
|
||||
"used with non-root Config() object")
|
||||
rootconfig = self._cfgimpl_get_toplevel()
|
||||
if 'hidden' not in rootconfig._cfgimpl_properties:
|
||||
rootconfig._cfgimpl_properties.append('hidden')
|
||||
|
||||
def cfgimpl_show(self):
|
||||
if propname not in in self._cfgimpl_properties:
|
||||
self._cfgimpl_properties.append(propname)
|
||||
|
||||
def cfgimpl_disable_property(self, propname):
|
||||
if self._cfgimpl_parent != None:
|
||||
raise MethodCallError("this method root_hide() shall not be"
|
||||
"used with non-root Config() object")
|
||||
rootconfig = self._cfgimpl_get_toplevel()
|
||||
if 'hidden' in rootconfig._cfgimpl_properties:
|
||||
rootconfig._cfgimpl_properties.remove('hidden')
|
||||
|
||||
def cfgimpl_disable(self):
|
||||
if self._cfgimpl_parent != None:
|
||||
raise MethodCallError("this method root_hide() shall not be"
|
||||
"used with non-root Confit() object")
|
||||
rootconfig = self._cfgimpl_get_toplevel()
|
||||
if 'disabled' not in rootconfig._cfgimpl_properties:
|
||||
rootconfig._cfgimpl_properties.append('disabled')
|
||||
|
||||
def cfgimpl_enable(self):
|
||||
if self._cfgimpl_parent != None:
|
||||
raise MethodCallError("this method root_hide() shall not be"
|
||||
"used with non-root Confit() object")
|
||||
rootconfig = self._cfgimpl_get_toplevel()
|
||||
if 'disabled' in rootconfig._cfgimpl_properties:
|
||||
rootconfig._cfgimpl_properties.remove('disabled')
|
||||
if self._cfgimpl_has_property(propname):
|
||||
self.properties.remove(propname)
|
||||
|
||||
def cfgimpl_non_mandatory(self):
|
||||
if self._cfgimpl_parent != None:
|
||||
|
Loading…
Reference in New Issue
Block a user