do not allow unneeded precision

This commit is contained in:
thomasv 2011-12-07 19:24:04 +01:00
parent 53b74689a1
commit 0ac3ac8d61
1 changed files with 4 additions and 5 deletions

View File

@ -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