Add tracker icon to Tracker column
This commit is contained in:
parent
08b3ce97b3
commit
2542745c16
|
@ -37,6 +37,7 @@ import deluge.component as component
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
import deluge.ui.gtkui.listview as listview
|
import deluge.ui.gtkui.listview as listview
|
||||||
|
from deluge.ui.tracker_icons import TrackerIcons
|
||||||
|
|
||||||
# Status icons.. Create them from file only once to avoid constantly
|
# Status icons.. Create them from file only once to avoid constantly
|
||||||
# re-creating them.
|
# re-creating them.
|
||||||
|
@ -73,6 +74,17 @@ def cell_data_statusicon(column, cell, model, row, data):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def cell_data_trackericon(column, cell, model, row, data):
|
||||||
|
icon_path = TrackerIcons().get(model[row][data])
|
||||||
|
if icon_path:
|
||||||
|
try:
|
||||||
|
icon = gtk.gdk.pixbuf_new_from_file(icon_path)
|
||||||
|
except Exception, e:
|
||||||
|
pass
|
||||||
|
if cell.get_property("pixbuf") != icon:
|
||||||
|
cell.set_property("pixbuf", icon)
|
||||||
|
|
||||||
|
|
||||||
def cell_data_progress(column, cell, model, row, data):
|
def cell_data_progress(column, cell, model, row, data):
|
||||||
"""Display progress bar with text"""
|
"""Display progress bar with text"""
|
||||||
(value, state_str) = model.get(row, *data)
|
(value, state_str) = model.get(row, *data)
|
||||||
|
@ -176,7 +188,8 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
listview.cell_data_date,
|
listview.cell_data_date,
|
||||||
[float],
|
[float],
|
||||||
status_field=["time_added"])
|
status_field=["time_added"])
|
||||||
self.add_text_column(_("Tracker"), status_field=["tracker_host"])
|
self.add_texticon_column(_("Tracker"), status_field=["tracker_host", "tracker_host"],
|
||||||
|
function=cell_data_trackericon)
|
||||||
|
|
||||||
# Set filter to None for now
|
# Set filter to None for now
|
||||||
self.filter = None
|
self.filter = None
|
||||||
|
|
|
@ -156,7 +156,7 @@ class TrackerIcons(object):
|
||||||
threading.Thread(target=self. _fetch_icon_thread,
|
threading.Thread(target=self. _fetch_icon_thread,
|
||||||
args=(tracker_host, callback)).start()
|
args=(tracker_host, callback)).start()
|
||||||
|
|
||||||
def get(self, tracker_host):
|
def get(self, tracker_host):
|
||||||
"""
|
"""
|
||||||
returns None if the icon is not fetched(yet) or not fond.
|
returns None if the icon is not fetched(yet) or not fond.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue