1
# Copyright (c) 2007, Enthought, Inc.
5
Implementation of a CheckListEditor demo plugin for the Traits UI demo program.
7
For each of three CheckListEditor column formations, this demo shows
8
each of the four styles of the CheckListEditor.
13
import HasTraits, List
16
import Item, Group, View, CheckListEditor
18
# Define the demo class:
19
class CheckListEditorDemo ( HasTraits ):
20
""" Define the main CheckListEditor demo class. """
22
# Define a trait for each of three formations:
23
checklist_4col = List( editor = CheckListEditor(
24
values = [ 'one', 'two', 'three', 'four' ],
27
checklist_2col = List( editor = CheckListEditor(
28
values = [ 'one', 'two', 'three', 'four' ],
31
checklist_1col = List( editor = CheckListEditor(
32
values = [ 'one', 'two', 'three', 'four' ],
35
# CheckListEditor display with four columns:
37
Item( 'checklist_4col', style = 'simple', label = 'Simple' ),
39
Item( 'checklist_4col', style = 'custom', label = 'Custom' ),
41
Item( 'checklist_4col', style = 'text', label = 'Text' ),
43
Item( 'checklist_4col', style = 'readonly', label = 'ReadOnly' ),
47
# CheckListEditor display with two columns:
49
Item( 'checklist_2col', style = 'simple', label = 'Simple' ),
51
Item( 'checklist_2col', style = 'custom', label = 'Custom' ),
53
Item( 'checklist_2col', style = 'text', label = 'Text' ),
55
Item( 'checklist_2col', style = 'readonly', label = 'ReadOnly' ),
59
# CheckListEditor display with one column:
61
Item( 'checklist_1col', style = 'simple', label = 'Simple' ),
63
Item( 'checklist_1col', style = 'custom', label = 'Custom' ),
65
Item( 'checklist_1col', style = 'text', label = 'Text' ),
67
Item( 'checklist_1col', style = 'readonly', label = 'ReadOnly' ),
71
# The view includes one group per column formation. These will be displayed
72
# on separate tabbed panels.
77
title = 'CheckListEditor',
83
demo = CheckListEditorDemo()
85
# Run the demo (if invoked from the command line):
86
if __name__ == '__main__':
87
demo.configure_traits()