List¶
morphui.uix.list
¶
MorphListItemFlat(**kwargs)
¶
Bases: RecycleDataViewBehavior, MorphHoverBehavior, MorphRippleBehavior, MorphButtonBehavior, MorphDelegatedThemeBehavior, MorphColorThemeBehavior, MorphOverlayLayerBehavior, MorphInteractionLayerBehavior, MorphContentLayerBehavior, MorphIconLabelIconContainer
A single item within the MorphDropdownMenu widget.
This widget represents a menu item with support for leading icon,
text label, and trailing icon. It inherits from
:class:~morphui.uix.container.MorphIconLabelIconContainer which
provides the layout structure and child widget management.
focus = BooleanProperty(False)
class-attribute
instance-attribute
¶
Indicates whether this list item is focused.
This property determines if the list item is currently focused, when pressing the keyboard navigation keys. A focused item typically receives keyboard input and may have a visual indication of its focused state.
:attr:focus is a :class:~kivy.properties.BooleanProperty and
defaults to False.
release_callback = ObjectProperty(None)
class-attribute
instance-attribute
¶
Callback function invoked when this list item is released.
This property holds a reference to a callback function that is called whenever this list item is released. The function should accept two parameters: the item data and the index of the item within the list.
:attr:release_callback is an
:class:~kivy.properties.ObjectProperty and defaults to None.
rv_index = NumericProperty(0)
class-attribute
instance-attribute
¶
The index of this label within the RecycleView data.
:attr:rv_index is a :class:~kivy.properties.NumericProperty
and defaults to 0.
rv = ObjectProperty(None)
class-attribute
instance-attribute
¶
The RecycleView instance managing this label.
:attr:rv is a :class:~kivy.properties.ObjectProperty
and defaults to None.
refresh_view_attrs(rv, index, data)
¶
Refreshes the view attributes of this menu item.
| PARAMETER | DESCRIPTION |
|---|---|
rv
|
The RecycleView instance managing this menu item.
TYPE:
|
index
|
The index of this menu item within the RecycleView data.
TYPE:
|
data
|
The data list containing the attributes for all menu items.
TYPE:
|
on_release()
¶
Handle the release event for this list item.
This method is called when the list item is released. It
invokes the release_callback function if it is defined,
passing the item data and index as arguments.
MorphToggleListItemFlat(**kwargs)
¶
Bases: MorphToggleButtonBehavior, MorphListItemFlat
A toggleable list item within a MorphUI list view.
This widget extends the base MorphListItemFlat to include toggle button behavior, allowing it to be used as a selectable item within a list. It supports active state management and can be grouped with other toggle items.
MorphListItem(**kwargs)
¶
Bases: RecycleDataViewBehavior, MorphHoverBehavior, MorphRippleBehavior, MorphButtonBehavior, MorphDelegatedThemeBehavior, MorphColorThemeBehavior, MorphOverlayLayerBehavior, MorphInteractionLayerBehavior, MorphContentLayerBehavior, MorphTripleLabelBehavior, MorphLeadingWidgetBehavior, MorphSimpleBoxLayout
A single item within a List widget with triple labels and leading/trailing icons.
This widget represents a list item with support for leading icon, heading label, supporting label, tertiary label, and trailing icon. It provides a more complex layout compared to the flat list item, allowing for additional information to be displayed within the item.
default_child_classes = {'leading_widget': MorphLeadingIconLabel, 'heading_widget': MorphHeadingLabel, 'supporting_widget': MorphSupportingLabel, 'tertiary_widget': MorphTertiaryLabel, 'trailing_widget': MorphTrailingIconLabel}
class-attribute
instance-attribute
¶
Default child widgets for the container.
This dictionary maps widget identities to their default classes. Override in subclasses to change default child widgets.
label_container = MorphSimpleBoxLayout(orientation='vertical', spacing=(dp(2)), auto_size=(False, True), size_hint=(1, None), pos_hint={'center_y': 0.5})
instance-attribute
¶
Container for the label widgets.
This attribute holds a reference to the container that manages the label widgets (heading, supporting, tertiary). It allows for easy access and manipulation of the label widgets as a group.
refresh_view_attrs(rv, index, data)
¶
Refreshes the view attributes of this menu item.
| PARAMETER | DESCRIPTION |
|---|---|
rv
|
The RecycleView instance managing this menu item.
TYPE:
|
index
|
The index of this menu item within the RecycleView data.
TYPE:
|
data
|
The data list containing the attributes for all menu items.
TYPE:
|
on_release()
¶
Handle the release event for this list item.
This method is called when the list item is released. It
invokes the release_callback function if it is defined,
passing the item data and index as arguments.
MorphToggleListItem(**kwargs)
¶
Bases: MorphToggleButtonBehavior, MorphListItem
A toggleable list item with triple labels and leading/trailing icons.
This widget extends the base MorphListItem to include toggle button behavior, allowing it to be used as a selectable item within a list. It supports active state management and can be grouped with other toggle items.
refresh_view_attrs(rv, index, data)
¶
Refreshes the view attributes of this top list item.
| PARAMETER | DESCRIPTION |
|---|---|
rv
|
The RecycleView instance managing this list item.
TYPE:
|
index
|
The index of this menu item within the RecycleView data.
TYPE:
|
data
|
The data list containing the attributes for all menu items.
TYPE:
|
MorphListLayout(**kwargs)
¶
Bases: MorphRecycleBoxLayout
A layout for arranging index labels in a data view.
This class extends the base data view layout and MorphRecycleBoxLayout to provide a vertical layout suitable for index labels.
default_config = dict(theme_color_bindings={'normal_surface_color': 'transparent_color'}, orientation='vertical', auto_size=(False, True), size_hint_x=1)
class-attribute
instance-attribute
¶
Default configuration for the MorphDataViewHeaderLayout.
BaseListView(**kwargs)
¶
Bases: MorphKeyPressBehavior, MorphIdentificationBehavior, RecycleView
A base RecycleView subclass for displaying a list of items.
This class serves as a foundation for list views used in various MorphUI components.
Initialize the list view component.
This constructor applies the default configuration and initializes the base RecycleView functionality.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Additional keyword arguments to customize the list view.
TYPE:
|
filter_value = ObjectProperty('')
class-attribute
instance-attribute
¶
The current filter value used to filter displayed items.
This property holds the value used to filter the list of items.
Items that do not match this filter will be excluded from the
displayed data. This property is used to dynamically manage the
contents of the list view. Override the :meth:should_filter_item
method to customize the filtering logic.
:attr:filter_value is an :class:~kivy.properties.ObjectProperty
and defaults to an empty string.
filter_mode = OptionProperty('contains', options=['fuzzy', 'contains', 'prefix'])
class-attribute
instance-attribute
¶
The matching strategy used when filtering items.
Controls how :attr:filter_value is compared against each item's
text when :meth:should_filter_item is evaluated:
'fuzzy'(default): the query characters must appear in the item text as an in-order subsequence (case-insensitive).'contains': the query must be a case-insensitive substring of the item text.'prefix': the item text must start with the query (case-insensitive).
:attr:filter_mode is a :class:~kivy.properties.OptionProperty
and defaults to 'contains'.
item_release_callback = ObjectProperty(None)
class-attribute
instance-attribute
¶
Callback function invoked when an item is released.
This property holds a reference to a callback function that is called whenever an item in the list is released. The function should accept two parameters: the item instance and the index of the item within the list. The item instance provides access to the item's properties and methods, allowing for customized handling of the release event.
:attr:item_release_callback is an
:class:~kivy.properties.ObjectProperty and defaults to None.
default_data = DictProperty({})
class-attribute
instance-attribute
¶
Default data attributes applied to each list item.
This property holds a dictionary of default attributes that will
be applied to each item in the list. When setting the items
property, these default attributes will be merged with the item-
specific attributes.
:attr:default_data is a :class:~kivy.properties.DictProperty
and defaults to an empty dictionary.
items = AliasProperty(_get_items, _set_items, bind=['_source_items', 'filter_value', 'filter_mode', 'item_release_callback'])
class-attribute
instance-attribute
¶
The list of items to display in the list view.
This property allows getting and setting the list of items. Each
item is represented as a dictionary of attributes. Setting this
property updates the internal _items storage and refreshes the
displayed data. Items that are filtered out based on the current
filter_value will not be included in the displayed data. This
property is used to dynamically manage the contents of the list
view.
:attr:items is an :class:~kivy.properties.AliasProperty and
is bound to changes in the :attr:_items and :attr:filter_value
properties.
available_texts = AliasProperty(_get_available_texts, None, cache=True, bind=['data'])
class-attribute
instance-attribute
¶
Get the list of label texts from the current data (read-only).
This property returns a list of label texts extracted from the
current data. Each item's label text is retrieved from the
label_text key if it exists; otherwise, it falls back to the
text key. If neither key is present, an empty string is used.
:attr:available_texts is an
:class:~kivy.properties.AliasProperty and is bound to changes in
the :attr:data property.
default_config = dict(do_scroll_x=False, do_scroll_y=True, size_hint=(1, 1), bar_width=(dp(4)), scroll_type=['bars', 'content'], scroll_distance=(dp(120)))
class-attribute
instance-attribute
¶
Default configuration for the BaseListView.
should_filter_item(item)
¶
Determine if a list item should be filtered out based on the current filter value.
This method checks if the provided list item matches the filter criteria. If it does not match, the item is considered filtered out and will not be displayed in the list. Override this method to implement custom filtering logic.
| PARAMETER | DESCRIPTION |
|---|---|
item
|
A dictionary representing a single list item.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
refresh_data(*args)
¶
Refresh the displayed data in the list view.
This method updates the RecycleView's data based on the
current list of items after applying any filtering. First, it
ensures that the internal _items storage is up to date,
then it refreshes the displayed data accordingly.
filter_item(item_text, filter_value, filter_mode='fuzzy')
¶
Determine if an item text should be filtered out.
| PARAMETER | DESCRIPTION |
|---|---|
item_text
|
The text of the item to test.
TYPE:
|
filter_value
|
The query string typed by the user.
TYPE:
|
filter_mode
|
The matching strategy to apply:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|