def on_enter(self): """ Put parsed damper info into the EditDamperScreen fields. """ damper = Damper() try: self.d_types = damper.get_types() except sqlite3.DatabaseError: toast("GetTypesError") else: # Read DB and output data into dampers_container. if not self.d_types: toast(MDApp.get_running_app().tr._("No Types in the DB")) else: menu_items = [{"text": d_type} for d_type in self.d_types] self.menu = MDDropdownMenu(caller=self.ids["dditm_type"], items=menu_items, position="center", width_mult=4, callback=self.set_item) self.tf_number.text = self.old_number # To show correct current_item in the MDDropDownItem (dditm_type). self.dditm_type.current_item = self.old_d_type self.dditm_type.ids["label_item"].text = self.old_d_type self.lbl_choose_date.text = "[u]{}[/u]".format( self.old_check_date) self.tf_location.text = self.old_location self.chbx_isreleased.active = self.old_is_released self.tf_notes.text = self.old_notes
def on_enter(self): """Read DB and output data into types_container.""" # Creating DeleteEditTypeToolbar dots menus. self.menu_dots = MDDropdownMenu( caller=self.ids["tb_deleteedittype"].ids["ibtn_dots"], items=self.menu_items_dots, callback=self.callback_menu_dots, # position="bottom", hor_growth="left", ver_growth="down", width_mult=7) damper = Damper() try: self.d_types = damper.get_types() except sqlite3.DatabaseError: toast("GetTypesError") else: # Read DB and output data into dampers_container. if not self.d_types: toast(MDApp.get_running_app().tr._("No Types in the DB")) else: for d_type in self.d_types: a_type_list_item = TypeListItem(text=d_type) self.ids["types_container"].add_widget(a_type_list_item) # Add all adding TypeListItem to the list for # getting access to right_checkbox_types in the future. self.all_types_in_container.append(a_type_list_item)
def on_enter(self): """Get damper types and put them into self.d_types.""" damper = Damper() try: self.d_types = damper.get_types() except sqlite3.DatabaseError: toast("GetTypesError") else: # Read DB and output data into dampers_container. if not self.d_types: toast(MDApp.get_running_app().tr._("No Types in the DB")) else: menu_items = [{"text": d_type} for d_type in self.d_types] self.menu = MDDropdownMenu(caller=self.ids["dditm_type"], items=menu_items, position="center", width_mult=4, callback=self.set_item) self.ids["dditm_type"].text = self.d_types[0]