def build(self) -> 'kivy.uix.tabbedpanel.TabbedPanel': self.tp = TabbedPanel() self.tp.tab_width = 500 #Default tab: Main Controller self.tp.default_tab_text = "Main Controller Page" self.tp.default_tab_content = ControllerView() self.tp.default_tab.background_normal = 'images/strong_blue.png' self.tp.default_tab.background_down = 'images/lime_green.png' #Drone Control self.th_drone_adv_control = TabbedPanelHeader(text='Drone Control') self.th_drone_adv_control.content= DroneView() self.th_drone_adv_control.background_normal = 'images/strong_blue.png' self.th_drone_adv_control.background_down = 'images/lime_green.png' #Drone Control self.th_drone_control = TabbedPanelHeader(text='DIPS and Mapping') self.th_drone_control.content= DroneAdvView() self.th_drone_control.background_normal = 'images/strong_blue.png' self.th_drone_control.background_down = 'images/lime_green.png' #Documentation self.th_doc = TabbedPanelHeader(text='Documentation') self.th_doc.content= DocView() self.th_doc.background_normal = 'images/strong_blue.png' self.th_doc.background_down = 'images/lime_green.png' self.tp.add_widget(self.tp.default_tab) self.tp.add_widget(self.th_drone_adv_control) self.tp.add_widget(self.th_drone_control) self.tp.add_widget(self.th_doc) return self.tp
def build(self): tb_panel= TabbedPanel() tb_panel.background_image ="fundal2.jpg" tb_panel.default_tab_text = "tab-ul default" tb_panel.default_tab_content = Image(source='infoacademy3.gif',pos=(200, 100), size=(200, 200)) th_text_head = TabbedPanelHeader(text='Text tab') th_text_head.content= Label(text='Infoacademy', font_size = 40) th_img_head= TabbedPanelHeader(text='Image tab') th_img_head.content= Image(source='infoacademy4.gif',pos=(400, 100), size=(400, 400)) th_btn_head = TabbedPanelHeader(text='Button tab') layout= GridLayout(cols=1) eticheta=Label(text='tab-ul cu buton', font_size = 40) buton=Button(text='Acesta este un buton',font_size=20) layout.add_widget(eticheta) layout.add_widget(buton) th_btn_head.content= layout th_btn_head.content.padding = 200 tb_panel.add_widget(th_text_head) tb_panel.add_widget(th_img_head) tb_panel.add_widget(th_btn_head) return tb_panel
def __init__(self, **kwargs): super(AdminTabbedPanel, self).__init__(**kwargs) self.do_default_tab = False self.tab_pos = 'top_mid' # Layouts in tabs self.estimators_layout = EstimatorsLayout() self.users_layout = UsersLayout() self.users_vs_estimators_layout = UsersVSEstimatorsLayout() # self.activity_logs_layout = ActivityLogsLayout() self.admin_profile_layout = AdminProfileLayout() # Adding tabbed panel headers self.add_widget( TabbedPanelHeader(text='Estimators', content=self.estimators_layout)) self.add_widget( TabbedPanelHeader(text='Users', content=self.users_layout)) self.add_widget( TabbedPanelHeader(text='Users VS\nEstimators', content=self.users_vs_estimators_layout)) # self.add_widget(TabbedPanelHeader(text='Activity logs', content=self.activity_logs_layout)) self.add_widget( TabbedPanelHeader(text='Profile', content=self.admin_profile_layout))
def __init__(self, **kwargs): super(PartnerUpdate, self).__init__(**kwargs) self.select_partner_tab = TabbedPanelHeader(text = 'Children') self.communication_tab = TabbedPanelHeader(text = 'Communication') self.add_widget(self.select_partner_tab, 0) self.add_widget(self.communication_tab, 0) self.content.do_layout()
def populate(self): app = MDApp.get_running_app() sub_panel = self.children[0] add_new_store = TabbedPanelHeader(text='+') add_new_store.content = NewStoreTabContent() sub_panel.add_widget(add_new_store) for name, store in app.db.stores.items(): if name == 'default': # Duplicated store print(store.name) default_store = store.name continue store_panel = TabbedPanelHeader(text=name.capitalize()) sub_panel.add_widget(store_panel) container = app.container_factory.get('location_details', store) container.to_layout() store_panel.content = BoxLayout(orientation='vertical') store_panel.content.add_widget(LocationDetailHeader()) store_panel.content.add_widget(container.container_display) container.generate_data(store.locations.values()) for panel in sub_panel.tab_list: print(panel.text) # noinspection PyUnboundLocalVariable if panel.text == default_store: sub_panel.default_tab = panel sub_panel.tab_width = app.root.width / (len(sub_panel.tab_list))
def tab_info(self): self.pbuilder = self.parent.parent self.description_tab = TabbedPanel() particle_info = TabbedPanelHeader(text = 'Particle') behavior_info = TabbedPanelHeader(text = 'Behavior') color_info = TabbedPanelHeader(text = 'Color') particle_info.font_size = self.size[0]*.28 behavior_info.font_size = self.size[0]*.28 color_info.font_size = self.size[0]*.28 particle_info.content = RstDocument(source="param_descriptions/ParticleTab.rst") behavior_info.content = RstDocument(source="param_descriptions/BehaviorTab.rst") color_info.content = RstDocument(source="param_descriptions/ColorTab.rst") particle_info.scroll_distance = 2 particle_info.scroll_timeout = 500 behavior_info.scroll_distance = 2 behavior_info.scroll_timeout = 500 color_info.scroll_distance = 2 color_info.scroll_timeout = 500 self.description_tab.default_tab = particle_info self.description_tab.tab_width = self.size[0]*4.36 self.description_tab.tab_height = self.size[1]*.7 self.description_tab.add_widget(particle_info) self.description_tab.add_widget(behavior_info) self.description_tab.add_widget(color_info) self.description_popup = Popup(title="Variable Descriptions", content = self.description_tab, size_hint = (.8,.8), on_open=self._popup_opened, on_dismiss=self._popup_dismissed) self.description_popup.open()
def build(self): tb_panel = TabbedPanel(tab_width=Window.size[0] / 4) screen_layout = BoxLayout(padding=10, orientation="horizontal", size_hint=(.7, 1)) tb_panel.default_tab_text = 'Login' #Create text tab th_text_head = TabbedPanelHeader(id='one', text='Screen1') th_text_head.content = test1().test() #tb_panel.Screen1_tab_content = self.test() #Create image tab th_img_head = TabbedPanelHeader(text='Screen2') th_img_head.content = Image(source='sample.jpg', pos=(400, 100), size=(400, 400)) #Create button tab th_btn_head = TabbedPanelHeader(text='Screen3') th_btn_head.content = Button(text='This is my button', font_size=20, size_hint_x=0.5, size_hint_y=0.5) th_text2_head = TabbedPanelHeader(text='Screen4') th_text2_head.content = Label(text='This is my text content') tb_panel.add_widget(th_text_head) tb_panel.add_widget(th_img_head) tb_panel.add_widget(th_btn_head) tb_panel.add_widget(th_text2_head) return tb_panel
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
def __init__(self, **kwargs): super(MainWidget, self).__init__(**kwargs) self.do_default_tab = False self.tab_width = 200 self.UsRoster = TabbedPanelHeader(text='Our Team') self.ThemRoster = TabbedPanelHeader(text='Their Team') self.UsRoster.content = Roster() self.UsRoster.content.name = 'Us' self.ThemRoster.content = Roster() self.ThemRoster.content.name = 'Them' self.add_widget(self.UsRoster) self.add_widget(self.ThemRoster) self.VMeet = TabbedPanelHeader(text='Varsity Meet') self.JVMeet = TabbedPanelHeader(text='Junior Varsity Meet') self.VMeet.content = DualMeet() self.JVMeet.content = DualMeet() self.add_widget(self.VMeet) self.add_widget(self.JVMeet) self.JVMeet.content.UsRoster = self.UsRoster.content self.JVMeet.content.ThemRoster = self.ThemRoster.content self.JVMeet.content.Daddy = self self.VMeet.content.UsRoster = self.UsRoster.content self.VMeet.content.ThemRoster = self.ThemRoster.content self.VMeet.content.Daddy = self self.VMeet.content.populate() self.JVMeet.content.populate()
def set_course_text_description(self, *args): if self.sections_map is not None and len(self.sections_map.values()) > 0 and \ self.ids.section_spinner.text in self.sections_map.keys(): section = self.sections_map[self.ids.section_spinner.text] course = self.app.client_model.get_course(section.course_name) IND = "\n " description = [] description.append( IND + f"[color=ffffff][size=30]{section.course_name} ({self.ids.semester.text} {section.year})[/size][/color]" ) description.append(IND + f"Section #{section.section_id}") description.append(IND + f"Number of Students: {section.num_students}") self.ids.description_field.halign = 'left' self.ids.description_field.valign = 'top' self.ids.description_field.text = ''.join(description) self.ids.description_field.markup = True self.ids.description_field.texture_update() self.ids.goal_tabbed_panel.clear_widgets() self.ids.goal_tabbed_panel.clear_tabs() all_header = TabbedPanelHeader(text='Overall') db_grades = self.app.client_model.get_section_grades(section) if db_grades is None: db_grades = SectionGrades() self.active_section_grades_panel = SectionStatsPanel( section=section, section_grades=db_grades) self.active_section_grades_panel.link_to_app(self.app) all_header.content = self.active_section_grades_panel self.ids.goal_tabbed_panel.add_widget(all_header) self.active_goal_grades_panels = [] for g_id in course.goals: cfg = self.app.client_model.get_context_free_goal(g_id) db_goal_grades = self.app.client_model.get_section_goal_grades_by_id( section=section, goal_id=g_id) if db_goal_grades is None: db_goal_grades = SectionGoalGrades() new_content = GoalStatsPanel( cfg, section=section, section_goal_grades=db_goal_grades) new_content.link_to_app(self.app) self.active_goal_grades_panels.append(new_content) new_header = TabbedPanelHeader(text=f"Goal#{cfg.id}") new_header.content = new_content self.ids.goal_tabbed_panel.add_widget(new_header) Clock.schedule_once(partial(self.switch_tab, all_header), 0.0)
def build(self): self.title = 'Converter' tabs = TabbedPanel(do_default_tab=False) th = TabbedPanelHeader(text='Audio') th.content = self.GetAudioConversionUI() th1 = TabbedPanelHeader(text='Video') th1.content = self.GetVideoConversionUI() tabs.add_widget(th) tabs.add_widget(th1) return tabs
def __init__(self, **kwargs): super(MainWindow, self).__init__(**kwargs) self.default_tab_text = 'Share' self.main_window_share_contents = MainWindowShareContents() self.default_tab_content = self.main_window_share_contents self.main_window_download_contents = MainWindowDownloadContents() self.download_tab = TabbedPanelHeader(text='Download') self.download_tab.content = self.main_window_download_contents self.add_widget(self.download_tab) self.main_window_about_contents = MainWindowAboutContents() self.about_tab = TabbedPanelHeader(text='About') self.about_tab.content = self.main_window_about_contents self.add_widget(self.about_tab)
def create_tabs(self): pbuilder = self.parent th1 = TabbedPanelHeader(text = 'Particle') th2 = TabbedPanelHeader(text = 'Behavior') th3 = TabbedPanelHeader(text = 'Color') th1.content = ParticlePanel(pbuilder) th2.content = BehaviorPanel(pbuilder) th3.content = ColorPanel(pbuilder) th1.font_size = self.size[0] * .036 th2.font_size = self.size[0] * .036 th3.font_size = self.size[0] * .036 self.tabs_loaded = True self.particle_tabs.add_widget(th1) self.particle_tabs.add_widget(th2) self.particle_tabs.add_widget(th3)
def build(self): tp = TabbedPanel(do_default_tab=False) overviewTab = TabbedPanelHeader(text='Overview') gameTab = TabbedPanelHeader(text='Game') imageTab = TabbedPanelHeader(text='Images') soundTab = TabbedPanelHeader(text='Sounds') tp.add_widget(overviewTab) overviewTab.content = overviewContent() c = gameContent() if c: tp.add_widget(gameTab) gameTab.content = c c = picturesContent() if c: tp.add_widget(imageTab) scroll = ScrollView(size_hint=(1, None), size=(tp.width, Window.height - tp.height), bar_width=10, scroll_type=['bars', 'content']) scroll.add_widget(c) imageTab.content = scroll c = soundsContent() if c: tp.add_widget(soundTab) scroll = ScrollView(size_hint=(1, None), size=(tp.width, Window.height - tp.height), bar_width=10, scroll_type=['bars', 'content']) scroll.add_widget(c) soundTab.content = scroll #layout.bind(size=self._update_rect, pos=self._update_rect) #addScreenInfo(tree, screen) #addPictures(tree, pictures) #addSounds(tree, sounds) #addExecutables(tree, executables) #root = ScrollView(size_hint=(1, None), size=(Window.width, Window.height), bar_width=10, scroll_type=['bars', 'content']) #root.add_widget(tree) #gameTab.add_widget(root) return tp
def create_new_class(self, create_class_list_widget, class_name): # TO DO: creating class and then immediately removing class doesn't work if not len(create_class_list_widget.student_widgets): print('Class is empty!') return path = os.path.join('records', class_name.strip().replace(' ', '_') + '.db') if os.path.exists(path): print('Error! Class already exists!') return print('Creating New Class:', path) db = open(path, 'w') conn = sqlite3.connect(path) curs = conn.cursor() db_cons.append(conn) db_curs.append(curs) db_manager.reset(curs, True) for i, w in enumerate(create_class_list_widget.student_widgets): print(w.name) db_manager.add_user(curs, i, w.name) tab = TabbedPanelHeader(text=class_name) tab.content = StudentList(len(self.student_main.class_tabs)) self.student_main.class_tabs.append(tab) self.student_main.add_widget(tab) # db_manager.close(conn) self.dismiss_create_class_popup()
def __init__(self, db, **kwargs): super(UserTabbedPanel, self).__init__(**kwargs) self.db = db self.do_default_tab = False self.tab_pos = 'top_mid' # Layouts in tabs self.user_estimators_layout = UserEstimatorsLayout(db=self.db) self.user_own_profile_layout = UserOwnProfileLayout(db=self.db) # Adding tabbed panel headers self.add_widget(TabbedPanelHeader(text='Estimators', content=self.user_estimators_layout)) self.add_widget(TabbedPanelHeader(text='Profile', content=self.user_own_profile_layout)) self.bind(user=self.bind_user)
def __init__(self, retour_selection, titre, parent_scm, dict_eleves_par_groupe, **kwargs): self.titre = titre self.retour_selection = retour_selection self.parent_scm = parent_scm self.dict_eleves = dict_eleves_par_groupe self.dict_panneau_groupe = dict() super(Formation, self).__init__(**kwargs) for nom_groupe in self.dict_eleves.keys(): tb = TabbedPanelItem(text=nom_groupe) panneaugr = PanneauGroupe(self.dict_eleves[nom_groupe], nom_cours=titre) self.dict_panneau_groupe[nom_groupe] = panneaugr tb.add_widget(panneaugr) self.nb.add_widget(tb) fin = TabbedPanelItem(text='Terminer') self.panfin = PanneauFinFormation(self.terminaison, self.recapitulatif) fin.add_widget(self.panfin) fin.bind(on_release=self.panfin.update) self.nb.add_widget(fin) self.panneau_fin = fin retour = TabbedPanelHeader(text='Retour') retour.bind(on_release=self.retour) self.nb.add_widget(retour) self.panneau_retour = retour
def crear_tab(materia): global estante global libreria th = TabbedPanelHeader(text=materia) layout_del_content=GridLayout(cols=1,spacing=[10,10],padding=[10,10],size_hint_y=None) layout_del_content.bind(minimum_height=layout_del_content.setter('height')) #habilitar el scrolliing my_scroll_view=ScrollView(size_hint=(1, None), size=(libreria.width,libreria.height-100)) my_scroll_view.add_widget(layout_del_content) th.content=my_scroll_view #rescatamos referencia al contenedor de la tabla #materias.append() estante.add_widget(th)
def __init__(self, **kwargs): super(GraphManager, self).__init__(**kwargs) self.n_points_per_update = 10 self.tabs_dict = { 'Capacitance': CapacitancePlot(n_plots=4, color=[(0.5, 0.1, 0.1, 1), (0.1, 0.5, 0.1, 1), (0.1, 0.1, 0.5, 1), (0.5, 0.1, 0.5, 1)], legend=['Ch 1', 'Ch 2', 'Ch 3', 'Ch 4']), 'Resistance': ResistancePlot(), 'Temperature': TemperaturePlot(color=(0.5, 0.1, 0.1, 1), legend='Temperature'), 'Humidity': HumidityPlot(color=(0.5, 0.1, 0.1, 1), legend='Humidity'), 'Current': CurrentPlot() } for tab in self.tabs_dict.keys(): # Create panel th = TabbedPanelHeader(text=tab) th.content = self.tabs_dict[tab] self.add_widget(th) # Bind data sample rate self.bind(data_sample_rate=self.tabs_dict[tab].setter( 'data_sample_rate')) # Bind temperature and humidity sample rate self.bind(temperature_sample_rate=self.tabs_dict[tab].setter( 'temperature_sample_rate')) self.bind(num_samples_per_second=self.tabs_dict[tab].setter( 'num_samples_per_second'))
def load(self, path, filename): donnees = pd.read_table(os.path.join(path, filename[0]), sep='\t', header=0) self.titre = "Echantillon: " + donnees["Sample Name"][1] print(os.path.join(path, filename[0])) M, F, P, Echantillon_F, log = Traitement2.lecture_fichier( os.path.join(path, filename[0])) """ Maintenant concernant le fait que les biologistes puissent changer les seuils, j'ai ajoute des setters sur la classe Echantillon egalement. Il est important que tu mettes en place les nouvelles valeurs ici avant de faire passer le tout dans "traitement_donnees". Sinon tes modifs n'auront pas lieu. Voilà les lignes de code :""" Echantillon_F.set_seuil_hauteur(self.hauteur) Echantillon_F.set_seuil_taux_conta(self.conta) Echantillon_F.set_seuil_nbre_marqueurs(self.nb) Traitement2.Echantillon.analyse_donnees(Echantillon_F, M, F, log) resultats, conclusion, log = Echantillon_F.analyse_donnees(M, F, log) nv_onglets = TabbedPanelHeader(text=str(donnees["Sample Name"][1]), background_color=(75 * 3 / 255, 127 * 3 / 255, 209 * 3 / 255, 1)) contenu_res = ResAnalyse(titre="Echantillon: " + donnees["Sample Name"][1] + "\n" + "\n", NvGroupe=len(self.ids.les_onglets.tab_list)) contenu_res.remplissage(resultats, conclusion, Echantillon_F.get_conclusion()) nv_onglets.content = contenu_res self.ids.les_onglets.add_widget(nv_onglets) self.ids.les_onglets.switch_to(nv_onglets, do_scroll=True) self.dismiss_popup()
def create_game_widgets(self): pos_x = 0.2 tp = Tab(size_hint=(0.8, 0.75), pos_hint={'x': pos_x, 'y': 0.25}) th = TabbedPanelHeader(text='Game State') tp.add_widget(th) layout = FloatLayout() pos_x = 0.1 game = GameHandler.get_game_instance() print(game.__dict__) for index, suit in enumerate(Suit): card_map = game.card_map[index] selected_cards = [] if len(card_map) > 0: min_card = Card.from_str(card_map[0]) max_card = Card.from_str(card_map[1]) selected_cards = list(CardIterator(min_card, max_card)) second = SuitWidget(suit, selected_cards, size_hint=(0.2, 1), pos_hint={ 'x': pos_x, 'y': 0.15 }) pos_x += 0.2 layout.add_widget(second) th.content = layout self.add_widget(tp) self.state_layout = layout game = GameHandler.get_game_instance() self.create_player_widget(game.me) background_color = get_color_from_hex( "#FFFFFF" if game.is_your_turn() else "#808080") disabled_color = get_color_from_hex("#FFFFFF") self.pass_button = pass_button = Button( text="PASS", pos_hint={ 'x': 0.4, 'y': 0.05 }, size_hint=(0.25, 0.05), disabled=not game.is_your_turn(), background_disabled_normal='') pass_button.background_color = background_color pass_button.disabled_color = disabled_color pass_button.bind(on_press=self.pass_move) self.add_widget(pass_button, index=0) self.move_button = move_button = Button( text="Make Move", size_hint=(0.25, 0.05), pos_hint={ 'x': 0.4, 'y': 0.15 }, disabled=not game.is_your_turn(), background_disabled_normal='') move_button.background_color = background_color move_button.disabled_color = disabled_color move_button.bind(on_press=self.on_click) self.add_widget(move_button, index=0)
def add_tab(self): """Adds a new tab to this TabbedPanel. The new tab will contain a TransformPanel and attach this panel as a listener to its transform property. It will be added after the current tab, and the panel will switch to that tab. This implementation has a hard-limit of 6 tabs; the implementation will show an error dialog if this method tries to exceed that number of tabs.""" if (len(self.tab_list) > 6): dialog = ErrorDialog('No more than 6 transforms allowed') dialog.size_hint = (0.7, 0.6) dialog.pos_hint = {'x': 0.15, 'y': 0.2} return pos = self.tab_list.index(self.current_tab) content = TransformPanel() content.bind(transform=self.recalculate) panel = TabbedPanelHeader(text='', content=content) panel.background_color = (0.8, 0.8, 0.5) panel.background_down = 'a5lib/uix/tab_down.png' panel.background_normal = 'a5lib/uix/tab_up.png' self.add_widget(panel) for x in range(pos): self.shuffle_tab(x, True) tab1 = self.tab_list[pos + 1] tab2 = self.tab_list[pos] tab1.state = 'normal' tab2.state = 'down' self.switch_to(self.tab_list[pos])
def add_term_widget(self, cfg): layout = TermBoxLayout() ti = TabbedPanelHeader() ti.text = ' '.join([str(len(self.root_widget.term_panel.tab_list) + 1), 'Terminal']) ti.content = layout ti.size_hint = (1,1) self.root_widget.term_panel.add_widget(ti) session = create_session(cfg, self.create_terminal(cfg)) term_widget = TermTextInput(session) term_widget.size_hint = (1, 1) term_widget.pos_hint = {'center_y':.5, 'center_x':.5} layout.add_widget(term_widget) layout.term_widget = term_widget ti.term_widget = term_widget ti.session = session ti.session.term_widget = term_widget ti.session.terminal.term_widget = term_widget Clock.unschedule(self.root_widget.term_panel._load_default_tab_content) self.switch_to_tab(ti) conn_str = cfg.get_conn_str() if conn_str in self.conn_history: self.conn_history.remove(conn_str) self.conn_history.insert(0, conn_str)
def add_panel(self, panel, name, uid): scrollview = ScrollView() scrollview.add_widget(panel) if not self.tabbedpanel.default_tab_content: self.tabbedpanel.default_tab_text = name self.tabbedpanel.default_tab_content = scrollview else: panelitem = TabbedPanelHeader(text=name, content=scrollview) self.tabbedpanel.add_widget(panelitem)
def build(self): self.config.read(self.get_application_config()) h = Home() th = TabbedPanelHeader(text='Settings') h.add_widget(th) sett = Settings() th.content = sett.create_json_panel('Fractal Entropy', self.config, data=mysettings.json) return h
def create_player_widget(self, player): pos_x = 0 tp = Tab(size_hint=(0.2, 0.75), pos_hint={'x': pos_x, 'y': 0.25}) th = TabbedPanelHeader(text=player.player["name"]) tp.add_widget(th) player_widget = GamePlayerWidget(player=player) player_widget.bind(selected_card=self.on_selected) th.content = player_widget self.add_widget(tp) self.player_widget = player_widget
def build(self): tabbedpanel = TabbedPanel(do_default_tab = False) tabbedpanel.bind(current_tab = self.on_current_tab) self.curtab = None self.filechooser = FileChooser(path = os.path.abspath('.'), on_submit = self.on_file_submit) self.filechooserheader = TabbedPanelHeader(text = 'Select file', content = self.filechooser) tabbedpanel.add_widget(self.filechooserheader) self.qrwidget = QRCode() self.qrwidget.borderwidth = self.config.getint('settings', 'borderwidth') self.on_config_change(self.config, 'settings', 'error', self.config.get('settings', 'error')) self.qrwidget.imagery = self.config.get('settings', 'imagery') self.qrwidgetheader = TabbedPanelHeader(text = 'Sending', content = self.qrwidget) tabbedpanel.add_widget(self.qrwidgetheader) self.readiter = None self.writefile = None self.cameraheaders = ( TabbedPanelHeader(text = 'Camera 1'),#, content = Camera(index = 0, play = False)), TabbedPanelHeader(text = 'Camera 2')#, content = Camera(index = 1, play = False)) ) for cameraheader in self.cameraheaders: tabbedpanel.add_widget(cameraheader) #self.camera = Camera(index=1) #self.camera._camera.bind(on_texture = self.on_camtexture) #self.camera._camera.widget = self.camera #pagelayout.add_widget(self.camera) self.settingsheader = TabbedPanelHeader(text = 'Settings', content = self._app_settings) tabbedpanel.add_widget(self.settingsheader) self.tabbedpanel = tabbedpanel self.settings_cls = SettingsWithNoMenu # this seems clearer than doing the hack to make dynamic creation work in tabbedpanel self._app_settings = self.create_settings() return tabbedpanel
def __init__(self, **kwargs): super(StudentMain, self).__init__(**kwargs) self.default_tab_text = 'Welcome!' self.default_tab.content = Label(text='Welcome to CATsys!') for i in range(len(db_curs)): tab = TabbedPanelHeader( text=db_names[i]) #(text='Class %i' % (i + 1)) tab.content = StudentList(i) self.class_tabs.append(tab) self.add_widget(tab)
def build(self): self.vehicle_connected = False self.vehicle = None self.load_sounds() #self.connect() self.main_tab = TabbedPanel() self.trim_tab = TrimTab(self.vehicle, self.main_tab) #self.main_tab.bind(children=self.on_switch) self.main_tab.bind(current_tab=self.on_switch) self.update_tab_callbacks() self.prepare() self.main_tab.default_tab_text = "Basic" self.main_tab.default_tab_content = self.dashboard_base_tab() th = TabbedPanelHeader(text="Speed asist") th.content = self.dashboard_speed_tab() self.main_tab.add_widget(th) th = TabbedPanelHeader(text="Trim") th.content = self.trim_tab.content() self.main_tab.add_widget(th) #self.main_tab.add_widget(self.draw_bottom_line()) self.status_release = -9 self.status_bar = BoxLayout(orientation="horizontal") self.last_update = Label() self.last_update.text = "Test..." self.status_bar.add_widget(self.last_update) self.status_bar.size_hint = (None, 0.1) self.window = BoxLayout(orientation="vertical") self.window.add_widget(self.main_tab) self.window.add_widget(self.status_bar) return self.window
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