2
Implementation of a CompoundEditor demo plugin for Traits UI demo program.
4
This demo shows each of the four styles of the CompoundEditor.
7
from traits.api import HasTraits, Trait, Range
8
from traitsui.api import Item, Group, View
10
#-------------------------------------------------------------------------------
12
#-------------------------------------------------------------------------------
14
class CompoundEditorDemo ( HasTraits ):
15
""" This class specifies the details of the CompoundEditor demo.
18
# To demonstrate any given Trait editor, an appropriate Trait is required.
19
compound_trait = Trait( 1, Range( 1, 6 ), 'a', 'b', 'c', 'd', 'e', 'f' )
22
# Display specification (one Item per editor style)
23
comp_group = Group( Item('compound_trait', style = 'simple', label = 'Simple'),
25
Item('compound_trait', style = 'custom', label = 'Custom'),
27
Item('compound_trait', style = 'text', label = 'Text'),
29
Item('compound_trait',
34
view1 = View( comp_group,
35
title = 'CompoundEditor',
40
popup = CompoundEditorDemo()
42
# Run the demo (if invoked from the command line):
43
if __name__ == '__main__':
44
popup.configure_traits()