Example #1
0
    def fill_accordion_item(self, store):
        storage_butt = AccordionItem()
        storage_butt.id = str(store.id)
        storage_butt.height = 22
        storage_butt.title = str(store.name)

        scroll = ScrollView()
        scroll.do_scroll_x = False
        scroll.size_hint = (1, 1)
        scroll.bar_color = [.5, .10, .15, .8]
        scroll.bar_inactive_color = [.5, .20, .10, .5]
        scroll.scroll_type = ['bars']  # [‘bars’, ‘content’]

        tree_obj = TreeView()
        tree_obj.size_hint = (1, None)
        tree_obj.hide_root = True

        store.tree_view = WeakProxy(tree_obj)
        scroll.add_widget(tree_obj)
        storage_butt.add_widget(scroll)
        return storage_butt
def fill_menu_with_data():
	# Necesary to flush old data 
	airtable_content.clear_tabs()

	# Layout metadata to specify dimension and style
	airtable_content.orientation = "vertical"
	airtable_content.do_default_tab = False # Necesary to disable Default Tab that TabbedPanel generate automatically
	airtable_content.background_color = (0, 0, 1, .5) #50% translucent
	airtable_content.tab_width = 150

	# Trigger airtable connection and data retrieval
	# tab_headers and tab_menus have all data needed to fill airtable_content
	fetch_airtable_data()

	# Creation of each Tab and their respective items 
	for header in tab_headers:

		tab = TabbedPanelHeader(text=header)

		# Scrollview required to adequatly contain items without window or objec distortion
		# Effectively scroll through the menu effortlessly
		scroll = ScrollView()
		scroll.bar_margin = 10
		scroll.size_hint = (1, 1) # Needed to allow scrollview to fit the window regarless od size
		scroll.scroll_type = ['bars', 'content'] # allow scrolling via the bar or by draging content 
		scroll.bar_pos_y = 'left'
		scroll.bar_width = 20
		scroll.bar_color = (5, 10, 15, 0.8)
		scroll.bar_inactive_color = (5, 20, 15, 0.8)
		scroll.do_scroll_y = True # Needed for vertical scrolling
		scroll.do_scroll_x = False
		scroll.scroll_y = 1 # Scrolling speed
		
		# Adding item specifically fitted for the current tab
		scroll.add_widget(format_airtable_data(header))

		tab.content = scroll # adding scrollview with fitted items as content of the tab
		tab.content.orientation = "vertical"
		
		airtable_content.add_widget(tab) # adding the entirity of a tab page to the TabbedPanel