def create_item(self, account): """Creates an account list item from given account.""" address = "0x" + account.address.hex() list_item = OneLineListItem(text=address) # makes sure the address doesn't overlap on small screen list_item.ids._lbl_primary.shorten = True list_item.account = account list_item.bind(on_release=lambda x: self.on_release(x)) return list_item
def open_account_list_helper(self, on_selected_item): title = "Select account" items = [] pywalib = self.pywalib account_list = pywalib.get_account_list() for account in account_list: address = '0x' + account.address.encode("hex") item = OneLineListItem(text=address) # makes sure the address doesn't wrap in multiple lines, # but gets shortened item.ids._lbl_primary.shorten = True item.account = account items.append(item) dialog = Controller.create_list_dialog(title, items, on_selected_item) dialog.open()
def add_item(self, text, callback, icon=None): if icon: item = OneLineIconListItem(text=text, on_release=callback) item.add_widget(ListBSIconLeft(icon=icon)) else: item = OneLineListItem(text=text, on_release=callback) item.bind(on_release=lambda x: self.dismiss()) self.mlist.add_widget(item)
def update_color_models(self): for c in self.ids.list_color_models.children: self.ids.list_color_models.remove(c) for k in self.color_models: self.ids.list_color_models.add_widget( OneLineListItem(text=k, on_release=self.load_color_model) )
def show_friend_card(self): self.root.ids.ml.clear_widgets() for i in self.friend_list: if i.is_online: listwidget = OneLineListItem(text=i.name, theme_text_color='Custom', text_color=get_color_from_hex( colors['Amber']['700']), on_release=self.chatwith) iconwidget = IconLeftSampleWidget(icon='account') self.root.ids.ml.add_widget(listwidget) else: listwidget = OneLineListItem(text=i.name, theme_text_color='Custom', on_release=self.chatwith) iconwidget = IconLeftSampleWidget(icon='account-off') self.root.ids.ml.add_widget(listwidget) return
def create_item(self, account): """ Creates an account list item from given account. """ # circular ref from pywallet.controller import Controller address = "0x" + account.address.hex() # gets the alias if exists try: text = Controller.get_address_alias(address) except KeyError: text = address list_item = OneLineListItem(text=text) # makes sure the address doesn't overlap on small screen list_item.ids._lbl_primary.shorten = True list_item.account = account list_item.bind(on_release=lambda x: self.on_release(x)) return list_item
def search_files(self): """Search for the text entered by the user in self.root.ids._search_text_field """ search_text = self.root.ids._search_text_field.text if search_text == "" or search_text == " ": return global audio_search_results, video_search_results global document_search_results, image_search_results global others threading.Thread(target=search_for_files( search_text, 'audio', 'audio_search_results')).start() threading.Thread(target=search_for_files( search_text, 'video', 'video_search_results')).start() threading.Thread(target=search_for_files( search_text, 'image', 'image_search_results')).start() threading.Thread(target=search_for_files( search_text, 'document', 'document_search_results')).start() self.root.ids._search_results_list.clear_widgets() results = [ audio_search_results, video_search_results, document_search_results, image_search_results ] for search_results in results: if search_results is not None: for i in search_results: display_files = OneLineListItem(text=i) display_files.bind(on_release=partial( self.open_file, search_results[i].pop())) self.root.ids._search_results_list.add_widget( display_files) if len(self.root.ids._search_results_list.children) == 0: no_result = TwoLineListItem( text="No files were found for your search " + repr(search_text)) self.root.ids._search_results_list.add_widget(no_result)
def search(self, *args): self.searchdisplay.clear_widgets() self.mat = JsonStore("jsondb/material.json") if self.mat.exists(self.mat_name.text): info = self.mat.get(self.mat_name.text) text = "Mat_id: %s Material type: %s Author: %s " % ( info["mat_id"], info["material"], info["author"]) material = OneLineListItem(size_hint=(1, None), text=text) self.searchdisplay.add_widget(material)
def add_item(self, text, callback, icon=None): if icon: item = OneLineIconListItem(text=text, on_press=callback) item.add_widget(ListBSIconLeft(icon=icon)) else: item = OneLineListItem(text=text, on_press=callback) #apparently this breaks the function command item.bind(on_release=lambda x: self.dismiss()) self.mlist.add_widget(item)
def __init__(self,**kwargs): BoxLayout.__init__(self,**kwargs) self.orientation='vertical' self.add_widget(searchbar(pos_hint={'center_x':0.5,'center_y':0.5})) self.list=MDList() self.suggestions=[] self.scroll=ScrollView(do_scroll_x=False) self.scroll.add_widget(self.list) for x in range(10): self.suggestions.append(OneLineListItem()) self.add_widget(self.scroll) self.add_widget(BoxLayout())
def list_course(self): box = BoxLayout() sv = ScrollView() ml = MDList() self.get_courses = self.c.execute('SELECT * FROM COURSES') for row in sorted(self.get_courses): ml.add_widget(OneLineListItem(text=str(row[1]))) sv.do_scroll_y = True sv.do_scroll_x = False sv.add_widget(ml) self.root.ids.courses.add_widget(sv) self.root.ids.screen_manager.current = str(self.root.ids.courses.name)
def __init__(self): super(lis,self).__init__() tot=network.get_firebase('Schedule') day1=tot['Day1'] day2=tot['Day2'] k1={} k2={} for no,i in enumerate(day1): if (no==0): continue k1[no]=i.replace('\\t','\t') for no,i in enumerate(day2): if (no==0): continue k2[no]=i.replace('\\t','\t') self.name='shed' t=Toolbar(title='shedule',md_bg_color= self.theme_cls.primary_color,background_palette='Primary') t.add_widget(MDRaisedButton(text='back',on_press=lambda x:self.cng_scr('vute'))) #b1=BoxLayout(orientation='vertical') b1=GridLayout(rows=12) n=MDList() l1=OneLineListItem(text='Day 1') n.add_widget(l1) k1_key=k1.keys() for i in k1_key: ln=OneLineListItem(text=k1[i]) n.add_widget(ln) l3=OneLineListItem(text='') n.add_widget(l3) l2=OneLineListItem(text='Day 2') n.add_widget(l2) k2_key=k2.keys() for i in k2_key: ln=OneLineListItem(text=k2[i]) n.add_widget(ln) b1.add_widget(t) b1.add_widget(n) self.add_widget(b1)
def get_student(self, value): sv = ScrollView() ml = MDList() sv.add_widget(ml) get_student = self.c.execute( 'SELECT * FROM STUDENTS WHERE STUDENT_CLASS_NAME = ?', (value, )) for row in get_student: ml.add_widget(OneLineListItem(text=str(row[1]))) sv.do_scroll_y = True sv.do_scroll_x = False r = GridLayout(cols=1, rows=1) r.add_widget(sv) p = Popup(title='STUDENTS', size_hint=(.7, 0.7), background_color=(0, 0, .9, .5), auto_dismiss=True) p.add_widget(r) p.open()
def __init__(self): super(lis, self).__init__() self.k1 = db.get_db('all') self.k2 = self.k1[3:] k1 = self.k1 k2 = self.k2 self.name = 'info' t = Toolbar(title='personal info', md_bg_color=self.theme_cls.primary_color, background_palette='Primary') t.add_widget( MDRaisedButton(text='back', on_press=lambda a: self.cng_scr('vute'))) #b1=BoxLayout(orientation='vertical') b1 = GridLayout(rows=12) n = MDList() l1 = OneLineListItem(text='Details') n.add_widget(l1) name = k1[0].split(' ')[0] n.add_widget(OneLineListItem(text='Name :\t' + name)) n.add_widget(OneLineListItem(text='phone :\t' + k1[1])) n.add_widget(OneLineListItem(text='email :\t' + k1[2])) l3 = OneLineListItem(text='') n.add_widget(l3) l2 = OneLineListItem(text='Registered courses') n.add_widget(l2) cou = 1 for i in range(len(k2)): if k2[i] == '1': ln = OneLineListItem(text=str(cou) + ') ' + proj[i]) cou += 1 n.add_widget(ln) if cou == 1: ln = OneLineListItem(text='no regestered courses') n.add_widget(ln) b1.add_widget(t) b1.add_widget(n) self.add_widget(b1)
def add_one_line(self, data): self.ml.add_widget(OneLineListItem(text=data))