Skip to content
Snippets Groups Projects
Commit b79db5d8 authored by inso's avatar inso
Browse files

Searching members

parent 464448da
No related branches found
No related tags found
No related merge requests found
import asyncio
import logging
from .transfer import Transfer, Received
from ucoinpy.documents.transaction import InputSource, OutputSource, Transaction
from ucoinpy.documents.transaction import InputSource, OutputSource
from ..tools.exceptions import LookupFailureError
from .net.api import bma as qtbma
class TxHistory():
def __init__(self, wallet):
......
......@@ -19,8 +19,6 @@ from .certification import CertificationDialog
from . import toast
import asyncio
from ..tools.exceptions import LookupFailureError, NoPeerAvailable
from ..core.registry import IdentitiesRegistry
from ucoinpy.api import bma
from ..core.net.api import bma as qtbma
......@@ -244,6 +242,17 @@ Revoking your UID can only success if it is not already validated by the network
# "{0}".format(e),
# QMessageBox.Ok)
@asyncio.coroutine
def _execute_search_text(self, text):
response = yield from self.community.bma_access.future_request(qtbma.wot.Lookup, {'search': text})
identities = []
for identity_data in response['results']:
identity = yield from self.app.identities_registry.future_lookup(identity_data['pubkey'], self.community)
identities.append(identity)
self.edit_textsearch.clear()
self.refresh(identities)
def search_text(self):
"""
Search text and display found identities
......@@ -252,18 +261,8 @@ Revoking your UID can only success if it is not already validated by the network
if len(text) < 2:
return False
try:
response = self.community.request(bma.wot.Lookup, {'search': text})
except Exception as e:
logging.debug('bma.wot.Lookup request error : ' + str(e))
return False
persons = []
for identity in response['results']:
persons.append(self.app.identities_registry(identity['pubkey'], self.community))
self.edit_textsearch.clear()
self.refresh(persons)
else:
asyncio.async(self._execute_search_text(text))
@pyqtSlot(str)
def handle_community_change(self, origin):
......
......@@ -7,17 +7,12 @@ Created on 8 mars 2014
import logging
import requests
from ucoinpy.api import bma
from ucoinpy.api.bma import ConnectionHandler
from ucoinpy.documents.peer import Peer
from PyQt5.QtWidgets import QDialog, QMenu, QMessageBox
from PyQt5.QtGui import QCursor
from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog
from ..models.peering import PeeringTreeModel
from ..core.community import Community
from ..core.registry import IdentitiesRegistry
from ..core.net.node import Node
from ..tools.exceptions import LookupFailureError, NoPeerAvailable
......
......@@ -6,8 +6,6 @@ from PyQt5.QtWidgets import QWidget, QComboBox
from PyQt5.QtCore import pyqtSlot
from ..gen_resources.wot_tab_uic import Ui_WotTabWidget
from cutecoin.gui.views.wot import NODE_STATUS_HIGHLIGHTED, NODE_STATUS_SELECTED, NODE_STATUS_OUT, ARC_STATUS_STRONG, ARC_STATUS_WEAK
from ucoinpy.api import bma
from ..core.registry import IdentitiesRegistry
class WotTabWidget(QWidget, Ui_WotTabWidget):
......
......@@ -4,10 +4,7 @@ Created on 5 févr. 2014
@author: inso
'''
from ucoinpy.api import bma
from ucoinpy.documents.peer import BMAEndpoint, Peer
from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt
from requests.exceptions import Timeout
import logging
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment