def update_section_layout_from_course(self, course): self.pop_up.curr_course = course self.pop_up.selector_button.text = course.get_name() Functions.clear_layout(self.section_layout) grid_layout = GridLayout(cols=len(course.activity_dict.keys()), pos_hint={ 'center_x': .5, 'center_y': .5 }) for activity_key in course.activity_dict: grid_layout.add_widget( Label(text=Section.Section.activity_dict[activity_key], size_hint=(1, .1), pos_hint={ 'center_x': .5, 'center_y': .5 })) for activity_key in course.activity_dict: activity_layout = BoxLayout(orientation="vertical", padding=10, spacing=10, size_hint=(1, None), pos_hint={ 'center_x': .5, 'center_y': .5 }) activity_layout.bind( minimum_height=activity_layout.setter('height')) activity_layout.add_widget( ChoiceLayout(label_text="All", check_box_status=True)) for section in course.activity_dict[activity_key]: activity_layout.add_widget( ChoiceLayout(label_text=section.id, check_box_status=False)) scroll_view = ScrollView( size_hint=(1, 1), pos_hint={ 'center_x': .5, 'center_y': .5 }, do_scroll_x=False, ) scroll_view.add_widget(activity_layout) grid_layout.add_widget(scroll_view) self.section_layout.add_widget(grid_layout)
def update_schedule(self, schedule): Functions.clear_layout(self) self.schedule = schedule section_label_layout_list = [] for section in self.schedule.section_list: section_label_layout_list.append( Functions.add_to_layout( LayoutFactory.make_layout(BoxLayout)( orientation="horizontal", spacing=15, padding=10, size_hint=(1, .2), background_color=(235, 235, 235), pos_hint={ 'center_x': .5, 'center_y': .5 }), Kiveasy.Label(text="{} - {}".format( section.section, section.title), pos_hint={ 'center_x': .5, 'center_y': .5 }), Kiveasy.Label(text="{} - {}".format( Functions.time_to_nice_str(section.start_time), Functions.time_to_nice_str(section.end_time)), size_hint=(.5, None), pos_hint={ 'center_x': .5, 'center_y': .5 }))) Functions.add_to_layout( self, Image(source="Images/Schedule Mockup {}.jpg".format( random.randint(0, 4)), ), *section_label_layout_list, Kiveasy.Label(text="Total Credit: {}".format( self.schedule.credit_sum), bold=True, size_hint=(None, .2), pos_hint={ 'center_x': .5, 'center_y': .5 }))
def do_init_setup(self): Functions.clear_layout(self) Functions.add_to_layout( self, Kiveasy.Label(text="No schedules could be generated"))