Browse Source

update servers list every 5 minutes

283
thomasv 13 years ago
parent
commit
4843c4dd3a
  1. 12
      client/gui.py

12
client/gui.py

@ -460,16 +460,19 @@ class BitcoinGUI:
try: try:
self.wallet.new_session() self.wallet.new_session()
self.is_connected = True self.is_connected = True
self.info.set_text( self.wallet.message)
except: except:
self.is_connected = False self.is_connected = False
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
time.sleep(self.period) time.sleep(self.period)
continue continue
wallet.get_servers() get_servers_time = 0
self.info.set_text( self.wallet.message)
while True: while True:
if time.time() - get_servers_time > 5*60:
wallet.get_servers()
get_servers_time = time.time()
self.period = 15 if self.wallet.use_http() else 5 self.period = 15 if self.wallet.use_http() else 5
try: try:
u = self.wallet.update() u = self.wallet.update()
@ -953,11 +956,10 @@ class BitcoinGUI:
def network_dialog( self, w ): def network_dialog( self, w ):
wallet = self.wallet wallet = self.wallet
image = gtk.Image() image = gtk.Image()
image.set_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_DIALOG)
if self.is_connected: if self.is_connected:
image.set_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_DIALOG)
status = "Connected to %s.\n%d blocks\nresponse time: %f"%(wallet.host, wallet.blocks, wallet.rtime) status = "Connected to %s.\n%d blocks\nresponse time: %f"%(wallet.host, wallet.blocks, wallet.rtime)
else: else:
image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_DIALOG)
status = "Not connected" status = "Not connected"
dialog = gtk.MessageDialog( self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, dialog = gtk.MessageDialog( self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,

Loading…
Cancel
Save