electrum

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

commit f2fc18fe327c5c8f0fe2bdb2fe8f7f57f623ccfa
parent f442cc31e4e6bc5abbdadf06738e5ee33da7511b
Author: akshayaurora <akshayaurora@gmail.com>
Date:   Tue,  1 Jul 2014 04:59:25 +0530

changes to make kivy branch with master

Diffstat:
Mgui/kivy/__init__.py | 44+++-----------------------------------------
Mgui/kivy/main_window.py | 37++++++++++---------------------------
Mgui/kivy/tools/buildozer.spec | 2+-
3 files changed, 14 insertions(+), 69 deletions(-)

diff --git a/gui/kivy/__init__.py b/gui/kivy/__init__.py @@ -21,7 +21,7 @@ import sys #, time, datetime, re, threading #from electrum.i18n import _, set_language -from electrum.util import print_error, print_msg, parse_url +from electrum.util import print_error, print_msg #:TODO: replace this with kivy's own plugin managment #from electrum.plugins import run_hook @@ -73,46 +73,8 @@ class ElectrumGui: #init_plugins(self) def set_url(self, url): - from electrum import util - from decimal import Decimal - - try: - address, amount, label, message,\ - request_url, url = util.parse_url(url) - except Exception: - self.main_window.show_error(_('Invalid bitcoin URL')) - return - - if amount: - try: - if main_window.base_unit == 'mBTC': - amount = str( 1000* Decimal(amount)) - else: - amount = str(Decimal(amount)) - except Exception: - amount = "0.0" - self.main_window.show_error(_('Invalid Amount')) - - if request_url: - try: - from electrum import paymentrequest - except: - self.main_window.show_error("cannot import payment request") - request_url = None - - if not request_url: - self.main_window.set_send(address, amount, label, message) - return - - def payment_request(): - self.payment_request = paymentrequest.PaymentRequest(request_url) - if self.payment_request.verify(): - Clock.schedule_once(self.main_window.payment_request_ok) - else: - Clock.schedule_once(self.main_window.payment_request_error) - - threading.Thread(target=payment_request).start() - self.main_window.prepare_for_payment_request() + #self.current_window.pary_from_URI + pass def main(self, url): ''' The main entry point of the kivy ux diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -25,7 +25,7 @@ Factory.register('QrScannerDialog', module='electrum_gui.kivy.uix.dialogs.qr_sca # delayed imports: for startup speed on android -notification = app = Decimal = ref = format_satoshis = is_valid = Builder = None +notification = app = Decimal = ref = format_satoshis = bitcoin = Builder = None inch = None util = False re = None @@ -557,16 +557,10 @@ class ElectrumWindow(App): ''' global format_satoshis if not format_satoshis: - from electrum.wallet import format_satoshis + from electrum.util import format_satoshis return format_satoshis(x, is_diff, self.num_zeros, self.decimal_point, whitespaces) - def read_amount(self, x): - if x in['.', '']: - return None - p = pow(10, self.decimal_point) - return int( p * Decimal(x) ) - def update_wallet(self, *dt): ''' ''' @@ -802,13 +796,8 @@ class ElectrumWindow(App): def do_send(self): app = App.get_running_app() screen_send = app.root.main_screen.ids.tabs.ids.screen_send - scrn = screen_send.content.ids + scrn = screen_send.ids label = unicode(scrn.message_e.text) - # TODO - #if self.gui_object.payment_request: - # outputs = self.gui_object.payment_request.outputs - # amount = self.gui_object.payment_request.get_amount() - #else: r = unicode(scrn.payto_e.text).strip() @@ -819,24 +808,18 @@ class ElectrumWindow(App): m = re.match('(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>', r) to_address = m.group(2) if m else r - global is_valid - if not is_valid: - from electrum.bitcoin import is_valid + global bitcoin + if not bitcoin: + from electrum import bitcoin - if not is_valid(to_address): + if not bitcoin.is_address(to_address): app.show_error(_('Invalid Bitcoin Address') + ':\n' + to_address) return - try: - amount = self.read_amount(unicode(scrn.amount_e.text)) - except Exception: - app.show_error(_('Invalid Amount')) - return - try: - fee = self.read_amount(unicode(scrn.fee_e.amt)) - except Exception as err: - print err + amount = scrn.amount_e.text + fee = scrn.fee_e.amt + if not fee: app.show_error(_('Invalid Fee')) return diff --git a/gui/kivy/tools/buildozer.spec b/gui/kivy/tools/buildozer.spec @@ -32,7 +32,7 @@ source.exclude_exts = spec version = 1.9.8 # (list) Application requirements -requirements = pil, qrcode, ecdsa, pbkdf2, openssl, pyopenssl, plyer==master, kivy==master +requirements = pil, qrcode, ecdsa, pbkdf2, openssl, pyopenssl, pyasn, pyasn-modules, plyer==master, kivy==master # (str) Presplash of the application presplash.filename = %(source.dir)s/gui/kivy/theming/splash.png