enthought / enthought/traitsui

Use ContextValues consistently to bind editor values

Open
#1,631 0 comments 0 reactions 0 assignees View on GitHub
component: core component: documentation difficulty: advanced priority: low type: enhancement
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

In the `VideoEditor` we are experimenting with using `ContextValues` to bind editor traits to values in the UI Context. If this works well, we would like to roll that out to other places where it would make sense, such as `high` and `low` traits of the `RangeEditor`.

Doing this will require:

- identifying the places which can make use of this construct (there may be many more appropriate traits than currently exposed, due to previous complexity of setting this up)
- for each trait:
- make the trait on the factory a `CVType(...)` trait or similar
- add appropriate `sync_value` metadata to the trait
- remove any explicit calls to `Editor.sync_value` and let the automatic metadata connection handle things
- (for backwards compatibility) add `sync_name` metadata where appropriate to allow use of old `*_name` traits
- document the `ContextValue` mechanism in a more prominent way
- (eventually) deprecate older `*_name`-style traits
- (even later) remove `*_name`-style traits which are no longer needed.

The end goal should be that when a user asks how they make an attribute of an editor dynamic, the answer is simply "use a `ContextValue` binding" and it generally works.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining the existing ContextValues usage in VideoEditor and compare it with traits such as high and low in RangeEditor. Then identify other editor traits and their current synchronization paths. Done means appropriate traits use the binding mechanism consistently, backwards compatibility is addressed, and the ContextValue mechanism is documented more prominently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.