Improve Controller Attribute and sub controller creation with __setattr__ #235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking Changes
register_sub_controller->add_sub_controllerregister_sub_controllerwith a PascalCase name, you can instead add it as an attribute with a snake_case name and the generated PVs will be the same.Features
Controller.add_attributethat can be used instead ofsetattr(self, ...)- direct access toController.attributesmay be deprecated in a future releaseadd_sub_controllercan be used directly if adding programmatically or to avoid using a non-snake-case name for an attribute. They will be available viacontroller.<sub_controller_name>in the interactive shell either wayAttributesare added to a controller, the name used is added to its_namefield to use in__repr__so you can tell what they are in log statements and the debugger