electrum

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

commit 775bbcc316fe23791d02151747ba2ad44508c5d2
parent 36b9144d600b21fdd8ef438c382335cda6c545ea
Author: ThomasV <thomasv@gitorious>
Date:   Sun, 15 Jan 2012 18:45:30 +0100

read URI scheme

Diffstat:
Mclient/electrum.py | 25+++++++++++++++++++++----
Mclient/gui.py | 6++++++
2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/client/electrum.py b/client/electrum.py @@ -151,7 +151,11 @@ def int_to_hex(i, length=1): return s.decode('hex')[::-1].encode('hex') +# URL decode +_ud = re.compile('%([0-9a-hA-H]{2})', re.MULTILINE) +urldecode = lambda x: _ud.sub(lambda m: chr(int(m.group(1), 16)), x) +# AES EncodeAES = lambda secret, s: base64.b64encode(aes.encryptData(secret,s)) DecodeAES = lambda secret, e: aes.decryptData(secret, base64.b64decode(e)) @@ -762,21 +766,34 @@ if __name__ == '__main__': except: firstarg = '' - if cmd not in known_commands: - cmd = 'help' - interface = Interface() wallet = Wallet(interface) wallet.set_path(options.wallet_path) - if cmd == 'gui': + if cmd == 'gui' or re.match('^bitcoin:', cmd): import gui gui.init_wallet(wallet) gui = gui.BitcoinGUI(wallet) + if re.match('^bitcoin:', cmd): + address, params = cmd[8:].split('?') + params = params.split('&') + cmd = 'gui' + amount = '' + label = '' + for p in params: + k,v = p.split('=') + if k=='amount': amount = v + if k=='label': label = urldecode(v) + + gui.set_send_tab(address, amount, label) + gui.main() wallet.save() sys.exit(0) + if cmd not in known_commands: + cmd = 'help' + if not wallet.read() and cmd not in ['help','create']: print "Wallet file not found." print "Type 'electrum.py create' to create a new wallet, or provide a path to a wallet with the -d option" diff --git a/client/gui.py b/client/gui.py @@ -720,6 +720,12 @@ class BitcoinGUI: self.payto_label_entry = label_entry self.add_tab(page, 'Send') + def set_send_tab(self, address, amount, label): + self.notebook.set_current_page(1) + self.payto_entry.set_text(address) + self.payto_label_entry.set_text(label) + self.payto_amount_entry.set_text(amount) + def create_about_tab(self): page = gtk.VBox() page.show()