WebBrowser/WebBrowserWindow.py

changeset 4990
2bca10fcfe80
parent 4979
7ac0959842f9
child 4993
ebb8eaa326ba
equal deleted inserted replaced
4988:fc0c2381b388 4990:2bca10fcfe80
17 import shutil 17 import shutil
18 import sys 18 import sys
19 19
20 from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QByteArray, QSize, QTimer, \ 20 from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QByteArray, QSize, QTimer, \
21 QUrl, QTextCodec, QProcess, QEvent 21 QUrl, QTextCodec, QProcess, QEvent
22 from PyQt5.QtGui import QDesktopServices, QKeySequence, QFont, QFontMetrics 22 from PyQt5.QtGui import QDesktopServices, QKeySequence, QFont, QFontMetrics, \
23 QPalette
23 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \ 24 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \
24 QComboBox, QLabel, QSplitter, QMenu, QToolButton, QLineEdit, \ 25 QComboBox, QLabel, QSplitter, QMenu, QToolButton, QLineEdit, \
25 QApplication, QWhatsThis, QDialog, QHBoxLayout, QProgressBar, QAction, \ 26 QApplication, QWhatsThis, QDialog, QHBoxLayout, QProgressBar, QAction, \
26 QInputDialog 27 QInputDialog
27 from PyQt5.QtWebEngineWidgets import QWebEngineSettings, QWebEnginePage, \ 28 from PyQt5.QtWebEngineWidgets import QWebEngineSettings, QWebEnginePage, \
3985 """ 3986 """
3986 Private method to set a user style sheet. 3987 Private method to set a user style sheet.
3987 3988
3988 @param styleSheetFile name of the user style sheet file (string) 3989 @param styleSheetFile name of the user style sheet file (string)
3989 """ 3990 """
3990 userStyle = \ 3991 name = "_eric_userstylesheet"
3991 self.adBlockManager().elementHidingRules().replace('"', '\\"') 3992 userStyle = ""
3992 3993
3993 userStyle += WebBrowserTools.readAllFileContents(styleSheetFile)\ 3994 userStyle += WebBrowserTools.readAllFileContents(styleSheetFile)\
3994 .replace("\n", "") 3995 .replace("\n", "")
3995 name = "_eric_userstylesheet"
3996 3996
3997 oldScript = self.webProfile().scripts().findScript(name) 3997 oldScript = self.webProfile().scripts().findScript(name)
3998 if not oldScript.isNull(): 3998 if not oldScript.isNull():
3999 self.webProfile().scripts().remove(oldScript) 3999 self.webProfile().scripts().remove(oldScript)
4000 4000

eric ide

mercurial