Created
November 1, 2013 19:03
-
-
Save amalgamatedclyde/7270268 to your computer and use it in GitHub Desktop.
this is wrong. i couldn't just add L65 because child was outside of the scope. and i needed bind_selection_from_children = BooleanProperty(True)
then i got two lists if i didn't delete the self.add_widget line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCompositeListItem(ButtonBehavior, CompositeListItem): | |
bind_selection_from_children = BooleanProperty(True) | |
def __init__(self, **kwargs): | |
super(MyCompositeListItem, self).__init__(**kwargs) | |
# There is an index to the data item this composite list item view | |
# represents. Get it from kwargs and pass it along to children in the | |
# loop below. | |
index = kwargs['index'] | |
for cls_dict in kwargs['cls_dicts']: | |
cls = cls_dict['cls'] | |
cls_kwargs = cls_dict.get('kwargs', None) | |
if cls_kwargs: | |
cls_kwargs['index'] = index | |
if 'text' not in cls_kwargs: | |
cls_kwargs['text'] = kwargs['text'] | |
else: | |
cls_kwargs = {} | |
cls_kwargs['index'] = index | |
if 'text' in kwargs: | |
cls_kwargs['text'] = kwargs['text'] | |
child = cls(**cls_kwargs) | |
child.bind(on_release=self.on_release_on_child) | |
def on_release_on_child(self, *args): | |
self.trigger_action(duration=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment