diff --git a/src/cutecoin/core/txhistory.py b/src/cutecoin/core/txhistory.py index 67b852b60e1b644b695cadd8f539d63b6d3a0b65..b2690b931d0fc800085e864b08063ebec82c1d95 100644 --- a/src/cutecoin/core/txhistory.py +++ b/src/cutecoin/core/txhistory.py @@ -1,8 +1,9 @@ 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): diff --git a/src/cutecoin/gui/community_tab.py b/src/cutecoin/gui/community_tab.py index 63845105a71cc1edecaf64d6797631564ce75263..1d48a2a3651e485b5e7412737a1ec1566ac61a31 100644 --- a/src/cutecoin/gui/community_tab.py +++ b/src/cutecoin/gui/community_tab.py @@ -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): diff --git a/src/cutecoin/gui/process_cfg_community.py b/src/cutecoin/gui/process_cfg_community.py index 4b822a2e1c2ac5f82da2bc43422d26d2e232fe3c..eb6d49ac2bb429b263093321be6cb23dd25ee6f8 100644 --- a/src/cutecoin/gui/process_cfg_community.py +++ b/src/cutecoin/gui/process_cfg_community.py @@ -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 diff --git a/src/cutecoin/gui/wot_tab.py b/src/cutecoin/gui/wot_tab.py index 679c12fffa11531d214bbd6e4b6df2aa5aac4865..7fe44de8f0a4c5220cb0e2b37f7d219e0c80c7e8 100644 --- a/src/cutecoin/gui/wot_tab.py +++ b/src/cutecoin/gui/wot_tab.py @@ -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): diff --git a/src/cutecoin/models/peering.py b/src/cutecoin/models/peering.py index 313c3c581210e52e426e33ede66d582b0629561a..307949da2ec871d6cbfc70105420d6d6f45169be 100644 --- a/src/cutecoin/models/peering.py +++ b/src/cutecoin/models/peering.py @@ -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