enthought / enthought/traits

Event notification on Enum change with values traits

Open
#286 2 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

When using an Enum trait with the values= attribute, it appears that no event notification is sent when the Enum value changes as a result of the values trait changing.

E.g.

``` python
import traits.api as tr
class T(tr.HasTraits):
values=tr.List
enum=tr.Enum(values='values')
@tr.on_trait_change('enum')
def dynamic_event(self):
print 'dynamic event'
def _enum_changed(self):
print 'static event'

t=T()
# values=[],enum=None
t.values=[1,2,3]
# no notification even though enum changed to 1
print t.values, t.enum
t.values=[2,3]
# no notification even though enum changed to 2
print t.values, t.enum
t.enum=3
# now you see both notifications on dynamic/static
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided Python reproduction, focusing on the Enum trait's values= relationship and the notification entry points enum, values, and on_trait_change. Trace how changing values updates enum, then verify that both dynamic and static notifications occur for each resulting enum change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.