enthought / enthought/traitsui

Check list editor ignores format_func when values are tuples

Open
#841 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

When values of the `CheckListEditor` are specified as tuples, `format_func` is ignored, e.g.:

```python
CheckListEditor(
values=[(1, "one"), (2, "two"), (3, "three"), (4, "four")],
format_func=lambda t: t[1].upper(),
)

# Editor shows "one", "two", "three", "four"
```

If this is expected behaviour, I think it should be documented somewhere (note: `EnumEditor` and `SetEditor` apply `format_func` to provided mappings). If not, the place to fix this would be:
https://github.com/enthought/traitsui/blob/bdb11ada13421a4a9dbe63c0c3d7ebf8f5a53f98/traitsui/qt4/check_list_editor.py#L78-L80

Or it might be best to bring `CheckListEditor` in line with `EnumEditor` and `SetEditor`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.