Fix peers list updating.

This commit is contained in:
Andrew Resch 2008-04-08 12:02:08 +00:00
parent 7cb6876bae
commit 46a1eb26cf
2 changed files with 10 additions and 6 deletions

View File

@ -262,7 +262,7 @@ class Core(
except KeyboardInterrupt: except KeyboardInterrupt:
self._shutdown() self._shutdown()
def _shutdown(self, data=None): def _shutdown(self, *data):
"""This is called by a thread from shutdown()""" """This is called by a thread from shutdown()"""
log.info("Shutting down core..") log.info("Shutting down core..")
component.shutdown() component.shutdown()

View File

@ -241,20 +241,24 @@ class PeersTab:
if self.peers.has_key(peer["ip"]): if self.peers.has_key(peer["ip"]):
# We already have this peer in our list, so lets just update it # We already have this peer in our list, so lets just update it
row = self.peers[peer["ip"]] row = self.peers[peer["ip"]]
if not self.liststore.iter_is_valid(row):
# This iter is invalid, delete it and continue to next iteration
del self.peers[peer["ip"]]
continue
values = self.liststore.get(row, 3, 4, 5, 7) values = self.liststore.get(row, 3, 4, 5, 7)
if peer["down_speed"] != values[0]: if peer["down_speed"] != values[0]:
self.liststore.set_value(row, 3, values[0]) self.liststore.set_value(row, 3, peer["down_speed"])
if peer["up_speed"] != values[1]: if peer["up_speed"] != values[1]:
self.liststore.set_value(row, 4, values[1]) self.liststore.set_value(row, 4, peer["up_speed"])
if peer["country"] != values[2]: if peer["country"] != values[2]:
self.liststore.set_value(row, 5, values[2]) self.liststore.set_value(row, 5, peer["country"])
if peer["seed"]: if peer["seed"]:
icon = self.seed_pixbuf icon = self.seed_pixbuf
else: else:
icon = self.peer_pixbuf icon = self.peer_pixbuf
if icon != values[2]: if icon != values[3]:
self.liststore.set_value(row, 7, values[3]) self.liststore.set_value(row, 7, icon)
else: else:
# Peer is not in list so we need to add it # Peer is not in list so we need to add it