eric6/WebBrowser/Tools/WebIconLoader.py

changeset 7764
1804cdcedac7
parent 7565
928373562e36
child 7766
0af772bc14c4
equal deleted inserted replaced
7763:32d9af1cea79 7764:1804cdcedac7
8 """ 8 """
9 9
10 10
11 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject 11 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject
12 from PyQt5.QtGui import QIcon, QPixmap, QImage 12 from PyQt5.QtGui import QIcon, QPixmap, QImage
13 from PyQt5.QtNetwork import QNetworkRequest 13 from PyQt5.QtNetwork import QNetworkRequest, QSslConfiguration
14 14
15 import WebBrowser.WebBrowserWindow 15 import WebBrowser.WebBrowserWindow
16 16
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 icon has been loaded 22 @signal iconLoaded(icon) emitted when the icon has been loaded
23 @signal sslConfiguration(config) emitted to pass the SSL data
23 """ 24 """
24 iconLoaded = pyqtSignal(QIcon) 25 iconLoaded = pyqtSignal(QIcon)
26 sslConfiguration = pyqtSignal(QSslConfiguration)
25 27
26 def __init__(self, url, parent=None): 28 def __init__(self, url, parent=None):
27 """ 29 """
28 Constructor 30 Constructor
29 31
49 data = self.__reply.readAll() 51 data = self.__reply.readAll()
50 icon = QIcon(QPixmap.fromImage(QImage.fromData(data))) 52 icon = QIcon(QPixmap.fromImage(QImage.fromData(data)))
51 self.iconLoaded.emit(icon) 53 self.iconLoaded.emit(icon)
52 54
53 # TODO: extract SSL data as a by-product 55 # TODO: extract SSL data as a by-product
56 if self.__reply.url().scheme().lower() == "https":
57 sslConfiguration = self.__reply.sslConfiguration()
58 self.sslConfiguration.emit(sslConfiguration)
54 59
55 self.__reply.deleteLater() 60 self.__reply.deleteLater()
56 self.__reply = None 61 self.__reply = None

eric ide

mercurial