[WIP] config_property descriptor tool
A helper to get up-to-date configuration values from static configuration.
This helper can prevent some bugs in controllers. People have the tendency to write in their constructor something like:
class MyCtrl(Controller):
def __init__(self, name, config, axes, encoders):
self.adjustment_factor = self.config.get('adjustment_factor')
The problem with this code is if the config is reloaded, the member will not be updated. With this helper you can do:
class MyCtrl(Controller):
adjustment_factor = config_property('adjustment_factor')
def __init__(self, name, config, axes, encoders):
print self.adjustment_factor
Each access to self.adjustment_factor
will internally call self.config.get('adjustment_factor')
which will contain an up-to-date value of the static property.