Example #1
0
    def on_enter(self, onsuccess=False):
        '''Series of actions to be performed when Schedule screen is entered
        '''

        self.ids.accordian_days.clear_widgets()
        from network import get_data

        # this should update the file on disk
        print onsuccess
        event = get_data('event', onsuccess=onsuccess)
        schedule = get_data('schedule', onsuccess=onsuccess)

        # read the file from disk
        app.event_name = event['name']
        app.venue_name = event['venue']
        start_date = event['start_date']
        end_date = event['end_date']

        dates = schedule['results'][0].keys()
        dates = sorted(dates,
                       key=lambda x: datetime.datetime.strptime(x, '%Y-%m-%d'))
        for date in dates:
            cday = Factory.AccordionItem(title=date)
            self.ids.accordian_days.add_widget(cday)
            sched = schedule['results'][0][date]

            items = len(sched)
            sv = ScrollView()
            gl = GridLayout(cols=4,
                            size_hint_y=None,
                            padding='2dp',
                            spacing='2dp')
            gl.bind(minimum_height=gl.setter('height'))
            for x in ['Time', 'Title', 'talk Type', 'Speaker']:
                ts = Factory.TimeSlice(text=x)
                gl.add_widget(ts)
            i = 0
            for i in xrange(0, items):
                start_time = sched[i]['start_time']
                end_time = sched[i]['end_time']
                l = Label(text="%s - %s" % (start_time, end_time))
                gl.add_widget(l)
                gl.add_widget(
                    Label(text=sched[i]['title'],
                          height='27dp',
                          size_hint_y=None))
                gl.add_widget(
                    Label(text=sched[i]['type'],
                          height='27dp',
                          size_hint_y=None))
                gl.add_widget(
                    Label(text=sched[i]['speaker_name'],
                          height='27dp',
                          size_hint_y=None))

                i += 1
            sv.add_widget(gl)
            cday.add_widget(sv)
Example #2
0
    def on_enter(self):
        '''Series of actions to be performed when Schedule screen is entered
        '''
        
        self.ids.accordian_days.clear_widgets()
        from network import get_data

        # this should update the file on disk
        event = get_data('event')
        schedule = get_data('schedule')

        # read the file from disk
        app.event_name = event['name']
        app.venue_name = event['venue']
        start_date = event['start_date']
        end_date = event['end_date']
        
        dates = schedule['results'][0].keys()     

        for date in dates:
            cday = Factory.AccordionItem(title=date)
            self.ids.accordian_days.add_widget(cday)
            sched = schedule['results'][0][date]          
            items = len(sched)
            sv = ScrollView()
            gl = GridLayout(cols=1,
                            size_hint_y=None,
                            padding='2dp',
                            spacing='2dp')
            i = 0
            for i in xrange(0, items):
                app.start_time = sched[i]['start_time']
                app.end_time = sched[i]['end_time']
                ts = Factory.TimeSlice()
                gl.add_widget(ts)
                gl.add_widget(Label(text=sched[i]['title'], height='27dp',
                    size_hint_y=None))
                gl.add_widget(Label(text='Type: ' + sched[i]['type'],
                    height='27dp', size_hint_y=None))
                gl.add_widget(Label(text='Speaker: ' + sched[i]['speaker_name'],
                    height='27dp', size_hint_y=None))
                
                i+=1

            sv.add_widget(gl)
            cday.add_widget(sv)