Author: andar
Revision: 5206
Log:
Made TrackerIcons a component to prevent trying to get an icon multiple
times
Fixed showing the wrong tracker icon in the TorrentView when the icon
could not be retrieved from the tracker
Diff:
Modified: trunk/deluge/ui/gtkui/filtertreeview.py
===================================================================
--- trunk/deluge/ui/gtkui/filtertreeview.py 2009-04-28 01:15:12 UTC (rev
5205)
+++ trunk/deluge/ui/gtkui/filtertreeview.py 2009-04-28 02:35:08 UTC (rev
5206)
@@ -30,7 +30,6 @@
import deluge.component as component
import deluge.common
-from deluge.ui.tracker_icons import TrackerIcons
from deluge.log import LOG as log
from deluge.ui.client import client
from deluge.configmanager import ConfigManager
@@ -71,7 +70,7 @@
self.scrolled = glade.get_widget("scrolledwindow_sidebar")
self.sidebar = component.get("SideBar")
self.config = ConfigManager("gtkui.conf")
- self.tracker_icons = TrackerIcons()
+ self.tracker_icons = component.get("TrackerIcons")
self.label_view = gtk.TreeView()
self.sidebar.add_tab(self.label_view, "filters", _("Filters"))
Modified: trunk/deluge/ui/gtkui/gtkui.py
===================================================================
--- trunk/deluge/ui/gtkui/gtkui.py 2009-04-28 01:15:12 UTC (rev 5205)
+++ trunk/deluge/ui/gtkui/gtkui.py 2009-04-28 02:35:08 UTC (rev 5206)
@@ -50,6 +50,7 @@
from connectionmanager import ConnectionManager
from pluginmanager import PluginManager
from ipcinterface import IPCInterface
+from deluge.ui.tracker_icons import TrackerIcons
from queuedtorrents import QueuedTorrents
from addtorrentdialog import AddTorrentDialog
@@ -166,6 +167,7 @@
# We make sure that the UI components start once we get a core URI
client.set_disconnect_callback(self.__on_disconnect)
+ self.trackericons = TrackerIcons()
# Initialize various components of the gtkui
self.mainwindow = MainWindow()
self.menubar = MenuBar()
Modified: trunk/deluge/ui/gtkui/torrentview.py
===================================================================
--- trunk/deluge/ui/gtkui/torrentview.py 2009-04-28 01:15:12 UTC (rev
5205)
+++ trunk/deluge/ui/gtkui/torrentview.py 2009-04-28 02:35:08 UTC (rev
5206)
@@ -75,16 +75,20 @@
pass
def cell_data_trackericon(column, cell, model, row, data):
- icon_path = TrackerIcons().get(model[row][data])
+ icon_path = component.get("TrackerIcons").get(model[row][data])
if icon_path:
try:
icon = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 16, 16)
except Exception, e:
pass
- if cell.get_property("pixbuf") != icon:
- cell.set_property("pixbuf", icon)
+ else:
+ icon = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 16, 16)
+ icon.fill(0x00000000)
+ 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)
Modified: trunk/deluge/ui/tracker_icons.py
===================================================================
--- trunk/deluge/ui/tracker_icons.py 2009-04-28 01:15:12 UTC (rev 5205)
+++ trunk/deluge/ui/tracker_icons.py 2009-04-28 02:35:08 UTC (rev 5206)
@@ -31,6 +31,7 @@
from deluge.common import get_pixmap
import os
import deluge.configmanager
+import deluge.component as component
#some servers don't have their favicon at the expected location
RENAMES = {
@@ -60,8 +61,9 @@
return data
-class TrackerIcons(object):
+class TrackerIcons(component.Component):
def __init__(self):
+ component.Component.__init__(self, "TrackerIcons")
#set image cache dir
self.image_dir = os.path.join(deluge.configmanager.get_config_dir(),
"icons")
if not os.path.exists(self.image_dir):
@@ -140,10 +142,11 @@
f = open(filename,"wb")
f.write(icon_data)
f.close()
- self.images[tracker_host] = filename
else:
filename = None
+ self.images[tracker_host] = filename
+
if callback:
gobject.idle_add(callback, filename)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---