1
0

show unmatured coins in status bar. fixes #1163

This commit is contained in:
ThomasV
2015-05-05 20:52:14 +02:00
parent 4bce96526b
commit 687cc7783f
8 changed files with 74 additions and 52 deletions

View File

@@ -410,9 +410,12 @@ def update_layout():
elif not wallet.up_to_date:
text = "Synchronizing..."
else:
c, u = wallet.get_balance()
c, u, x = wallet.get_balance()
text = "Balance:"+format_satoshis(c)
if u : text += ' [' + format_satoshis(u,True).strip() + ']'
if u:
text += ' [' + format_satoshis(u,True).strip() + ']'
if x:
text += ' [' + format_satoshis(x,True).strip() + ']'
# vibrate if status changed

View File

@@ -1122,9 +1122,12 @@ class ElectrumWindow:
text = "Synchronizing..."
else:
self.status_image.set_from_stock(Gtk.STOCK_YES, Gtk.IconSize.MENU)
c, u = self.wallet.get_balance()
text = "Balance: %s "%( format_satoshis(c,False,self.num_zeros) )
if u: text += "[%s unconfirmed]"%( format_satoshis(u,True,self.num_zeros).strip() )
c, u, x = self.wallet.get_balance()
text = "Balance: %s "%(format_satoshis(c, False, self.num_zeros))
if u:
text += "[%s unconfirmed]"%(format_satoshis(u, True, self.num_zeros).strip())
if x:
text += "[%s unmatured]"%(format_satoshis(x, True, self.num_zeros).strip())
else:
self.status_image.set_from_stock(Gtk.STOCK_NO, Gtk.IconSize.MENU)
self.network_button.set_tooltip_text("Not connected.")
@@ -1148,13 +1151,13 @@ class ElectrumWindow:
if self.wallet.is_change(address): Type = "C"
if address in self.wallet.imported_keys.keys():
Type = "I"
c, u = self.wallet.get_addr_balance(address)
c, u, x = self.wallet.get_addr_balance(address)
if address in self.wallet.frozen_addresses: Type = Type + "F"
label = self.wallet.labels.get(address)
h = self.wallet.history.get(address,[])
n = len(h)
tx = "0" if n==0 else "%d"%n
self.recv_list.append((address, label, tx, format_satoshis(c,False,self.num_zeros), Type ))
self.recv_list.append((address, label, tx, format_satoshis(c+u+x, False, self.num_zeros), Type ))
def update_sending_tab(self):
self.addressbook_list.clear()

View File

@@ -850,8 +850,8 @@ class MiniDriver(QObject):
self.window.activate()
def update_balance(self):
conf_balance, unconf_balance = self.g.wallet.get_balance()
balance = D(conf_balance + unconf_balance)
conf_balance, unconf_balance, x = self.g.wallet.get_balance()
balance = D(conf_balance + unconf_balance + x)
self.window.set_balances(balance)
def update_completions(self):

View File

@@ -525,10 +525,12 @@ class ElectrumWindow(QMainWindow):
text = _("Server is lagging (%d blocks)"%server_lag)
icon = QIcon(":icons/status_lagging.png")
else:
c, u = self.wallet.get_account_balance(self.current_account)
text = _( "Balance" ) + ": %s "%( self.format_amount(c) ) + self.base_unit()
if u: text += " [%s unconfirmed]"%( self.format_amount(u,True).strip() )
c, u, x = self.wallet.get_account_balance(self.current_account)
text = _("Balance" ) + ": %s "%(self.format_amount(c)) + self.base_unit()
if u:
text += " [%s unconfirmed]"%(self.format_amount(u, True).strip())
if x:
text += " [%s unmatured]"%(self.format_amount(x, True).strip())
# append fiat balance and price from exchange rate plugin
r = {}
run_hook('get_fiat_status_text', c+u, r)
@@ -958,8 +960,9 @@ class ElectrumWindow(QMainWindow):
palette = QPalette()
palette.setColor(self.amount_e.foregroundRole(), QColor('red'))
text = _( "Not enough funds" )
c, u = self.wallet.get_frozen_balance()
if c+u: text += ' (' + self.format_amount(c+u).strip() + ' ' + self.base_unit() + ' ' +_("are frozen") + ')'
c, u, x = self.wallet.get_frozen_balance()
if c+u+x:
text += ' (' + self.format_amount(c+u+x).strip() + ' ' + self.base_unit() + ' ' +_("are frozen") + ')'
self.statusBar().showMessage(text)
self.amount_e.setPalette(palette)
self.fee_e.setPalette(palette)
@@ -1030,7 +1033,7 @@ class ElectrumWindow(QMainWindow):
menu.exec_(self.from_list.viewport().mapToGlobal(position))
def set_pay_from(self, domain = None):
self.pay_from = [] if domain == [] else self.wallet.get_unspent_coins(domain)
self.pay_from = [] if domain == [] else self.wallet.get_spendable_coins(domain)
self.redraw_from_list()
def redraw_from_list(self):
@@ -1438,7 +1441,7 @@ class ElectrumWindow(QMainWindow):
domain = self.wallet.get_account_addresses(self.current_account)
for i in self.wallet.frozen_addresses:
if i in domain: domain.remove(i)
return self.wallet.get_unspent_coins(domain)
return self.wallet.get_spendable_coins(domain)
def send_from_addresses(self, addrs):
@@ -1554,8 +1557,8 @@ class ElectrumWindow(QMainWindow):
for k, account in account_items:
if len(accounts) > 1:
name = self.wallet.get_account_name(k)
c, u = self.wallet.get_account_balance(k)
account_item = QTreeWidgetItem( [ name, '', self.format_amount(c+u), ''] )
c, u, x = self.wallet.get_account_balance(k)
account_item = QTreeWidgetItem([ name, '', self.format_amount(c + u + x), ''])
l.addTopLevelItem(account_item)
account_item.setExpanded(self.accounts_expanded.get(k, True))
account_item.setData(0, Qt.UserRole, k)
@@ -1577,8 +1580,8 @@ class ElectrumWindow(QMainWindow):
for address in addr_list:
num, is_used = self.wallet.is_used(address)
label = self.wallet.labels.get(address,'')
c, u = self.wallet.get_addr_balance(address)
balance = self.format_amount(c + u)
c, u, x = self.wallet.get_addr_balance(address)
balance = self.format_amount(c + u + x)
item = QTreeWidgetItem( [ address, label, balance, "%d"%num] )
item.setFont(0, QFont(MONOSPACE_FONT))
item.setData(0, Qt.UserRole, address)

View File

@@ -124,9 +124,12 @@ class ElectrumGui:
if not self.wallet.up_to_date:
msg = _( "Synchronizing..." )
else:
c, u = self.wallet.get_balance()
msg = _("Balance")+": %f "%(Decimal( c ) / 100000000)
if u: msg += " [%f unconfirmed]"%(Decimal( u ) / 100000000)
c, u, x = self.wallet.get_balance()
msg = _("Balance")+": %f "%(Decimal(c) / 100000000)
if u:
msg += " [%f unconfirmed]"%(Decimal(u) / 100000000)
if x:
msg += " [%f unmatured]"%(Decimal(x) / 100000000)
else:
msg = _( "Not connected" )

View File

@@ -132,9 +132,12 @@ class ElectrumGui:
if not self.wallet.up_to_date:
msg = _("Synchronizing...")
else:
c, u = self.wallet.get_balance()
msg = _("Balance")+": %f "%(Decimal( c ) / 100000000)
if u: msg += " [%f unconfirmed]"%(Decimal( u ) / 100000000)
c, u, x = self.wallet.get_balance()
msg = _("Balance")+": %f "%(Decimal(c) / 100000000)
if u:
msg += " [%f unconfirmed]"%(Decimal(u) / 100000000)
if x:
msg += " [%f unmatured]"%(Decimal(x) / 100000000)
else:
msg = _("Not connected")