From 0ac3ac8d610b0a60858b6a30ccf15dea5f7909a2 Mon Sep 17 00:00:00 2001 From: thomasv Date: Wed, 7 Dec 2011 19:24:04 +0100 Subject: [PATCH] do not allow unneeded precision --- client/gui.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/client/gui.py b/client/gui.py index c3b20488..515b118e 100644 --- a/client/gui.py +++ b/client/gui.py @@ -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