1
#-------------------------------------------------------------------------------
3
# Copyright (c) 2007, Enthought, Inc.
6
# This software is provided without warranty under the terms of the BSD
7
# license included in enthought/LICENSE.txt and may be redistributed only
8
# under the conditions described in the aforementioned license. The license
9
# is also available online at http://www.enthought.com/licenses/BSD.txt
11
# Thanks for using Enthought open source!
13
# Author: David C. Morrill
16
#-------------------------------------------------------------------------------
18
""" Traits UI editor factory for editing lists of strings.
21
#-------------------------------------------------------------------------------
23
#-------------------------------------------------------------------------------
25
from __future__ import absolute_import
27
from traits.api import Str, Enum, List, Bool, Instance, Property
29
from ..basic_editor_factory import BasicEditorFactory
31
from ..toolkit import toolkit_object
33
from pyface.image_resource import ImageResource
35
#-------------------------------------------------------------------------------
36
# 'ListStrEditor' editor factory class:
37
#-------------------------------------------------------------------------------
39
class ListStrEditor ( BasicEditorFactory ):
40
""" Editor factory for list of string editors.
43
#-- Trait Definitions ------------------------------------------------------
45
# The editor class to be created:
48
# The optional extended name of the trait to synchronize the selection
52
# The optional extended name of the trait to synchronize the selection
56
# The optional extended name of the trait to synchronize the activated value
60
# The optional extended name of the trait to synchronize the activated
64
# The optional extended name of the trait to synchronize the right clicked
68
# The optional extended name of the trait to synchronize the right clicked
70
right_clicked_index = Str
72
# Can the user edit the values?
73
editable = Bool( True )
75
# Are multiple selected items allowed?
76
multi_select = Bool( False )
78
# Should horizontal lines be drawn between items?
79
horizontal_lines = Bool( False )
81
# The title for the editor:
84
# The optional extended name of the trait containing the editor title:
87
# Should a new item automatically be added to the end of the list to allow
88
# the user to create new entries?
89
auto_add = Bool( False )
91
# The adapter from list items to editor values:
92
adapter = Instance( 'traitsui.list_str_adapter.ListStrAdapter',
95
# The optional extended name of the trait containing the adapter:
98
# What type of operations are allowed on the list:
99
operations = List( Enum( 'delete', 'insert', 'append', 'edit', 'move' ),
100
[ 'delete', 'insert', 'append', 'edit', 'move' ] )
102
# Are 'drag_move' operations allowed (i.e. True), or should they always be
103
# treated as 'drag_copy' operations (i.e. False):
104
drag_move = Bool( False )
106
# The set of images that can be used:
107
images = List( ImageResource )
109
def _get_klass(self):
110
""" Returns the editor class to be created.
112
return toolkit_object('list_str_editor:_ListStrEditor')
113
##EOF #########################################################################