1
# Copyright (c) 2007, Enthought, Inc.
5
Implementation of an EnumEditor demo for Traits UI
7
This demo shows each of the four styles of the EnumEditor
9
Fixme: This only shows the capabilities of the old-style EnumEditor
14
import HasTraits, Enum
17
import Item, Group, View
19
# Define the demo class:
20
class EnumEditorDemo ( HasTraits ):
21
""" Defines the main EnumEditor demo class. """
23
# Define an Enum trait to view:
24
name_list = Enum( 'A-495', 'A-498', 'R-1226', 'TS-17', 'TS-18' )
26
# Items are used to define the display, one Item per editor style:
28
Item( 'name_list', style = 'simple', label = 'Simple' ),
30
Item( 'name_list', style = 'custom', label = 'Custom' ),
32
Item( 'name_list', style = 'text', label = 'Text' ),
34
Item( 'name_list', style = 'readonly', label = 'ReadOnly' )
46
demo = EnumEditorDemo()
48
# Run the demo (if invoked from the command line):
49
if __name__ == '__main__':
50
demo.configure_traits()