electrum

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

commit 735f9b9c20bb442fb237c9c354b4bf402b6d3682
parent 266bbc876c5730fa6223d6ff0562451d1fe075ea
Author: thomasv <thomasv@gitorious>
Date:   Wed, 30 May 2012 16:46:04 +0200

import lib directory as electrum if the library is not installed

Diffstat:
Melectrum | 9++++++---
Mlib/gui.py | 5++---
Mlib/gui_qt.py | 6++----
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/electrum b/electrum @@ -30,11 +30,14 @@ except: print "AES does not seem to be installed. Try 'sudo pip install slowaes'" sys.exit(1) - -import electrum +try: + import electrum +except: + print "Electrum library not found. Importing lib as electrum" + import lib as electrum + from optparse import OptionParser from decimal import Decimal - from electrum import Wallet, WalletSynchronizer, format_satoshis known_commands = ['help', 'validateaddress', 'balance', 'contacts', 'create', 'restore', 'payto', 'sendtx', 'password', 'addresses', 'history', 'label', 'mktx','seed','import','signmessage','verifymessage','eval','deseed','reseed'] diff --git a/lib/gui.py b/lib/gui.py @@ -22,9 +22,10 @@ import socket, traceback import pygtk pygtk.require('2.0') import gtk, gobject -from electrum import pyqrnative from decimal import Decimal +import pyqrnative, mnemonic + gtk.gdk.threads_init() APP_NAME = "Electrum" import platform @@ -59,7 +60,6 @@ def numbify(entry, is_int = False): def show_seed_dialog(wallet, password, parent): - from electrum import mnemonic if not wallet.seed: show_message("No seed") return @@ -206,7 +206,6 @@ def run_recovery_dialog(wallet): try: seed.decode('hex') except: - from electrum import mnemonic print "not hex, trying decode" seed = mnemonic.mn_decode( seed.split(' ') ) if not seed: diff --git a/lib/gui_qt.py b/lib/gui_qt.py @@ -40,6 +40,8 @@ except: sys.exit(1) from wallet import format_satoshis +import bmp, mnemonic, pyqrnative + from decimal import Decimal import platform @@ -107,7 +109,6 @@ class QRCodeWidget(QWidget): self.set_addr(addr) def set_addr(self, addr): - from electrum import pyqrnative self.addr = addr self.qr = pyqrnative.QRCode(4, pyqrnative.QRErrorCorrectLevel.L) self.qr.addData(addr) @@ -720,7 +721,6 @@ class ElectrumWindow(QMainWindow): @staticmethod def show_seed_dialog(wallet, parent=None): - from electrum import mnemonic if not wallet.seed: QMessageBox.information(parent, _('Message'), _('No seed'), _('OK')) @@ -833,7 +833,6 @@ class ElectrumWindow(QMainWindow): qrw.repaint() def do_save(): - from electrum import bmp bmp.save_qrcode(qrw.qr, "qrcode.bmp") self.show_message(_("QR code saved to file") + " 'qrcode.bmp'") @@ -978,7 +977,6 @@ class ElectrumWindow(QMainWindow): seed = unicode(seed_e.text()) seed.decode('hex') except: - from electrum import mnemonic print "not hex, trying decode" try: seed = mnemonic.mn_decode( seed.split(' ') )