Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
    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)