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 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