0

I'm working on a dynamic Traits UI where I can select the class to use for certain instances. I've got it working nicely using an InstanceEditor with a "values" argument containing InstanceFactoryChoice instances.

My problem appears when I want to specify a view to use for the selected instance. Using the "view" argument works if I omit the "values" argument, but with it I get the default view instead. The relevant part of the view looks like this:

Item('item',
     show_label=False,
     editor=InstanceEditor(
         view=item_view,
         values=[InstanceFactoryChoice(klass=k) for k in classes],
         editable=True),
     style='custom')

What's more confusing to me is that it also works as expected (i.e. uses the "item_view" view to display the instance) when I use the "simple" style instead of "custom". However, then the view appears in a new window, I want it to be inline.

Am I missing something here? I'm on TraitsUI 4.3.

Nurbldoff
  • 311
  • 3
  • 4

1 Answers1

0

OK, after some source-diving I found that adding the "view" argument to the InstanceFactoryChoice call instead seems to do what I want. Still, it seems there's an inconsistency in there somewhere...

InstanceFactoryChoice(klass=k, view=item_view)
Nurbldoff
  • 311
  • 3
  • 4