enthought / enthought/traits

Range trait editor with dynamic bounds assumes trait is on "object" in TraitsUI context

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

Description

This means that something like this:
```
class Foo(HasTraits):
x_low = Int
x_high = Int
x = Range('x_low', 'x-high')

class FooView(ModelView):
model = Instance(Foo)
view = View(
Item('model.x')
)
```
will fail.

This is perhaps more of a TraitsUI bug. The fix is that the `get_editor` method needs to accept an argument for the context name of the object that the trait is on and pass it through to the `create_editor` method. This would usually be the `object` trait of the `Item`, I think (https://github.com/enthought/traitsui/blob/master/traitsui/item.py#L127).

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.