URI: 
       twhitespaces option in format_satoshis - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit d2b86091b4a4f99e487f0c3e09661d9654725de7
   DIR parent 660c975ff5faeb6cfceb3afd88957e34fd9c1f4c
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sat, 13 Jul 2013 20:19:52 +0200
       
       whitespaces option in format_satoshis
       
       Diffstat:
         M gui/gui_classic.py                  |       8 ++++----
         M gui/gui_gtk.py                      |       4 ++--
         M gui/gui_text.py                     |       2 +-
         M lib/util.py                         |       7 ++++---
       
       4 files changed, 11 insertions(+), 10 deletions(-)
       ---
   DIR diff --git a/gui/gui_classic.py b/gui/gui_classic.py
       t@@ -505,8 +505,8 @@ class ElectrumWindow(QMainWindow):
                    self.need_update.clear()
                self.run_hook('timer_actions')
            
       -    def format_amount(self, x, is_diff=False):
       -        return format_satoshis(x, is_diff, self.wallet.num_zeros, self.decimal_point)
       +    def format_amount(self, x, is_diff=False, whitespaces=False):
       +        return format_satoshis(x, is_diff, self.wallet.num_zeros, self.decimal_point, whitespaces)
        
            def read_amount(self, x):
                if x in['.', '']: return None
       t@@ -720,11 +720,11 @@ class ElectrumWindow(QMainWindow):
                        icon = QIcon(":icons/confirmed.png")
        
                    if value is not None:
       -                v_str = self.format_amount(value, True)
       +                v_str = self.format_amount(value, True, whitespaces=True)
                    else:
                        v_str = '--'
        
       -            balance_str = self.format_amount(balance)
       +            balance_str = self.format_amount(balance, whitespaces=True)
                    
                    if tx_hash:
                        label, is_default_label = self.wallet.get_label(tx_hash)
   DIR diff --git a/gui/gui_gtk.py b/gui/gui_gtk.py
       t@@ -1183,8 +1183,8 @@ class ElectrumWindow:
                    details = self.get_tx_details(tx_hash)
        
                    self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label,
       -                                        format_satoshis(value,True,self.wallet.num_zeros),
       -                                        format_satoshis(balance,False,self.wallet.num_zeros), tooltip, details] )
       +                                        format_satoshis(value,True,self.wallet.num_zeros, whitespaces=True),
       +                                        format_satoshis(balance,False,self.wallet.num_zeros, whitespaces=True), tooltip, details] )
                if cursor: self.history_treeview.set_cursor( cursor )
        
        
   DIR diff --git a/gui/gui_text.py b/gui/gui_text.py
       t@@ -79,7 +79,7 @@ class ElectrumGui:
                        time_str = 'pending'
        
                    label, is_default_label = self.wallet.get_label(tx_hash)
       -            messages.append( format_str%( time_str, label, format_satoshis(value), format_satoshis(balance) ) )
       +            messages.append( format_str%( time_str, label, format_satoshis(value, whitespaces=True), format_satoshis(balance, whitespaces=True) ) )
        
                self.print_list(messages[::-1], format_str%( _("Date"), _("Description"), _("Amount"), _("Balance")))
        
   DIR diff --git a/lib/util.py b/lib/util.py
       t@@ -79,7 +79,7 @@ def local_data_dir():
            return local_data
        
        
       -def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8):
       +def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False):
            from decimal import Decimal
            s = Decimal(x)
            sign, digits, exp = s.as_tuple()
       t@@ -95,8 +95,9 @@ def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8):
        
            p = s.find('.')
            s += "0"*( 1 + num_zeros - ( len(s) - p ))
       -    s += " "*( 1 + decimal_point - ( len(s) - p ))
       -    s = " "*( 13 - decimal_point - ( p )) + s 
       +    if whitespaces:
       +        s += " "*( 1 + decimal_point - ( len(s) - p ))
       +        s = " "*( 13 - decimal_point - ( p )) + s 
            return s