Improvements to Schemas
- Dominant language
- Python
- Stars
- 115
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
Currently classes like `ActionSchema` do not have hooks in the default `create` functions to permit passing in additional keyword arguments to the factory function, see: https://github.com/enthought/pyface/blob/42fbaf6e18883b8e5a662fc9ba108fd2408c91d3/pyface/action/schema/schema.py#L98-L102
This means that you can't easily use a generic class (such as `Action` itself, in many cases) as the factory, because you can't pass in traits, and instead have to have a custom factory function to apply those, or subclass `ActionSchema`. In downstream projects we have ended up with factory function factories and Schema factories to automate the process of creating these custom things, but looking at this it would be nice to be able to say something like:
```
ActionSchema(id='foo', kw_args={'name': "Bar", 'on_perform': do_bar, 'tooltip': "Do bar."})
```
and then have these passed through. Exact syntax might vary, eg. even nicer would be:
```
ActionSchema(id='foo', name="Bar", on_perform=do_bar, tooltip="Do bar.")
```
where kwargs that aren't traits are extracted and used as arguments for the factory, but that might be too magical.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.