talign decimal point in columns - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 84d774e2695c89440197b1386aec6b5fbe4935fa DIR parent ce6363a75419f549681be6ff46ced707ef75ac3d HTML Author: ThomasV <thomasv@gitorious> Date: Fri, 9 Dec 2011 20:41:21 +0100 align decimal point in columns Diffstat: M client/gui.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- DIR diff --git a/client/gui.py b/client/gui.py t@@ -29,12 +29,11 @@ gtk.gdk.threads_init() APP_NAME = "Electrum" def format_satoshis(x): - xx = str( Decimal(x) /100000000 ) - #xx = ("%f"%(x*1e-8)).rstrip('0') - if not '.' in xx: xx = xx + '.' - if len(xx) > 0 and xx[-1] =='.': xx+="00" - if len(xx) > 1 and xx[-2] =='.': xx+="0" - return xx + s = str( Decimal(x) /100000000 ) + if not '.' in s: s += '.' + p = s.find('.') + s += " "*( 8 - ( len(s) - p )) + return s def numbify(entry, is_int = False): text = entry.get_text().strip() t@@ -737,6 +736,7 @@ class BitcoinGUI: treeview.append_column(tvcolumn) cell = gtk.CellRendererText() cell.set_alignment(1, 0.5) + cell.set_property('family', 'monospace') tvcolumn.pack_start(cell, False) tvcolumn.add_attribute(cell, 'text', 5) t@@ -744,6 +744,7 @@ class BitcoinGUI: treeview.append_column(tvcolumn) cell = gtk.CellRendererText() cell.set_alignment(1, 0.5) + cell.set_property('family', 'monospace') tvcolumn.pack_start(cell, False) tvcolumn.add_attribute(cell, 'text', 6)