enthought / enthought/traitsui

Enum style RangeEditor are not classes but functions

Open
#901 0 comments 0 reactions 0 assignees View on GitHub
type: refactor
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

`EditorFactory` expects subclass of `Editor` to be provided, but the `enum` style of `RangeEditor` are implemented using functions in both qt and wx (the following example show the qt version):
https://github.com/enthought/traitsui/blob/35ebe367d3b84d57a8389745f46564ee69fd2eeb/traitsui/qt4/range_editor.py#L722-L724

This is violation of the interface defined by the editor factory could cause surprises when the editor factory changes assuming it always gets a subclass of `Editor`, e.g. calling a class method.

It would be better to write the enum style of `RangeEditor` as subclass of `Editor`, perhaps making use of the `BaseEnumEditor` base class to reuse the common enumeration logic.

The enumeration logic is actually toolkit-agnostic, see #857 as well.

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.