electrum

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

commit 9c4fa26e3126c6b01ad4fafd440fa204ef1fe3c2
parent ce16fe224da3f359771dd0c2377414c28cc105cf
Author: thomasv <thomasv@gitorious>
Date:   Thu, 12 Jan 2012 15:42:13 +0100

provide the full server list on wallet creation

Diffstat:
Mclient/electrum.py | 2++
Mclient/gui.py | 30++++++++++++++++++++++--------
2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/client/electrum.py b/client/electrum.py @@ -259,6 +259,7 @@ class Interface: else: break s.close() self.rtime = time.time() - t1 + self.is_connected = True if cmd in[ 'peers','h']: out = ast.literal_eval( out ) return out @@ -277,6 +278,7 @@ class Interface: if not out: print response self.rtime = time.time() - t1 + self.is_connected = True return out def send_tx(self, data): diff --git a/client/gui.py b/client/gui.py @@ -110,6 +110,7 @@ def init_wallet(wallet): wallet.new_seed(None) # ask for the server. + wallet.interface.get_servers() run_network_dialog( wallet, parent=None ) # generate first key @@ -215,6 +216,9 @@ def run_recovery_dialog(wallet): import mnemonic print "not hex, trying decode" seed = mnemonic.mn_decode( seed.split(' ') ) + if not seed: + show_message("no seed") + sys.exit(1) wallet.seed = seed wallet.gap_limit = gap @@ -277,10 +281,14 @@ def run_settings_dialog(wallet, parent): def run_network_dialog( wallet, parent ): image = gtk.Image() image.set_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_DIALOG) - if wallet.interface.is_connected: - status = "Connected to %s.\n%d blocks\nresponse time: %f"%(wallet.interface.host, wallet.interface.blocks, wallet.interface.rtime) + + if parent: + if wallet.interface.is_connected: + status = "Connected to %s.\n%d blocks\nresponse time: %f"%(wallet.interface.host, wallet.interface.blocks, wallet.interface.rtime) + else: + status = "Not connected" else: - status = "Not connected" + status = "Please choose a server." dialog = gtk.MessageDialog( parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, status) @@ -333,9 +341,13 @@ def run_network_dialog( wallet, parent ): r = dialog.run() hh = host_entry.get_text() dialog.destroy() + if r==gtk.RESPONSE_CANCEL: - return - print hh + if parent == None: + sys.exit(1) + else: + return + try: if ':' in hh: host, port = hh.split(':') @@ -344,8 +356,11 @@ def run_network_dialog( wallet, parent ): host = hh port = 50000 except: - self.show_message("error") - return + show_message("error") + if parent == None: + sys.exit(1) + else: + return if host!= wallet.interface.host or port!=wallet.interface.port: wallet.interface.host = host @@ -563,7 +578,6 @@ class BitcoinGUI: try: self.wallet.interface.is_connected = False self.wallet.interface.new_session(self.wallet.all_addresses(), self.wallet.electrum_version) - self.wallet.interface.is_connected = True self.update_session = False self.info.set_text( self.wallet.interface.message) except: