17 |
17 |
18 class WebIconLoader(QObject): |
18 class WebIconLoader(QObject): |
19 """ |
19 """ |
20 Class implementing a loader for web site icons. |
20 Class implementing a loader for web site icons. |
21 |
21 |
22 @signal iconLoaded(icon) emitted when the con has been loaded |
22 @signal iconLoaded(icon) emitted when the icon has been loaded |
23 """ |
23 """ |
24 iconLoaded = pyqtSignal(QIcon) |
24 iconLoaded = pyqtSignal(QIcon) |
25 |
25 |
26 def __init__(self, url, parent=None): |
26 def __init__(self, url, parent=None): |
27 """ |
27 """ |
48 # ignore any errors and emit an empty icon in this case |
48 # ignore any errors and emit an empty icon in this case |
49 data = self.__reply.readAll() |
49 data = self.__reply.readAll() |
50 icon = QIcon(QPixmap.fromImage(QImage.fromData(data))) |
50 icon = QIcon(QPixmap.fromImage(QImage.fromData(data))) |
51 self.iconLoaded.emit(icon) |
51 self.iconLoaded.emit(icon) |
52 |
52 |
|
53 # TODO: extract SSL data as a by-product |
|
54 |
53 self.__reply.deleteLater() |
55 self.__reply.deleteLater() |
54 self.__reply = None |
56 self.__reply = None |