src/eric7/WebBrowser/WebBrowserWindow.py

branch
eric7
changeset 10246
04f21234f09d
parent 10069
435cc5875135
child 10247
81f8846b62ad
equal deleted inserted replaced
10245:98b54c6e523b 10246:04f21234f09d
22 QTimer, 22 QTimer,
23 QUrl, 23 QUrl,
24 pyqtSignal, 24 pyqtSignal,
25 pyqtSlot, 25 pyqtSlot,
26 ) 26 )
27 from PyQt6.QtGui import QAction, QDesktopServices, QFont, QFontMetrics, QKeySequence 27 from PyQt6.QtGui import (
28 QAction,
29 QDesktopServices,
30 QFont,
31 QFontMetrics,
32 QKeySequence,
33 QPixmap,
34 )
28 from PyQt6.QtWebEngineCore import ( 35 from PyQt6.QtWebEngineCore import (
29 QWebEnginePage, 36 QWebEnginePage,
30 QWebEngineProfile, 37 QWebEngineProfile,
31 QWebEngineScript, 38 QWebEngineScript,
32 QWebEngineSettings, 39 QWebEngineSettings,
5211 timeout = Preferences.getUI("NotificationTimeout") 5218 timeout = Preferences.getUI("NotificationTimeout")
5212 cls._notification.showNotification( 5219 cls._notification.showNotification(
5213 icon, heading, text, kind=kind, timeout=timeout 5220 icon, heading, text, kind=kind, timeout=timeout
5214 ) 5221 )
5215 5222
5223 @classmethod
5224 def __showWebNotification(cls, webNotification):
5225 """
5226 Class method to show a notification sent by Chromium.
5227
5228 @param webNotification notification sent by Chromium
5229 @type QWebEngineNotification
5230 """
5231 cls.showNotification(
5232 QPixmap.fromImage(webNotification.icon()),
5233 webNotification.title(),
5234 webNotification.message(),
5235 kind=NotificationTypes.OTHER,
5236 timeout=0,
5237 )
5238
5216 ###################################### 5239 ######################################
5217 ## Support for global status bar below 5240 ## Support for global status bar below
5218 ###################################### 5241 ######################################
5219 5242
5220 @classmethod 5243 @classmethod
5306 ) 5329 )
5307 cls._webProfile.setSpellCheckLanguages( 5330 cls._webProfile.setSpellCheckLanguages(
5308 Preferences.getWebBrowser("SpellCheckLanguages") 5331 Preferences.getWebBrowser("SpellCheckLanguages")
5309 ) 5332 )
5310 5333
5334 # configure notifications
5335 cls._webProfile.setNotificationPresenter(cls.__showWebNotification)
5336
5311 # Setup QWebChannel user scripts 5337 # Setup QWebChannel user scripts
5312 # WebChannel for SafeJsWorld 5338 # WebChannel for SafeJsWorld
5313 script = QWebEngineScript() 5339 script = QWebEngineScript()
5314 script.setName("_eric_webchannel") 5340 script.setName("_eric_webchannel")
5315 script.setInjectionPoint(QWebEngineScript.InjectionPoint.DocumentCreation) 5341 script.setInjectionPoint(QWebEngineScript.InjectionPoint.DocumentCreation)

eric ide

mercurial