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
here is the class: | |
class StudentDetailList(ListView): | |
updater = ListProperty([]) | |
def __init__(self, **kwargs): | |
super(StudentDetailList, self).__init__(**kwargs) | |
here are the adapters: | |
class carouselApp(App): |
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
def callback4(instance): | |
app = App.get_running_app() | |
if instance.text in app.l.ids['missing'].adapter.data and instance.is_selected == False: | |
newlist = app.l.ids['missing'].adapter.data | |
newlist.remove(instance.text) | |
#app.l.ids['missing'].adapter = SimpleListAdapter(data= newlist, cls= ListItemLabel) | |
print 'newlist is: ', newlist | |
the list logic is working, but the adapter assignment fails with this error: Exception: list adapter: data must be a tuple or list |
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
def build(self): | |
l= Builder.load_file('grd7.kv') | |
m= Builder.load_file('studentlist3.kv') | |
carousel = Carousel(direction='right') | |
carousel.add_widget(l) | |
carousel.add_widget(m) | |
popup = Popup(title='Please select a waypoint', | |
content = Button(text='close window'), | |
size_hint=(None, None), size=(400, 400)) |
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
FloatLayout: | |
Popup: | |
id: popup1 | |
Button: | |
text: ('button pressed') | |
on_release: root.remove_widget(popup1) | |
#on_release: popup1.dismiss(force=True) |
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
def build(self): | |
l= Builder.load_file('grd7.kv') | |
m= Builder.load_file('studentlist3.kv') | |
carousel = Carousel(direction='right') | |
carousel.add_widget(l) | |
carousel.add_widget(m) | |
popup = Popup(title='Please select a waypoint', | |
content = Button(text='close window'), | |
size_hint=(None, None), size=(400, 400)) |
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
def my_args_converter(row_index, rec): | |
dict = {'text': rec.is_selected, | |
'font_size':100, | |
'padding_x': 100, | |
'halign': 'left', | |
'size_hint_y': None, | |
'cls_dicts': [{'cls': ImageButton, 'kwargs': {'text': str(rec[0])+', '+ rec[1], 'source': '/home/clyde/' + rec[3],'is_selected': rec.is_selected, 'size_hint': (.175,1), | |
'border_color': [0,0,0,1], 'deselected_color': [3,0,0,1], 'selected_color': [0, 6,.0,1], 'on_release' : callback4}}, | |
{'cls': ListItemLabel, | |
'kwargs': {'text': str(rec.is_selected), 'font_size': 24, |
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. |
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) | |
ButtonBehavior.__init__(self, **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 |
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(CompositeListItem): | |
def __init__(self, **kwargs): | |
super(MyCompositeListItem, self).__init__(**kwargs) | |
is_selected = kwargs['is_selected'] | |
########## | |
def my_args_converter(row_index, rec): | |
dict = {'text': '', | |
'is_selected': rec.is_selected, |
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
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 | |
cls_kwargs['is_selected'] = is_selected | |
if 'selection_target' not in cls_kwargs: | |
cls_kwargs['selection_target'] = self |