commit bcf70ba2e19bf7d93a7de1112bdf42ddddd20e40
parent 0f12aca5f99ef13979c44b82ce2653e41c472492
Author: root <root@www.(none)>
Date: Thu, 10 Nov 2011 23:52:04 +0300
Merge branch 'master' of gitorious.org:electrum/electrum
Diffstat:
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/client/electrum.py b/client/electrum.py
@@ -405,27 +405,32 @@ class Wallet:
return conf, unconf
def request(self, request ):
- import urllib
+
use_http = self.port in [80,81]
if use_http:
- request2 = urllib.urlencode({'q':request})
- request = "GET /electrum.php?" + request2 + " HTTP/1.0\r\n\r\n"
+ import httplib, urllib
+ params = urllib.urlencode({'q':request})
+ headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
+ conn = httplib.HTTPConnection(self.host)
+ conn.request("POST", "/electrum.php", params, headers)
+ response = conn.getresponse()
+ if response.status == 200:
+ out = response.read()
+ else: out = ''
+ conn.close()
+
else:
request += "#"
-
- s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
- s.connect(( self.host, self.port))
- s.send( request )
- out = ''
- while 1:
- msg = s.recv(1024)
- if msg: out += msg
- else: break
- s.close()
-
- if use_http:
- out = out.split('\r\n')[-1]
+ s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
+ s.connect(( self.host, self.port))
+ s.send( request )
+ out = ''
+ while 1:
+ msg = s.recv(1024)
+ if msg: out += msg
+ else: break
+ s.close()
return out
@@ -447,7 +452,7 @@ class Wallet:
def update(self):
blocks, changed_addresses = self.poll()
- self.blocks = blocks
+ self.blocks = int(blocks)
for addr, blk_hash in changed_addresses.items():
if self.status[addr] != blk_hash:
print "updating history for", addr
diff --git a/client/gui.py b/client/gui.py
@@ -51,7 +51,7 @@ def show_seed_dialog(wallet, password):
buttons = gtk.BUTTONS_OK,
message_format = "Your wallet generation seed is:\n\n" + seed \
+ "\n\nPlease keep it in a safe place; if you lose it, you will not be able to restore your wallet.\n\n" \
- + "Your wallet seed can also be stored and recovered with the following mnemonic code:\n\n\"" + ' '.join(mnemonic.mn_encode(seed)) + "\"" )
+ + "Alternatively, your wallet seed can be stored and recovered with the following mnemonic code:\n\n\"" + ' '.join(mnemonic.mn_encode(seed)) + "\"" )
dialog.show()
dialog.run()
dialog.destroy()
@@ -358,7 +358,7 @@ class BitcoinGUI:
self.window.connect("destroy", gtk.main_quit)
self.window.set_border_width(0)
self.window.connect('mykeypress', gtk.main_quit)
- self.window.set_default_size(650, 350)
+ self.window.set_default_size(670, 350)
vbox = gtk.VBox()