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

Displaying sources should be better now

parent 990842c1
No related branches found
No related tags found
No related merge requests found
......@@ -44,4 +44,4 @@ class Sources(Tx):
def __get__(self, **kwargs):
assert self.pubkey is not None
return self.requests_get('/sources/%d' % self.pubkey, **kwargs).json()
return self.requests_get('/sources/%s' % self.pubkey, **kwargs).json()
......@@ -265,7 +265,7 @@ class InputSource():
@classmethod
def from_bma(cls, bma_data):
index = None
source = bma_data['source']
source = bma_data['type']
number = bma_data['number']
txhash = bma_data['fingerprint']
amount = bma_data['amount']
......
......@@ -68,15 +68,20 @@ class Community(object):
return members
def request(self, request, req_args={}, get_args={}):
error = None
logging.debug("Nodes : {0}".format(self.nodes))
for node in self.nodes:
logging.debug("Trying to connect to : " + node.get_text())
req = request(node.connection_handler(), **req_args)
try:
data = req.get(**get_args)
return data
except:
continue
return None
except ValueError as e:
error = str(e)
logging.debug("Error : {0}".format(error))
logging.debug("Leaving on error...")
return error
def post(self, request, req_args={}, post_args={}):
error = None
......
......@@ -22,7 +22,7 @@ class ReceivedListModel(QAbstractListModel):
self.sources = account.sources()
def rowCount(self, parent):
return len(self.transactions)
return len(self.sources)
def data(self, index, role):
if role == Qt.DisplayRole:
......
......@@ -67,10 +67,10 @@ class Wallet(object):
def sources(self, community):
data = community.request(bma.tx.Sources, req_args={'pubkey': self.pubkey})
sources = []
for s in data:
sources.append(InputSource.from_bma(s))
return sources
tx = []
for s in data['sources']:
tx.append(InputSource.from_bma(s))
return tx
#TODO: Build a cache of latest transactions
def transactions_sent(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment