def on_start(self): self.autonomous = AutonomousDropDown(self) self.teleop = TeleOpDropDown(self) self.endgame = EndgameDropDown(self) self.penalties = PenaltiesDropDown(self) scoring_dropdowns = [self.autonomous, self.teleop, self.endgame] for dropdown in scoring_dropdowns: panel = MDExpansionPanel( icon="", content=dropdown, panel_cls=MDExpansionPanelOneLine(text=dropdown.title)) panel.bind(_state=self.rescroll) self.root.ids.score_sheet.ids.scoring_menu.add_widget(panel) penalty_panel = MDExpansionPanel( icon="", content=self.penalties, panel_cls=MDExpansionPanelOneLine(text=self.penalties.title)) penalty_panel.bind(_state=self.rescroll) self.root.ids.score_sheet.ids.penalties_menu.add_widget(penalty_panel) self.root.ids.toolbar2.ids.label_title.font_size = "24sp" self.started = True
def add_color_panel(self): def set_list_colors_themes(*args): self.settings_theme_panel_open = True if not theme_panel.content.ids.rv.data: for name_theme in palette: theme_panel.content.ids.rv.data.append({ "viewclass": "FileManagerSettingsColorItem", "color": get_color_from_hex(colors[name_theme]["500"]), "text": name_theme, "manager": self, }) # Adds a panel. theme_panel = MDExpansionPanel( icon="palette", content=Factory.FileManagerChangeTheme(), panel_cls=MDExpansionPanelOneLine(text="Select theme"), ) theme_panel.bind( on_open=set_list_colors_themes, on_close=self._set_state_close_theme_panel, ) self.ids.settings.add_widget(theme_panel) # Adds a close button to the settings panel. box = MDBoxLayout(adaptive_height=True) box.add_widget(Widget()) box.add_widget( MDFlatButton( text="CLOSE", on_release=lambda x: self.hide_settings(theme_panel), )) self.ids.settings.add_widget(box)
def on_enter(self): if self.has_already_opened: return else: self.has_already_opened = True content_for_panel = MoreInformation() md_expansion_panel = MDExpansionPanel( content=content_for_panel, icon=f"{PATH_TO_IMAGES}/information.png", title="More information", ) md_expansion_panel.bind(on_open=self.on_panel_open) md_expansion_panel.bind(on_close=self.on_panel_close) self.ids.expansion_panel_box.add_widget(md_expansion_panel) path = f"{PATH_TO_IMAGES}/previous_crop.jpg" if not os.path.exists(path): crop_image( (Window.width, int(dp(Window.height * 35 // 100))), f"{PATH_TO_IMAGES}/previous.jpg", path, ) Clock.schedule_once(lambda x: self.set_path_toImage_product(path), 0.2)
class HistoryScreen(Screen): panel_is_open = False custom_sheet = None def on_enter(self): self.ids.panel_container.clear_widgets() self.panel = MDExpansionPanel(icon="all.png", panel_cls=MDExpansionPanelOneLine( text="Moje testy", ), content=Content()) self.ids.panel_container.add_widget(self.panel) self.panel.bind(on_open=self.panel_open, on_close=self.panel_close) def panel_open(self, *args): self.panel_is_open = True def panel_close(self, *args): self.panel_is_open = False def delete_item(self, item): self.panel.content.remove_widget(item) self.panel.height -= item.height for index, val in enumerate(self.panel.content.children[::-1]): val.secondary_text = str(index + 1) def add_into_panel(self, Názov, interval): item = CustomItem(text=f"{len(self.panel.content.children) + 1} Názov", secondary_text="ukazovatel", tertiary_text="datoum", icon="book-outline") self.panel.content.add_widget(item) if self.panel_is_open and len(self.panel.content.children) > 1: self.panel.height += item.height elif self.panel_is_open and len(self.panel.content.children) == 1: self.panel.height -= (self.panel.height - item.height) - self.panel.panel_cls.height def callback_for_menu_items(self, *args): toast(args[0]) def show_bottom_sheet(self): bs = MDListBottomSheet() bs.add_item("Model správania", lambda x: x, icon='account-group-outline') #for y in 1,2,3,4,12,13,14,21,23,24,31,32,34,41,42,43,123,124,134,234: # bs.add_item(f"{len(self.bs.children) + y} osobnosť",lambda x: self.behavior1(),icon='account-group-outline') bs.add_item("1", lambda x: self.behavior1(), icon='account-group-outline') bs.add_item("2", lambda x: self.behavior2(), icon='account-group-outline') bs.add_item("3", lambda x: self.behavior3(), icon='account-group-outline') bs.add_item("4", lambda x: self.behavior4(), icon='account-group-outline') bs.add_item("12", lambda x: self.behavior12(), icon='account-group-outline') bs.add_item("13", lambda x: self.behavior13(), icon='account-group-outline') bs.add_item("14", lambda x: self.behavior14(), icon='account-group-outline') bs.add_item("21", lambda x: self.behavior21(), icon='account-group-outline') bs.open() def behavior1(self): self.manager.current = "1" def behavior2(self): self.manager.current = "2" def behavior3(self): self.manager.current = "3" def behavior4(self): self.manager.current = "4" def behavior12(self): self.manager.current = "12" def behavior13(self): self.manager.current = "13" def behavior14(self): self.manager.current = "14" def behavior21(self): self.manager.current = "21" def main_navigate(self, button): if button.icon == "home": self.manager.current = "home" elif button.icon == "lightning-bolt": self.manager.current = "mygoals" elif button.icon == "notebook": self.manager.current = "history"
class GoalsScreen(Screen): model = ObjectProperty(None) panel_is_open = False ciel1 = ObjectProperty(None) def submit(self): if self.ids.model.text != "": file = open("package.txt", "w") file.write(self.ids.model.text) self.reset() def on_enter(self): self.ids.cards.clear_widgets() self.panel0 = MDExpansionPanel( icon="flash", content=AContent(), panel_cls=MDExpansionPanelOneLine(text="Definuj si ciele"), ) self.ids.cards.add_widget(self.panel0) self.panel0.bind(on_open=self.panel_open, on_close=self.panel_close) self.panel1 = MDExpansionPanel( icon="human-greeting", content=MeContent(), panel_cls=MDExpansionPanelOneLine(text="Ja"), ) self.ids.cards.add_widget(self.panel1) self.panel1.bind(on_open=self.panel_open, on_close=self.panel_close) self.panel2 = MDExpansionPanel( icon="human-capacity-increase", content=TeamContent(), panel_cls=MDExpansionPanelOneLine(text="Tím"), ) self.ids.cards.add_widget(self.panel2) self.panel2.bind(on_open=self.panel_open, on_close=self.panel_close) self.panel3 = MDExpansionPanel( icon="human-male-female", content=WeContent(), panel_cls=MDExpansionPanelOneLine(text="Vzťah"), ) self.ids.cards.add_widget(self.panel3) self.panel3.bind(on_open=self.panel_open, on_close=self.panel_close) def panel_open(self, *args): self.panel_is_open = True def panel_close(self, *args): self.panel_is_open = False def show_smart(self): self.smart_dialog = MDDialog( title="Technika SMART", text="Tvoj cieľ mousí byť: \n\n" "S- špecifický, pretože musíme vedieť čo\n" "M- merateľný, aby sme vedeli definovať pokrok\n" "A- akceptovaný, pre istotu, že všetic relevantí vedia a súhlasia\n" "R- realistický, aby bolo jasné, že stojíme nohami na zemi\n" "T– termínovaný, určený do kedy má byť splnený\n" "\n\n" "Mal by zodpovedať tieto otázky:\n\n" "- Čo potrebuje zmenu?\n" "- Aká zmena je potrebná?\n" "- Na koho je zmena zameraná?\n" "- Kde sa zmena uplatní?\n" "- Kedy sa zmena uplatní?\n", size_hint=[0.8, None], auto_dismiss=True, ) self.smart_dialog.open() def main_navigate(self, button): if button.icon == "home": self.manager.current = "home" elif button.icon == "lightning-bolt": self.manager.current = "mygoals" elif button.icon == "notebook": self.manager.current = "history"