eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py

changeset 7959
44e15eda6506
parent 7955
567f2ec958c3
child 8218
7c09585bd960
equal deleted inserted replaced
7958:a70ebfad3d0e 7959:44e15eda6506
23 23
24 import Preferences 24 import Preferences
25 import Utilities 25 import Utilities
26 26
27 import UI.PixmapCache 27 import UI.PixmapCache
28 from UI.NotificationWidget import NotificationTypes
28 29
29 from .SafeBrowsingAPIClient import SafeBrowsingAPIClient 30 from .SafeBrowsingAPIClient import SafeBrowsingAPIClient
30 from .SafeBrowsingCache import SafeBrowsingCache 31 from .SafeBrowsingCache import SafeBrowsingCache
31 from .SafeBrowsingThreatList import ThreatList, HashPrefixList 32 from .SafeBrowsingThreatList import ThreatList, HashPrefixList
32 from .SafeBrowsingUrl import SafeBrowsingUrl 33 from .SafeBrowsingUrl import SafeBrowsingUrl
155 (0 = indefinitely) 156 (0 = indefinitely)
156 @type int 157 @type int
157 """ 158 """
158 from WebBrowser.WebBrowserWindow import WebBrowserWindow 159 from WebBrowser.WebBrowserWindow import WebBrowserWindow
159 160
161 if timeout == 0:
162 kind = NotificationTypes.Critical
163 else:
164 kind = NotificationTypes.Information
165
160 WebBrowserWindow.showNotification( 166 WebBrowserWindow.showNotification(
161 UI.PixmapCache.getPixmap("safeBrowsing48"), 167 UI.PixmapCache.getPixmap("safeBrowsing48"),
162 self.tr("Google Safe Browsing"), 168 self.tr("Google Safe Browsing"),
163 message, 169 message,
170 kind=kind,
164 timeout=timeout, 171 timeout=timeout,
165 ) 172 )
166 173
167 def __setAutoUpdateThreatLists(self): 174 def __setAutoUpdateThreatLists(self):
168 """ 175 """
202 self.__showNotificationMessage( 209 self.__showNotificationMessage(
203 self.tr("Updating threat lists..."), 0) 210 self.tr("Updating threat lists..."), 0)
204 ok = self.updateHashPrefixCache()[0] 211 ok = self.updateHashPrefixCache()[0]
205 if ok: 212 if ok:
206 self.__showNotificationMessage( 213 self.__showNotificationMessage(
207 self.tr("Updating threat lists done")) 214 self.tr("Updating threat lists done."))
208 else: 215 else:
209 self.__showNotificationMessage( 216 self.__showNotificationMessage(
210 self.tr("Updating threat lists failed")) 217 self.tr("Updating threat lists failed."),
218 timeout=0)
211 219
212 if ok: 220 if ok:
213 nextUpdateDateTime = ( 221 nextUpdateDateTime = (
214 self.__apiClient.getFairUseDelayExpirationDateTime() 222 self.__apiClient.getFairUseDelayExpirationDateTime()
215 ) 223 )

eric ide

mercurial