traitsui.list_str_adapter module¶
Defines adapter interfaces for use with the ListStrEditor.
-
class
traitsui.list_str_adapter.
AnIListStrAdapter
¶ Bases:
traits.has_traits.HasPrivateTraits
-
accepts
= Bool(True)¶ Does the adapter know how to handle the current item or not?
-
index
= Int¶ The index of the current item being adapted.
-
is_cacheable
= Bool(True)¶ Does the value of accepts depend only upon the type of item?
-
item
= Any¶ Current item being adapted.
-
value
= Any¶ The current value (if any).
-
-
class
traitsui.list_str_adapter.
IListStrAdapter
¶ Bases:
traits.has_traits.Interface
-
accepts
= Bool¶ Does the adapter know how to handle the current item or not?
-
index
= Int¶ The index of the current item being adapted.
-
is_cacheable
= Bool¶ Does the value of accepts depend only upon the type of item?
-
item
= Any¶ Current item being adapted.
-
value
= Any¶ The current value (if any).
-
-
class
traitsui.list_str_adapter.
ListStrAdapter
¶ Bases:
traits.has_traits.HasPrivateTraits
The base class for adapting list items to values that can be edited by a ListStrEditor.
-
adapters
= List(IListStrAdapter, update=True)¶ List of optional delegated adapters.
-
bg_color
= Color(None, update=True)¶ The default background color for list items.
-
cache
= Any({})¶ Cache of attribute handlers.
-
cache_flushed
= Event(update=True)¶ Event fired when the cache is flushed.
-
can_edit
= Bool(True)¶ Can the text value of each list item be edited.
-
default_text
= Str¶ Specifies the default text for a new list item.
-
default_value
= Any('')¶ Specifies the default value for a new list item.
-
delete
(object, trait, index)¶ Deletes the specified object.trait[index] list item.
-
dropped
= Enum('after', 'before')¶ Specifies where a dropped item should be placed in the list relative to the item it is dropped on.
-
even_bg_color
= Color(None, update=True)¶ The default background color for even list items.
-
even_text_color
= Color(None, update=True)¶ The default text color for even list items.
-
get_bg_color
(object, trait, index)¶ Returns the background color for a specified object.trait[index] list item. A result of None means use the default list item background color.
-
get_can_drop
(object, trait, index, value)¶ Returns whether the specified value can be dropped on the specified object.trait[index] list item. A value of True means the value can be dropped; and a value of False indicates that it cannot be dropped.
-
get_can_edit
(object, trait, index)¶ Returns whether the user can edit a specified object.trait[index] list item. A True result indicates the value can be edited, while a False result indicates that it cannot be edited.
-
get_default_bg_color
(object, trait)¶ Returns the default background color for the specified object.trait list.
-
get_default_image
(object, trait)¶ Returns the default image for the specified object.trait list.
-
get_default_text
(object, trait)¶ Returns the default text for the specified object.trait list.
-
get_default_text_color
(object, trait)¶ Returns the default text color for the specified object.trait list.
-
get_default_value
(object, trait)¶ Returns a new default value for the specified object.trait list.
-
get_drag
(object, trait, index)¶ Returns the ‘drag’ value for a specified object.trait[index] list item. A result of None means that the item cannot be dragged.
-
get_dropped
(object, trait, index, value)¶ Returns how to handle a specified value being dropped on a specified object.trait[index] list item. The possible return values are:
- ‘before’
- Insert the specified value before the dropped on item.
- ‘after’
- Insert the specified value after the dropped on item.
-
get_image
(object, trait, index)¶ Returns the name of the image to use for a specified object.trait[index] list item. A result of None means no image should be used. Otherwise, the result should either be the name of the image, or an ImageResource item specifying the image to use.
-
get_item
(object, trait, index)¶ Returns the value of the object.trait[index] list item.
-
get_text
(object, trait, index)¶ Returns the text to display for a specified object.trait[index] list item.
-
get_text_color
(object, trait, index)¶ Returns the text color for a specified object.trait[index] list item. A result of None means use the default list item text color.
-
image
= Str(None, update=True)¶ The name of the default image to use for list items.
-
index
= Int¶ The index of the current item being adapter.
-
insert
(object, trait, index, value)¶ Inserts a new value at the specified object.trait[index] list index.
-
item
= Any¶ The current item being adapted.
-
len
(object, trait)¶ Returns the number of items in the specified object.trait list.
-
odd_bg_color
= Color(None, update=True)¶ The default background color for odd list items.
-
odd_text_color
= Color(None, update=True)¶ The default text color for odd list items.
-
set_text
(object, trait, index, text)¶ Sets the text for a specified object.trait[index] list item to text.
-
text_color
= Color(None, update=True)¶ The default text color for list items.
-
value
= Any¶ The current value (if any).
-