enthought / enthought/traitsui
Creation and toolkit agnostic configuration of an editor belong to editor factory, not UI panel
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
The following code in `traitsui.qt4.ui_panel` is identical to the one in `traitsui.wx.ui_panel`:
https://github.com/enthought/traitsui/blob/029443bf018f136e68fefe802b522e5365f86b5b/traitsui/qt4/ui_panel.py#L851-L867
This block contains toolkit agnostic code and can easily be moved to the toolkit agnostic editor factory.
This refactoring would make it easier to test the logic without a GUI toolkit. It is also logically reasonable because the factory should be responsible for instantiating an editor as far as it is allowed within the toolkit agnostic boundary.
The original `getattr(editor_factory, item.style + "_editor")` is an implementation detail that belongs to the editor factory as well.
This is what I think the block will eventually look like (more or less):
```
editor = editor_factory.create_editor(ui, object, name, item, item_panel)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.