gui fixes

This commit is contained in:
ThomasV 2012-11-15 09:14:24 +01:00
parent 871cf26d5c
commit cc2ef02c2b
3 changed files with 18 additions and 9 deletions

View File

@ -437,7 +437,12 @@ class ElectrumWindow(QMainWindow):
tx_hash = tx['tx_hash']
conf = self.wallet.verifier.get_confirmations(tx_hash)
if conf:
time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
try:
time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
except:
time_str = "unknown"
if conf == -1:
icon = None
if conf == 0:
icon = QIcon(":icons/unconfirmed.png")
elif conf < 6:
@ -845,13 +850,16 @@ class ElectrumWindow(QMainWindow):
label = self.wallet.labels.get(address,'')
n = 0
h = self.wallet.history.get(address,[])
if h == ['*']: h = []
for tx_hash, tx_height in h:
tx = self.wallet.transactions.get(tx_hash)
if tx: n += 1
if h != ['*']:
for tx_hash, tx_height in h:
tx = self.wallet.transactions.get(tx_hash)
if tx: n += 1
num_tx = "%d "%n
else:
n = -1
num_tx = "*"
tx = "%d "%n
if n==0:
if address in self.wallet.addresses:
gap += 1
@ -864,7 +872,7 @@ class ElectrumWindow(QMainWindow):
c, u = self.wallet.get_addr_balance(address)
balance = format_satoshis( c + u, False, self.wallet.num_zeros )
flags = self.wallet.get_address_flags(address)
item = QTreeWidgetItem( [ flags, address, label, balance, tx] )
item = QTreeWidgetItem( [ flags, address, label, balance, num_tx] )
item.setFont(0, QFont(MONOSPACE_FONT))
item.setFont(1, QFont(MONOSPACE_FONT))

View File

@ -50,7 +50,7 @@ class WalletVerifier(threading.Thread):
""" return the number of confirmations of a monitored transaction. """
with self.lock:
if tx in self.transactions.keys():
return (self.local_height - self.verified_tx[tx] + 1) if tx in self.verified_tx else 0
return (self.local_height - self.verified_tx[tx] + 1) if tx in self.verified_tx else -1
else:
return 0

View File

@ -445,6 +445,7 @@ class Wallet:
for addr in domain:
h = self.history.get(addr, [])
if h == ['*']: continue
for tx_hash, tx_height, in h:
tx = self.transactions.get(tx_hash)
for output in tx.get('outputs'):
@ -1071,7 +1072,7 @@ class WalletSynchronizer(threading.Thread):
hist.append( (tx_hash, item['height']) )
if len(hist) != len(result):
raise BaseException("error: server sent history with non-unique txid")
raise BaseException("error: server sent history with non-unique txid", result)
# check that the status corresponds to what was announced
rs = requested_histories.pop(addr)