13 |
13 |
14 from PyQt6.QtCore import pyqtSignal, QObject, QByteArray, QBuffer, QIODevice, QUrl |
14 from PyQt6.QtCore import pyqtSignal, QObject, QByteArray, QBuffer, QIODevice, QUrl |
15 from PyQt6.QtGui import QIcon, QPixmap, QImage |
15 from PyQt6.QtGui import QIcon, QPixmap, QImage |
16 from PyQt6.QtWidgets import QDialog |
16 from PyQt6.QtWidgets import QDialog |
17 |
17 |
18 from Utilities.AutoSaver import AutoSaver |
18 from eric7.Utilities.AutoSaver import AutoSaver |
19 |
19 |
20 import UI.PixmapCache |
20 from eric7.EricGui import EricPixmapCache |
21 |
21 |
22 |
22 |
23 class WebIconProvider(QObject): |
23 class WebIconProvider(QObject): |
24 """ |
24 """ |
25 Class implementing a web site icon storage. |
25 Class implementing a web site icon storage. |
108 Public method to save the web site icons. |
108 Public method to save the web site icons. |
109 """ |
109 """ |
110 if not self.__loaded: |
110 if not self.__loaded: |
111 return |
111 return |
112 |
112 |
113 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
113 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
114 |
114 |
115 if not WebBrowserWindow.isPrivate() and bool(self.__iconDatabasePath): |
115 if not WebBrowserWindow.isPrivate() and bool(self.__iconDatabasePath): |
116 db = {} |
116 db = {} |
117 for url, icon in self.__iconsDB.items(): |
117 for url, icon in self.__iconsDB.items(): |
118 ba = QByteArray() |
118 ba = QByteArray() |
180 } |
180 } |
181 |
181 |
182 scheme = url.scheme() |
182 scheme = url.scheme() |
183 iconName = scheme2iconName.get(scheme) |
183 iconName = scheme2iconName.get(scheme) |
184 if iconName: |
184 if iconName: |
185 return UI.PixmapCache.getIcon(iconName) |
185 return EricPixmapCache.getIcon(iconName) |
186 |
186 |
187 self.load() |
187 self.load() |
188 |
188 |
189 urlStr = self.__urlToString(url) |
189 urlStr = self.__urlToString(url) |
190 if urlStr in self.__iconsDB: |
190 if urlStr in self.__iconsDB: |
205 for iconUrlStr in self.__iconsDB: |
205 for iconUrlStr in self.__iconsDB: |
206 if iconUrlStr.startswith(urlStr): |
206 if iconUrlStr.startswith(urlStr): |
207 return self.__iconsDB[iconUrlStr] |
207 return self.__iconsDB[iconUrlStr] |
208 |
208 |
209 if scheme == "https": |
209 if scheme == "https": |
210 return UI.PixmapCache.getIcon("securityHigh32") |
210 return EricPixmapCache.getIcon("securityHigh32") |
211 else: |
211 else: |
212 return UI.PixmapCache.getIcon("defaultIcon") |
212 return EricPixmapCache.getIcon("defaultIcon") |
213 |
213 |
214 def clear(self): |
214 def clear(self): |
215 """ |
215 """ |
216 Public method to clear the icons cache. |
216 Public method to clear the icons cache. |
217 """ |
217 """ |