Table Of Contents
RecycleView Data Model¶
バージョン 1.10.0 で追加.
The data model part of the RecycleView model-view-controller pattern.
It defines the models (classes) that store the data associated with a
RecycleViewBehavior
. Each model (class)
determines how the data is stored and emits requests to the controller
(RecycleViewBehavior
) when the data is
modified.
-
class
kivy.uix.recycleview.datamodel.
RecycleDataModelBehavior
[ソース]¶ ベースクラス:
builtins.object
RecycleDataModelBehavior
is the base class for the models that describes and provides the data for theRecycleViewBehavior
.Events: - on_data_changed:
Fired when the data changes. The event may dispatch keyword arguments specific to each implementation of the data model. When dispatched, the event and keyword arguments are forwarded to
refresh_from_data()
.
-
attach_recycleview
(rv)[ソース]¶ Associates a
RecycleViewBehavior
with this data model.
-
detach_recycleview
()[ソース]¶ Removes the
RecycleViewBehavior
associated with this data model.
-
recycleview
¶ The
RecycleViewBehavior
instance associated with this data model.
-
class
kivy.uix.recycleview.datamodel.
RecycleDataModel
(**kwargs)[ソース]¶ ベースクラス:
kivy.uix.recycleview.datamodel.RecycleDataModelBehavior
,kivy.event.EventDispatcher
A implementation of
RecycleDataModelBehavior
that keeps the data in a indexable list. Seedata
.When data changes this class currently dispatches on_data_changed with one of the following additional keyword arguments.
- none: no keyword argument
- With no additional argument it means a generic data change.
- removed: a slice or integer
- The value is a slice or integer indicating the indices removed.
- appended: a slice
- The slice in
data
indicating the first and last new items (i.e. the slice pointing to the new items added at the end). - inserted: a integer
- The index in
data
where a new data item was inserted. - modified: a slice
- The slice with the indices where the data has been modified. This currently does not allow changing of size etc.
-
data
¶ Stores the model’s data using a list.
The data for a item at index i can also be accessed with
RecycleDataModel
[i].
-
observable_dict
¶ A dictionary instance, which when modified will trigger a data and consequently an on_data_changed dispatch.