Module Expr Str Assign NameStore TupleLoad Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr decorator_list
N/A N/A 
SelectableDataItem
==================

.. versionadded:: 1.5

.. warning::

    This code is still experimental, and its API is subject to change in a
    future version.

Data Models
-----------

Kivy is open about the type of data used in applications built with
the system. However, base classes are sometimes needed to ensure data conforms
to the requirements of some parts of the system.

A :class:`SelectableDataItem` is a basic Python data model class that can be
used as a mixin to build data objects that are compatible with Kivy's
:class:`~kivy.adapters.adapter.Adapter`
and selection system and which work with views such as a
:class:`~kivy.uix.listview.ListView`. A boolean *is_selected*
property a requirement.

The default operation of the selection system is to not propogate selection in
views such as ListView to the underlying data: selection is by default a
view-only operation. However, in some cases, it is useful to propogate
selection to the actual data items.

You may, of course, build your own Python data model system as the backend for
a Kivy application. For instance, to use the `Google App Engine Data Modeling
<https://cloud.google.com/appengine/docs/python/datastore/datamodeling>`_
system with Kivy, you could define your class as follows::

    from google.appengine.ext import db

    class MySelectableDataItem(db.Model):
        # ... other properties
        is_selected = db.BooleanProperty()

It is easy to build such a class with plain Python.

 N/A __all__ N/A SelectableDataItem SelectableDataItem N/A object N/A N/A 
    A mixin class containing requirements for selection operations.
     __init__ N/A N/A self is_selected N/A False N/A N/A N/A N/A N/A super SelectableDataItem self __init__ N/A N/A self _is_selected is_selected N/A is_selected N/A N/A self N/A N/A N/A A boolean property indicating whether the data item is selected or
        not. N/A N/A self _is_selected N/A property is_selected N/A N/A self value N/A N/A N/A N/A self _is_selected value N/A N/A is_selected setter N/A