Skip to content

Instantly share code, notes, and snippets.

View amalgamatedclyde's full-sized avatar

Clyde Tressler amalgamatedclyde

View GitHub Profile
@amalgamatedclyde
amalgamatedclyde / gist:7232905
Created October 30, 2013 13:43
args converter
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,
@amalgamatedclyde
amalgamatedclyde / gist:7009760
Created October 16, 2013 15:35
popup attaches to window behind all other widgets
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))
@amalgamatedclyde
amalgamatedclyde / gist:7009061
Created October 16, 2013 14:58
simplest callback ever
FloatLayout:
Popup:
id: popup1
Button:
text: ('button pressed')
on_release: root.remove_widget(popup1)
#on_release: popup1.dismiss(force=True)
@amalgamatedclyde
amalgamatedclyde / gist:6996968
Created October 15, 2013 19:06
here is the def build (self):
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))
@amalgamatedclyde
amalgamatedclyde / gist:6964158
Created October 13, 2013 16:27
why doesn't this callback update the adapter?
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
@amalgamatedclyde
amalgamatedclyde / gist:6939055
Created October 11, 2013 17:48
how do i update my listadapter data? the callback updates the ListProperty, but how do i use the ListProperty to update the adapter? maybe the ListProperty needs to a property of the adapter?
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):
@amalgamatedclyde
amalgamatedclyde / gist:6933947
Created October 11, 2013 12:40
why doesn't this code update my listadapter?
here is my listadapter using an objectProperty:
class studentDetailsAdapter(ListAdapter):
SDA = ObjectProperty(None)
def __init__(self, **kwargs):
super(studentDetailsAdapter, self).__init__(**kwargs)
self.args_converter = lambda row_index, rec: {'text': rec,
class studentDetailsAdapter(ListAdapter):
@amalgamatedclyde
amalgamatedclyde / gist:6902590
Created October 9, 2013 14:53
need to update a listview
here is the adapter:
class studentDetailsAdapter(ListAdapter):
def __init__(self, **kwargs):
super(studentDetailsAdapter, self).__init__(**kwargs)
self.args_converter= lambda row_index, rec: {'text': rec,
'size_hint_y': None,
'text_size': (200, 30),
here is my SimpleListAdapter that i used to override he default one:
class SimpleListAdapter(SimpleListAdapter):
def __init__(self, **kwargs):
super(SimpleListAdapter, self).__init__(**kwargs)
self.args_converter= lambda row_index, x: {'text': x,
'size_hint_y': None,
'color' : [1,1,0,1],
'text_size': (250, 25),
[app]
# (str) Title of your application
title = SafeTrip DetailView
# (str) Package name
package.name = myapp
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test