Minor changes to peer's country flag code.
This commit is contained in:
parent
9571cfd96a
commit
94d1883a3a
|
@ -49,23 +49,22 @@ class PeersTabManager(object):
|
||||||
self.peer_store.clear()
|
self.peer_store.clear()
|
||||||
self.peer_store_dict = {}
|
self.peer_store_dict = {}
|
||||||
|
|
||||||
def get_country_image(self, country):
|
def get_country_flag_image(self, country):
|
||||||
country_image = None
|
flag_image = None
|
||||||
if country.isalpha():
|
if country.isalpha():
|
||||||
if country in self._cached_flags:
|
if country in self._cached_flags:
|
||||||
country_image = self._cached_flags[country]
|
flag_image = self._cached_flags[country]
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
country_image = gtk.gdk.pixbuf_new_from_file(
|
flag_image = gtk.gdk.pixbuf_new_from_file(
|
||||||
common.get_pixmap('flags/%s.png' %
|
common.get_pixmap('flags/%s.png' %
|
||||||
country.lower()))
|
country.lower()))
|
||||||
except gobject.GError:
|
except gobject.GError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self._cached_flags[country] = country_image
|
self._cached_flags[country] = flag_image
|
||||||
|
|
||||||
return country_image
|
return flag_image
|
||||||
|
|
||||||
|
|
||||||
def update(self, unique_id):
|
def update(self, unique_id):
|
||||||
new_peer_info = self.manager.get_torrent_peer_info(unique_id)
|
new_peer_info = self.manager.get_torrent_peer_info(unique_id)
|
||||||
|
@ -77,7 +76,7 @@ class PeersTabManager(object):
|
||||||
iter = self.peer_store_dict[peer['ip']]
|
iter = self.peer_store_dict[peer['ip']]
|
||||||
|
|
||||||
dgtk.update_store(self.peer_store, iter, (1, 4, 5, 6),
|
dgtk.update_store(self.peer_store, iter, (1, 4, 5, 6),
|
||||||
(self.get_country_image(peer["country"]),
|
(self.get_country_flag_image(peer["country"]),
|
||||||
round(peer["peer_has"], 2),
|
round(peer["peer_has"], 2),
|
||||||
peer["download_speed"],
|
peer["download_speed"],
|
||||||
peer["upload_speed"]))
|
peer["upload_speed"]))
|
||||||
|
@ -102,7 +101,7 @@ class PeersTabManager(object):
|
||||||
client = client.decode('latin-1')
|
client = client.decode('latin-1')
|
||||||
|
|
||||||
iter = self.peer_store.append([ip_int,
|
iter = self.peer_store.append([ip_int,
|
||||||
self.get_country_image(peer["country"]),
|
self.get_country_flag_image(peer["country"]),
|
||||||
peer["ip"], client, round(peer["peer_has"], 2),
|
peer["ip"], client, round(peer["peer_has"], 2),
|
||||||
peer["download_speed"], peer["upload_speed"]])
|
peer["download_speed"], peer["upload_speed"]])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue