Skip to content

InstanceEditor seems broken with name pointing to a trait #432

Closed

Description

@prabhuramachandran

With master on Python 3.6 the following example fails (this causes problems with Mayavi):

from traits.api import Bool, Str, HasTraits, List, Instance
from traitsui.api import Item, View, InstanceEditor


class Person(HasTraits):
    alive = Bool(True)
    name = Str()


class Bank(HasTraits):
    people = List(Person)
    person = Instance(Person)

    view = View(
        Item(
            'person', style='custom',
            editor=InstanceEditor(name='people')
        ),
        resizable=True
    )


if __name__ == '__main__':
    ram = Person(name='Ram')
    rama = Person(name='Rama')
    b = Bank(people=[ram, rama])
    b.person = ram
    b.configure_traits()

If you change the person choice on the UI, the item does not update.

Activity

  1. corranwebster commented on Mar 5, 2018

    @corranwebster
    Contributor

    Yep, I'm aware of this, and have a fix which I just pushed: #433

    More work before I merge that, however.

  2. prabhuramachandran commented on Mar 5, 2018

    @prabhuramachandran
    MemberAuthor

    Awesome, thanks! Glad you are on top of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions