URI: 
       tRe-add Fiat Balance column - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 915ee94cddf1c2f3c5f35d923e766082ef75630a
   DIR parent 1171a25815448093d9ea81c9788337b11d7a113a
  HTML Author: Neil Booth <kyuupichan@gmail.com>
       Date:   Sat,  5 Sep 2015 17:29:57 +0900
       
       Re-add Fiat Balance column
       
       Diffstat:
         M plugins/exchange_rate.py            |      20 +++++++++++---------
       
       1 file changed, 11 insertions(+), 9 deletions(-)
       ---
   DIR diff --git a/plugins/exchange_rate.py b/plugins/exchange_rate.py
       t@@ -60,12 +60,6 @@ class ExchangeBase:
                    rate = self.history.get(ccy, {}).get(d_t.strftime('%Y-%m-%d'))
                return rate
        
       -    def historical_value_str(self, ccy, satoshis, d_t):
       -        rate = self.historical_rate(ccy, d_t)
       -        if rate:
       -             value = round(Decimal(satoshis) / COIN * Decimal(rate), 2)
       -             return " ".join(["{:,.2f}".format(value), ccy])
       -        return _("No data")
        
        class BitcoinAverage(ExchangeBase):
            def update(self, ccy):
       t@@ -310,9 +304,16 @@ class Plugin(BasePlugin, ThreadJob):
            def requires_settings(self):
                return True
        
       +    def historical_value_str(self, ccy, satoshis, d_t):
       +        rate = self.exchange.historical_rate(ccy, d_t)
       +        if rate:
       +             value = round(Decimal(satoshis) / COIN * Decimal(rate), 2)
       +             return " ".join(["{:,.2f}".format(value), ccy])
       +        return _("No data")
       +
            @hook
            def history_tab_headers(self, headers):
       -        headers.append(_('Fiat Amount'))
       +        headers.extend([_('Fiat Amount'), _('Fiat Balance')])
        
            @hook
            def history_tab_update(self, tx, entry):
       t@@ -322,8 +323,9 @@ class Plugin(BasePlugin, ThreadJob):
                date = timestamp_to_datetime(timestamp)
                if not date:
                    date = timestamp_to_datetime(0)
       -        text = self.exchange.historical_value_str(self.fiat_unit(), value, date)
       -        entry.append("%16s"%text)
       +        for amount in [value, balance]:
       +            text = self.historical_value_str(self.fiat_unit(), amount, date)
       +            entry.append("%16s" % text)
        
            def settings_widget(self, window):
                return EnterButton(_('Settings'), self.settings_dialog)