Changeset 7b72d7


Ignore:
Timestamp:
04/28/2009 02:35:08 AM (16 years ago)
Author:
Andrew Resch <andrewresch@gmail.com>
Branches:
2.0.x, develop, extjs4-port, master
Children:
78b5c0
Parents:
925dcd
Message:

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

Location:
deluge/ui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • deluge/ui/gtkui/filtertreeview.py

    r925dcd r7b72d7  
    3131import deluge.component as component
    3232import deluge.common
    33 from deluge.ui.tracker_icons import TrackerIcons
    3433from deluge.log import LOG as log
    3534from deluge.ui.client import client
     
    7271        self.sidebar = component.get("SideBar")
    7372        self.config = ConfigManager("gtkui.conf")
    74         self.tracker_icons = TrackerIcons()
     73        self.tracker_icons = component.get("TrackerIcons")
    7574
    7675        self.label_view = gtk.TreeView()
  • deluge/ui/gtkui/gtkui.py

    r925dcd r7b72d7  
    5151from pluginmanager import PluginManager
    5252from ipcinterface import IPCInterface
     53from deluge.ui.tracker_icons import TrackerIcons
    5354
    5455from queuedtorrents import QueuedTorrents
     
    167168        client.set_disconnect_callback(self.__on_disconnect)
    168169
     170        self.trackericons = TrackerIcons()
    169171        # Initialize various components of the gtkui
    170172        self.mainwindow = MainWindow()
  • deluge/ui/gtkui/torrentview.py

    r925dcd r7b72d7  
    7676
    7777def cell_data_trackericon(column, cell, model, row, data):
    78     icon_path = TrackerIcons().get(model[row][data])
     78    icon_path = component.get("TrackerIcons").get(model[row][data])
    7979    if icon_path:
    8080        try:
     
    8282        except Exception, e:
    8383            pass
    84         if cell.get_property("pixbuf") != icon:
    85             cell.set_property("pixbuf", icon)
     84    else:
     85        icon = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 16, 16)
     86        icon.fill(0x00000000)
     87
     88    if cell.get_property("pixbuf") != icon:
     89        cell.set_property("pixbuf", icon)
    8690
    8791
  • deluge/ui/tracker_icons.py

    r925dcd r7b72d7  
    3232import os
    3333import deluge.configmanager
     34import deluge.component as component
    3435
    3536#some servers don't have their favicon at the expected location
     
    6162    return data
    6263
    63 class TrackerIcons(object):
     64class TrackerIcons(component.Component):
    6465    def __init__(self):
     66        component.Component.__init__(self, "TrackerIcons")
    6567        #set image cache dir
    6668        self.image_dir = os.path.join(deluge.configmanager.get_config_dir(), "icons")
     
    141143            f.write(icon_data)
    142144            f.close()
    143             self.images[tracker_host] = filename
    144145        else:
    145146            filename = None
     147
     148        self.images[tracker_host] = filename
    146149
    147150        if callback:
Note: See TracChangeset for help on using the changeset viewer.