3 Jul 16:00
Different editor style in TupleEditor + few issues
Hi all,
I've been dabbling with enthought tools for some time now, its really great and
i'm thankful to all the developers.
I have a problem that i'm not able to figure out how to put a readonly text
field in a tuple. I think i need something like this
class A(HasTraits):
#parameter,value,unit
l = List(Tuple(String,Float,String))
traits_view = View(Item('l', editor=ListEditor(mutable=False,
editor=TupleEditor(cols=3, editors=(TextEditor(),
TextEditor(evaluate=float), TextEditor())))))
a = A()
a.l.append(('Mach No',1.6,''))
a.l.append(('Temperature',380,'K'))
a.configure_traits()
What i want is that the user should not be able to edit the parameter and unit
of the tuple. I'm using list instead of defining the variables explicitly
because they are initialized from a different code at runtime. For example i
need something like
TupleEditor(editors=[...], styles=[...])
or maybe some better way to do this.
Also, i would like to suggest a change in the trait type of
enthought.pyface.workbench.traits_ui_view.TraitsUIView.view
from Str to Any or something more appropriate (Str or View)
This is because something like below does not work currently
obj = A(data=self.application.get_service('my.app.data'))
view = View(...)
view = TraitsUIView(
name='A View',
view=view,
obj=obj
)
It worked when i changed the view trait from Str to Any
Also my mayavi (MlabSceneModel) crashes whenever i click on the show axes
toolbar button. Is it some problem in my setup or does it happen to anyone else.
Thanks
Pankaj Pandey
RSS Feed