WebBrowser/WebBrowserPage.py

changeset 4965
a9a4b632fe48
parent 4964
a894e8c92369
child 4978
27fba2b81749
equal deleted inserted replaced
4964:a894e8c92369 4965:a9a4b632fe48
89 Private slot to handle changes of the URL. 89 Private slot to handle changes of the URL.
90 90
91 @param url new URL 91 @param url new URL
92 @type QUrl 92 @type QUrl
93 """ 93 """
94 if not url.isEmpty() and url.scheme() == "eric": 94 if not url.isEmpty() and url.scheme() == "eric" and \
95 not self.isJavaScriptEnabled():
95 self.setJavaScriptEnabled(True) 96 self.setJavaScriptEnabled(True)
97 self.triggerAction(QWebEnginePage.Reload)
96 98
97 @classmethod 99 @classmethod
98 def userAgent(cls, resolveEmpty=False): 100 def userAgent(cls, resolveEmpty=False):
99 """ 101 """
100 Class method to get the global user agent setting. 102 Class method to get the global user agent setting.
180 enable = True 182 enable = True
181 183
182 self.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, 184 self.settings().setAttribute(QWebEngineSettings.JavascriptEnabled,
183 enable); 185 enable);
184 186
187 def isJavaScriptEnabled(self):
188 """
189 Public method to test, if JavaScript is enabled.
190
191 @return flag indicating the state of the JavaScript support
192 @rtype bool
193 """
194 return self.settings().testAttribute(
195 QWebEngineSettings.JavascriptEnabled)
196
185 def scroll(self, x, y): 197 def scroll(self, x, y):
186 """ 198 """
187 Public method to scroll by the given amount of pixels. 199 Public method to scroll by the given amount of pixels.
188 200
189 @param x horizontal scroll value 201 @param x horizontal scroll value

eric ide

mercurial