traitsui.list_str_adapter module¶
Defines adapter interfaces for use with the ListStrEditor.
- class traitsui.list_str_adapter.AnIListStrAdapter[source]¶
Bases:
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(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]¶
Bases:
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[source]¶
Bases:
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 = Dict()¶
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.
- 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)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
Returns the default background color for the specified object.trait list.
- get_default_image(object, trait)[source]¶
Returns the default image for the specified object.trait list.
- get_default_text(object, trait)[source]¶
Returns the default text for the specified object.trait list.
- get_default_text_color(object, trait)[source]¶
Returns the default text color for the specified object.trait list.
- get_default_value(object, trait)[source]¶
Returns a new default value for the specified object.trait list.
- get_drag(object, trait, index)[source]¶
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)[source]¶
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)[source]¶
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_text(object, trait, index)[source]¶
Returns the text to display for a specified object.trait[index] list item.
- get_text_color(object, trait, index)[source]¶
Returns the text color for a specified object.trait[index] list item. A result of None means use the default list item text color.
- get_tooltip(object, trait, index)[source]¶
Returns a string containing the tooltip to display for a specified object.trait[index] list item.
Users should return self.tooltip to use the Adapter’s default, or the empty string to disable the tooltip for this row (in which case the Item’s tooltip, if present, will be shown on QT).
- 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)[source]¶
Inserts a new value at the specified object.trait[index] list index.
- item = Any()¶
The current item being adapted.
- 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)[source]¶
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.
- tooltip = Str(update=True)¶
The tooltip information for a item.
- value = Any()¶
The current value (if any).