commit 689fc1e2074ddb362d9b71452f00685154eb0b0b
parent 2fb6e9d5703e19e53cf8582ad70dfa52819cf028
Author: ThomasV <thomasv@gitorious>
Date: Thu, 8 Dec 2011 21:43:52 +0100
update session
Diffstat:
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/client/electrum.py b/client/electrum.py
@@ -473,6 +473,9 @@ class Wallet:
def new_session(self):
self.session_id, self.message = ast.literal_eval( self.request( repr ( ('session', repr(self.addresses) ))))
+ def update_session(self):
+ return self.request( repr ( ('update_session', repr((self.session_id,self.addresses)))))
+
def get_servers(self):
self.servers = map( lambda x:x[1], ast.literal_eval( self.request( repr ( ('peers', '' )))) )
diff --git a/client/gui.py b/client/gui.py
@@ -490,6 +490,7 @@ class BitcoinGUI:
try:
self.wallet.new_session()
self.is_connected = True
+ self.update_session = False
self.info.set_text( self.wallet.message)
except:
self.is_connected = False
@@ -499,6 +500,10 @@ class BitcoinGUI:
get_servers_time = 0
while True:
+ if self.is_connected and self.update_session:
+ self.wallet.update_session()
+ self.update_session = False
+
if time.time() - get_servers_time > 5*60:
wallet.get_servers()
get_servers_time = time.time()
@@ -658,7 +663,7 @@ class BitcoinGUI:
password = password_dialog() if self.wallet.use_encryption else None
status, tx = self.wallet.mktx( to_address, amount, label, password, fee )
- self.wallet.new_session() # we created a new change address
+ self.update_session = True # we created a new change address
if not status:
self.show_message(tx)
return
@@ -1010,7 +1015,7 @@ class BitcoinGUI:
else:
password = password_dialog() if self.wallet.use_encryption else None
success, ret = self.wallet.get_new_address(password)
- self.wallet.new_session() # we created a new address
+ self.update_session = True # we created a new address
if success:
address = ret
#if label: self.wallet.labels[address] = label
@@ -1026,6 +1031,7 @@ class BitcoinGUI:
errorDialog.show()
errorDialog.run()
errorDialog.destroy()
+
def network_dialog( self, w ):
wallet = self.wallet