9
9
the documentation is not complete at this time.
10
10
11
11
12
- Data accepted: list of dict .
12
+ Data accepted: list of dicts .
13
13
14
14
TODO:
15
15
- Method to clear cached class instances.
38
38
When views are re-used they may not trigger if the data remains the same.
39
39
"""
40
40
41
+ __all__ = ('RecycleViewBehavior' , 'RecycleView' )
42
+
41
43
from copy import deepcopy
42
44
43
45
from kivy .uix .scrollview import ScrollView
52
54
53
55
54
56
class RecycleViewBehavior (object ):
55
- """RecycleViewBehavior is a flexible view for providing a limited window into
56
- a large data set.
57
+ """RecycleViewBehavior provides a behavioral model upon which the
58
+ :class:`RecycleView` is built. Together, they offer an extensible and
59
+ flexible way to produce views with limited windows over large data sets.
57
60
58
61
See module documentation for more informations.
59
62
"""
@@ -157,8 +160,8 @@ def refresh_from_viewport(self, *largs):
157
160
self ._refresh_trigger ()
158
161
159
162
def _dispatch_prop_on_source (self , prop_name , * largs ):
160
- '''Dispatches the prop of this class when the view_adapter/layout_manager
161
- property changes.
163
+ '''Dispatches the prop of this class when the
164
+ view_adapter/layout_manager property changes.
162
165
'''
163
166
getattr (self .__class__ , prop_name ).dispatch (self )
164
167
@@ -234,8 +237,8 @@ def _set_layout_manager(self, value):
234
237
235
238
if not isinstance (value , RecycleLayoutManagerBehavior ):
236
239
raise ValueError (
237
- 'Expected object based on RecycleLayoutManagerBehavior, got {}' .
238
- format (value .__class__ ))
240
+ 'Expected object based on RecycleLayoutManagerBehavior, '
241
+ 'got {}' . format (value .__class__ ))
239
242
240
243
self ._layout_manager = value
241
244
value .attach_recycleview (self )
@@ -249,7 +252,11 @@ def _set_layout_manager(self, value):
249
252
250
253
251
254
class RecycleView (RecycleViewBehavior , ScrollView ):
255
+ """RecycleView is a flexible view for providing a limited window
256
+ into a large data set.
252
257
258
+ See module documentation for more informations.
259
+ """
253
260
def __init__ (self , ** kwargs ):
254
261
if self .data_model is None :
255
262
kwargs .setdefault ('data_model' , RecycleDataModel ())
@@ -326,21 +333,25 @@ def remove_widget(self, widget, *largs):
326
333
def _get_data (self ):
327
334
d = self .data_model
328
335
return d and d .data
336
+
329
337
def _set_data (self , value ):
330
338
d = self .data_model
331
339
if d is not None :
332
340
d .data = value
341
+
333
342
data = AliasProperty (_get_data , _set_data , bind = ["data_model" ])
334
343
"""Set the data on the current view adapter
335
344
"""
336
345
337
346
def _get_viewclass (self ):
338
347
a = self .layout_manager
339
348
return a and a .viewclass
349
+
340
350
def _set_viewclass (self , value ):
341
351
a = self .layout_manager
342
352
if a :
343
353
a .viewclass = value
354
+
344
355
viewclass = AliasProperty (_get_viewclass , _set_viewclass ,
345
356
bind = ["layout_manager" ])
346
357
"""Set the viewclass on the current layout_manager
@@ -349,11 +360,14 @@ def _set_viewclass(self, value):
349
360
def _get_key_viewclass (self ):
350
361
a = self .layout_manager
351
362
return a and a .key_viewclass
363
+
352
364
def _set_key_viewclass (self , value ):
353
365
a = self .layout_manager
354
366
if a :
355
367
a .key_viewclass = value
368
+
356
369
key_viewclass = AliasProperty (_get_key_viewclass , _set_key_viewclass ,
357
370
bind = ["layout_manager" ])
358
371
"""Set the key viewclass on the current layout_manager
359
372
"""
373
+
0 commit comments