tdo not allow unneeded precision - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 0ac3ac8d610b0a60858b6a30ccf15dea5f7909a2
DIR parent 53b74689a1b44f1a793730d67d0d62d29a4487c3
HTML Author: thomasv <thomasv@gitorious>
Date: Wed, 7 Dec 2011 19:24:04 +0100
do not allow unneeded precision
Diffstat:
M client/gui.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
DIR diff --git a/client/gui.py b/client/gui.py
t@@ -39,15 +39,14 @@ def format_satoshis(x):
def numbify(entry, is_int = False):
text = entry.get_text().strip()
s = ''.join([i for i in text if i in '0123456789.'])
- entry.set_text(s)
-
- #entry.set_text( str( Decimal( amount ) / 100000000 ) )
-
if not is_int:
+ p = s.find(".")
+ s = s[:p+9]
try:
- amount = int( Decimal(entry.get_text()) * 100000000 )
+ amount = int( Decimal(s) * 100000000 )
except:
amount = 0
+ entry.set_text(s)
return amount