electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ff0dee29641bd1b799526bf79676e8488e8e0ba4
parent 9325f47543d799a623d1cd76f496b46f910fc421
Author: ThomasV <thomasv@gitorious>
Date:   Wed,  7 Dec 2011 22:38:31 +0100

numbify

Diffstat:
Mclient/gui.py | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/client/gui.py b/client/gui.py @@ -38,14 +38,23 @@ 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.']) + chars = '0123456789' + if not is_int: chars +='.' + s = ''.join([i for i in text if i in chars]) if not is_int: - p = s.find(".") - s = s[:p+9] + if '.' in s: + p = s.find('.') + s = s.replace('.','') + s = s[:p] + '.' + s[p:p+8] try: amount = int( Decimal(s) * 100000000 ) except: amount = None + else: + try: + amount = int( s ) + except: + amount = None entry.set_text(s) return amount