Author: andar

Revision: 5082

Log:
        Add tracker icon to Tracker column

Diff:
Modified: trunk/deluge/ui/gtkui/torrentview.py
===================================================================
--- trunk/deluge/ui/gtkui/torrentview.py        2009-04-18 16:30:14 UTC (rev 
5081)
+++ trunk/deluge/ui/gtkui/torrentview.py        2009-04-18 17:46:14 UTC (rev 
5082)
@@ -37,6 +37,7 @@
 from deluge.ui.client import client
 from deluge.log import LOG as log
 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
 # re-creating them.
@@ -73,6 +74,17 @@
     except KeyError:
         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):
     """Display progress bar with text"""
     (value, state_str) = model.get(row, *data)
@@ -176,7 +188,8 @@
                                             listview.cell_data_date,
                                             [float],
                                             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
         self.filter = None

Modified: trunk/deluge/ui/tracker_icons.py
===================================================================
--- trunk/deluge/ui/tracker_icons.py    2009-04-18 16:30:14 UTC (rev 5081)
+++ trunk/deluge/ui/tracker_icons.py    2009-04-18 17:46:14 UTC (rev 5082)
@@ -156,7 +156,7 @@
             threading.Thread(target=self. _fetch_icon_thread,
                 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.
         """



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to