示例#1
0
文件: dash.py 项目: x4rMa/Dash
	def build(self):
        # App is built as a tabbed panel with three tabs:
        # Navigation, Status, and Media. These allow quick
        # access to the things you actually want to do in
        # a car without excessive UI navigation.
		tp = TabbedPanel()
		tp.do_default_tab = False
		tp.tab_pos = 'bottom_mid'
		tp.tab_width = Window.width / 3

		nav = TabbedPanelHeader(text='Nav')
		status = TabbedPanelHeader(text='Status')
		media = TabbedPanelHeader(text='Media')
		
		tp.add_widget(nav)
		tp.add_widget(status)
		tp.add_widget(media)

		#nav.content = Label(text = 'Nav system goes here')
		#status.content = Label(text = 'Performance, health, and eco stats go here')
		#media.content = Label(text = 'Media player goes here')

        # Each tab's content is implemented in a tab above.
		nav.content = KVMaps()
		status.content = Performance()
		media.content = MusicPlayer()
		return tp
示例#2
0
    def build(self):
        tab_panel= TabbedPanel()
        tab_panel.do_default_tab = False
        tab_panel.tab_width = 150
        tab_panel.tab_height = 30

        th_playlist = TabbedPanelHeader(text='Playlist Playout')
        th_playlist.content = Label(text='UI to create a playlist rundown')

        th_generic_live = TabbedPanelHeader(text='Generic Live Event')
        th_generic_live.content = Label(text='UI for running random live events')

        th_news = TabbedPanelHeader(text='News Broadcast')
        th_news.content = Label(text='UI for running a live news broadcast')

        th_worship = TabbedPanelHeader(text='Worship')
        th_worship.content= Label(text='UI for running praise & worships')

        th_football = TabbedPanelHeader(text='Football')
        th_football.content= Label(text='UI for running a football match')

        th_volleyball = TabbedPanelHeader(text='Volleyball')
        th_volleyball.content= Label(text='UI for running a volleyball match')

        tab_panel.add_widget(th_playlist)
        tab_panel.add_widget(th_generic_live)
        tab_panel.add_widget(th_news)
        tab_panel.add_widget(th_worship)
        tab_panel.add_widget(th_football)
        tab_panel.add_widget(th_volleyball)

        tab_panel.default_tab = th_playlist

        return tab_panel
示例#3
0
def generate_GUI(menus):
    app_gui = TabbedPanel()
    app_gui.clear_tabs()
    app_gui.orientation = "vertical"
    app_gui.do_default_tab = False
    app_gui.tab_width = 150

    for menu_key, sub_menu in menus.items():
        main_menu = TabbedPanelHeader(text=menu_key)
        scroll_pane = ScrollView()
        scroll_pane.scroll_type = ['bars', 'content']
        scroll_pane.bar_pos_y = 'left'
        scroll_pane.bar_width = 6
        scroll_pane.do_scroll_y = True
        scroll_pane.do_scroll_x = False
        scroll_pane.scroll_y = 1

        menu_grid = GridLayout(cols=1, spacing=2, size_hint_y=None)
        menu_grid.orientation = "vertical"
        menu_grid.padding = 10
        menu_grid.row_default_height = 1
        menu_height = 0

        print(">>>" + menu_key)
        for sub_menu_key, items in sub_menu.items():
            menu_grid.add_widget(
                Label(text="     " + sub_menu_key, size_hint=(None, None), font_size=14, halign="left",
                      valign="middle"))
            print("\t" + sub_menu_key)
            for option in items:

                if "Name" in option:
                    print("\t\t" + option["Name"])
                    btn = Button(text=option["Name"], size_hint=(0.1, None), background_color=(0.2, 1, 1, 0.8))
                    btn.bind(on_press=lambda x: webbrowser.open(option["URL"]))
                else:
                    print("\t\t" + "<EMPTY>")
                    btn = Button(text="<EMPTY>", size_hint=(0.1, None), background_color=(0.2, 1, 1, 0.8))
                    btn.bind(on_press=lambda x: webbrowser.open(option["URL"]))
                btn.width = 250
                btn.height = 50
                menu_grid.add_widget(btn)
                menu_height += 80
            menu_height += 51
        menu_grid.height = menu_height
        scroll_pane.add_widget(menu_grid)
        main_menu.content = scroll_pane
        main_menu.orientation = "vertical"

        # Adding headers to main layout
        app_gui.add_widget(main_menu)
    return app_gui