WebBrowser/WebBrowserPage.py

changeset 6142
304a469455c8
parent 6140
c20e2d414d0d
child 6146
94a4e8d1ac4f
equal deleted inserted replaced
6141:f4cecd941096 6142:304a469455c8
39 39
40 @signal safeBrowsingAbort() emitted to indicate an abort due to a safe 40 @signal safeBrowsingAbort() emitted to indicate an abort due to a safe
41 browsing event 41 browsing event
42 @signal safeBrowsingBad(threatType, threatMessages) emitted to indicate a 42 @signal safeBrowsingBad(threatType, threatMessages) emitted to indicate a
43 malicious web site as determined by safe browsing 43 malicious web site as determined by safe browsing
44 @signal printRequested() emitted to indicate a print request of the shown
45 web page
44 """ 46 """
45 if qVersionTuple() >= (5, 7, 0): 47 if qVersionTuple() >= (5, 7, 0):
46 SafeJsWorld = QWebEngineScript.ApplicationWorld 48 SafeJsWorld = QWebEngineScript.ApplicationWorld
47 # SafeJsWorld = QWebEngineScript.MainWorld 49 # SafeJsWorld = QWebEngineScript.MainWorld
48 else: 50 else:
49 SafeJsWorld = QWebEngineScript.MainWorld 51 SafeJsWorld = QWebEngineScript.MainWorld
50 UnsafeJsWorld = QWebEngineScript.MainWorld 52 UnsafeJsWorld = QWebEngineScript.MainWorld
51 53
52 safeBrowsingAbort = pyqtSignal() 54 safeBrowsingAbort = pyqtSignal()
53 safeBrowsingBad = pyqtSignal(str, str) 55 safeBrowsingBad = pyqtSignal(str, str)
56
57 printRequested = pyqtSignal()
54 58
55 def __init__(self, parent=None): 59 def __init__(self, parent=None):
56 """ 60 """
57 Constructor 61 Constructor
58 62
136 # GreaseMonkey 140 # GreaseMonkey
137 if type_ == QWebEnginePage.NavigationTypeLinkClicked and \ 141 if type_ == QWebEnginePage.NavigationTypeLinkClicked and \
138 url.toString().endswith(".user.js"): 142 url.toString().endswith(".user.js"):
139 WebBrowserWindow.greaseMonkeyManager().downloadScript(url) 143 WebBrowserWindow.greaseMonkeyManager().downloadScript(url)
140 return False 144 return False
145
146 if url.scheme() == "eric":
147 if url.path() == "PrintPage":
148 self.printRequested.emit()
149 return False
141 150
142 # Safe Browsing 151 # Safe Browsing
143 self.__badSite = False 152 self.__badSite = False
144 from WebBrowser.SafeBrowsing.SafeBrowsingManager import \ 153 from WebBrowser.SafeBrowsing.SafeBrowsingManager import \
145 SafeBrowsingManager 154 SafeBrowsingManager

eric ide

mercurial