5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.WebBrowser.Tools.WebBrowserTools</h1> |
9 <h1>eric7.WebBrowser.Tools.WebBrowserTools</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing tool functions for the web browser. |
11 Module implementing tool functions for the web browser. |
13 </p> |
12 </p> |
|
13 |
14 <h3>Global Attributes</h3> |
14 <h3>Global Attributes</h3> |
15 |
|
16 <table> |
15 <table> |
17 <tr><td>WebBrowserDataDirectory</td></tr> |
16 <tr><td>WebBrowserDataDirectory</td></tr> |
18 </table> |
17 </table> |
|
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 |
|
21 <table> |
20 <table> |
22 <tr><td>None</td></tr> |
21 <tr><td>None</td></tr> |
23 </table> |
22 </table> |
|
23 |
24 <h3>Functions</h3> |
24 <h3>Functions</h3> |
25 |
|
26 <table> |
25 <table> |
27 |
|
28 <tr> |
26 <tr> |
29 <td><a href="#containsSpace">containsSpace</a></td> |
27 <td><a href="#containsSpace">containsSpace</a></td> |
30 <td>Function to check, if a string contains whitespace characters.</td> |
28 <td>Function to check, if a string contains whitespace characters.</td> |
31 </tr> |
29 </tr> |
32 <tr> |
30 <tr> |
76 <tr> |
74 <tr> |
77 <td><a href="#readAllFileContents">readAllFileContents</a></td> |
75 <td><a href="#readAllFileContents">readAllFileContents</a></td> |
78 <td>Function to read the string contents of the given file.</td> |
76 <td>Function to read the string contents of the given file.</td> |
79 </tr> |
77 </tr> |
80 </table> |
78 </table> |
|
79 |
81 <hr /> |
80 <hr /> |
82 <hr /> |
81 <hr /> |
83 <a NAME="containsSpace" ID="containsSpace"></a> |
82 <a NAME="containsSpace" ID="containsSpace"></a> |
84 <h2>containsSpace</h2> |
83 <h2>containsSpace</h2> |
85 <b>containsSpace</b>(<i>string</i>) |
84 <b>containsSpace</b>(<i>string</i>) |
86 |
|
87 <p> |
85 <p> |
88 Function to check, if a string contains whitespace characters. |
86 Function to check, if a string contains whitespace characters. |
89 </p> |
87 </p> |
|
88 |
90 <dl> |
89 <dl> |
91 |
90 |
92 <dt><i>string</i> (str)</dt> |
91 <dt><i>string</i> (str)</dt> |
93 <dd> |
92 <dd> |
94 string to be checked |
93 string to be checked |
110 <hr /> |
109 <hr /> |
111 <hr /> |
110 <hr /> |
112 <a NAME="ensureUniqueFilename" ID="ensureUniqueFilename"></a> |
111 <a NAME="ensureUniqueFilename" ID="ensureUniqueFilename"></a> |
113 <h2>ensureUniqueFilename</h2> |
112 <h2>ensureUniqueFilename</h2> |
114 <b>ensureUniqueFilename</b>(<i>name, appendFormat="({0})"</i>) |
113 <b>ensureUniqueFilename</b>(<i>name, appendFormat="({0})"</i>) |
115 |
|
116 <p> |
114 <p> |
117 Module function to generate an unique file name based on a pattern. |
115 Module function to generate an unique file name based on a pattern. |
118 </p> |
116 </p> |
|
117 |
119 <dl> |
118 <dl> |
120 |
119 |
121 <dt><i>name</i> (str)</dt> |
120 <dt><i>name</i> (str)</dt> |
122 <dd> |
121 <dd> |
123 desired file name |
122 desired file name |
143 <hr /> |
142 <hr /> |
144 <hr /> |
143 <hr /> |
145 <a NAME="filterCharsFromFilename" ID="filterCharsFromFilename"></a> |
144 <a NAME="filterCharsFromFilename" ID="filterCharsFromFilename"></a> |
146 <h2>filterCharsFromFilename</h2> |
145 <h2>filterCharsFromFilename</h2> |
147 <b>filterCharsFromFilename</b>(<i>name</i>) |
146 <b>filterCharsFromFilename</b>(<i>name</i>) |
148 |
|
149 <p> |
147 <p> |
150 Module function to filter illegal characters. |
148 Module function to filter illegal characters. |
151 </p> |
149 </p> |
|
150 |
152 <dl> |
151 <dl> |
153 |
152 |
154 <dt><i>name</i> (str)</dt> |
153 <dt><i>name</i> (str)</dt> |
155 <dd> |
154 <dd> |
156 name to be sanitized |
155 name to be sanitized |
172 <hr /> |
171 <hr /> |
173 <hr /> |
172 <hr /> |
174 <a NAME="getFileNameFromUrl" ID="getFileNameFromUrl"></a> |
173 <a NAME="getFileNameFromUrl" ID="getFileNameFromUrl"></a> |
175 <h2>getFileNameFromUrl</h2> |
174 <h2>getFileNameFromUrl</h2> |
176 <b>getFileNameFromUrl</b>(<i>url</i>) |
175 <b>getFileNameFromUrl</b>(<i>url</i>) |
177 |
|
178 <p> |
176 <p> |
179 Module function to generate a file name based on the given URL. |
177 Module function to generate a file name based on the given URL. |
180 </p> |
178 </p> |
|
179 |
181 <dl> |
180 <dl> |
182 |
181 |
183 <dt><i>url</i> (QUrl)</dt> |
182 <dt><i>url</i> (QUrl)</dt> |
184 <dd> |
183 <dd> |
185 URL |
184 URL |
201 <hr /> |
200 <hr /> |
202 <hr /> |
201 <hr /> |
203 <a NAME="getHtmlPage" ID="getHtmlPage"></a> |
202 <a NAME="getHtmlPage" ID="getHtmlPage"></a> |
204 <h2>getHtmlPage</h2> |
203 <h2>getHtmlPage</h2> |
205 <b>getHtmlPage</b>(<i>pageFileName</i>) |
204 <b>getHtmlPage</b>(<i>pageFileName</i>) |
206 |
|
207 <p> |
205 <p> |
208 Module function to load a HTML page. |
206 Module function to load a HTML page. |
209 </p> |
207 </p> |
210 <p> |
208 <p> |
211 Note: If the given HTML file path is not absolute, it is assumed to |
209 Note: If the given HTML file path is not absolute, it is assumed to |
212 denote a HTML file in the html data directory. |
210 denote a HTML file in the html data directory. |
213 </p> |
211 </p> |
|
212 |
214 <dl> |
213 <dl> |
215 |
214 |
216 <dt><i>pageFileName</i> (str)</dt> |
215 <dt><i>pageFileName</i> (str)</dt> |
217 <dd> |
216 <dd> |
218 file name of the HTML file |
217 file name of the HTML file |
234 <hr /> |
233 <hr /> |
235 <hr /> |
234 <hr /> |
236 <a NAME="getJavascript" ID="getJavascript"></a> |
235 <a NAME="getJavascript" ID="getJavascript"></a> |
237 <h2>getJavascript</h2> |
236 <h2>getJavascript</h2> |
238 <b>getJavascript</b>(<i>jsFileName</i>) |
237 <b>getJavascript</b>(<i>jsFileName</i>) |
239 |
|
240 <p> |
238 <p> |
241 Module function to load a JavaScript source file. |
239 Module function to load a JavaScript source file. |
242 </p> |
240 </p> |
243 <p> |
241 <p> |
244 Note: If the given JavaScript source file path is not absolute, it is |
242 Note: If the given JavaScript source file path is not absolute, it is |
245 assumed to denote a JavaScript source file in the javascript data |
243 assumed to denote a JavaScript source file in the javascript data |
246 directory. |
244 directory. |
247 </p> |
245 </p> |
|
246 |
248 <dl> |
247 <dl> |
249 |
248 |
250 <dt><i>jsFileName</i> (str)</dt> |
249 <dt><i>jsFileName</i> (str)</dt> |
251 <dd> |
250 <dd> |
252 file name of the JavaScript source file |
251 file name of the JavaScript source file |
268 <hr /> |
267 <hr /> |
269 <hr /> |
268 <hr /> |
270 <a NAME="getJquery" ID="getJquery"></a> |
269 <a NAME="getJquery" ID="getJquery"></a> |
271 <h2>getJquery</h2> |
270 <h2>getJquery</h2> |
272 <b>getJquery</b>(<i>jqName</i>) |
271 <b>getJquery</b>(<i>jqName</i>) |
273 |
|
274 <p> |
272 <p> |
275 Module function to load a JQuery source file. |
273 Module function to load a JQuery source file. |
276 </p> |
274 </p> |
277 <p> |
275 <p> |
278 Note: If the JQuery file is not found in the javascript data directory and |
276 Note: If the JQuery file is not found in the javascript data directory and |
279 the platform is Linux, it is assumed that it is installed system wide in the |
277 the platform is Linux, it is assumed that it is installed system wide in the |
280 '/usr/share/javascript' directory (e.g. as packaged by Debian). |
278 '/usr/share/javascript' directory (e.g. as packaged by Debian). |
281 </p> |
279 </p> |
|
280 |
282 <dl> |
281 <dl> |
283 |
282 |
284 <dt><i>jqName</i> (str)</dt> |
283 <dt><i>jqName</i> (str)</dt> |
285 <dd> |
284 <dd> |
286 name of the JQuery library to be loaded (one of 'jquery' or |
285 name of the JQuery library to be loaded (one of 'jquery' or |
303 <hr /> |
302 <hr /> |
304 <hr /> |
303 <hr /> |
305 <a NAME="getWebEngineVersions" ID="getWebEngineVersions"></a> |
304 <a NAME="getWebEngineVersions" ID="getWebEngineVersions"></a> |
306 <h2>getWebEngineVersions</h2> |
305 <h2>getWebEngineVersions</h2> |
307 <b>getWebEngineVersions</b>(<i></i>) |
306 <b>getWebEngineVersions</b>(<i></i>) |
308 |
|
309 <p> |
307 <p> |
310 Module function to extract the web engine related versions from the default |
308 Module function to extract the web engine related versions from the default |
311 user agent string. |
309 user agent string. |
312 </p> |
310 </p> |
313 <p> |
311 <p> |
314 Note: For PyQt 6.3.1 or newer the data is extracted via some Qt functions. |
312 Note: For PyQt 6.3.1 or newer the data is extracted via some Qt functions. |
315 </p> |
313 </p> |
|
314 |
316 <dl> |
315 <dl> |
317 <dt>Return:</dt> |
316 <dt>Return:</dt> |
318 <dd> |
317 <dd> |
319 tuple containing the Chromium version, the Chromium security patch |
318 tuple containing the Chromium version, the Chromium security patch |
320 version and the QtWebEngine version |
319 version and the QtWebEngine version |
330 <hr /> |
329 <hr /> |
331 <hr /> |
330 <hr /> |
332 <a NAME="pixmapFileToDataUrl" ID="pixmapFileToDataUrl"></a> |
331 <a NAME="pixmapFileToDataUrl" ID="pixmapFileToDataUrl"></a> |
333 <h2>pixmapFileToDataUrl</h2> |
332 <h2>pixmapFileToDataUrl</h2> |
334 <b>pixmapFileToDataUrl</b>(<i>pixmapFile, asString=False</i>) |
333 <b>pixmapFileToDataUrl</b>(<i>pixmapFile, asString=False</i>) |
335 |
|
336 <p> |
334 <p> |
337 Module function to load a pixmap file and convert the pixmap to a |
335 Module function to load a pixmap file and convert the pixmap to a |
338 data: URL. |
336 data: URL. |
339 </p> |
337 </p> |
340 <p> |
338 <p> |
341 Note: If the given pixmap file path is not absolute, it is assumed to |
339 Note: If the given pixmap file path is not absolute, it is assumed to |
342 denote a pixmap file in the icons data directory. |
340 denote a pixmap file in the icons data directory. |
343 </p> |
341 </p> |
|
342 |
344 <dl> |
343 <dl> |
345 |
344 |
346 <dt><i>pixmapFile</i> (str)</dt> |
345 <dt><i>pixmapFile</i> (str)</dt> |
347 <dd> |
346 <dd> |
348 file name of the pixmap file |
347 file name of the pixmap file |
368 <hr /> |
367 <hr /> |
369 <hr /> |
368 <hr /> |
370 <a NAME="pixmapFromByteArray" ID="pixmapFromByteArray"></a> |
369 <a NAME="pixmapFromByteArray" ID="pixmapFromByteArray"></a> |
371 <h2>pixmapFromByteArray</h2> |
370 <h2>pixmapFromByteArray</h2> |
372 <b>pixmapFromByteArray</b>(<i>data</i>) |
371 <b>pixmapFromByteArray</b>(<i>data</i>) |
373 |
|
374 <p> |
372 <p> |
375 Module function to convert a byte array to a pixmap. |
373 Module function to convert a byte array to a pixmap. |
376 </p> |
374 </p> |
|
375 |
377 <dl> |
376 <dl> |
378 |
377 |
379 <dt><i>data</i> (bytes or QByteArray)</dt> |
378 <dt><i>data</i> (bytes or QByteArray)</dt> |
380 <dd> |
379 <dd> |
381 data for the pixmap |
380 data for the pixmap |
397 <hr /> |
396 <hr /> |
398 <hr /> |
397 <hr /> |
399 <a NAME="pixmapToByteArray" ID="pixmapToByteArray"></a> |
398 <a NAME="pixmapToByteArray" ID="pixmapToByteArray"></a> |
400 <h2>pixmapToByteArray</h2> |
399 <h2>pixmapToByteArray</h2> |
401 <b>pixmapToByteArray</b>(<i>pixmap</i>) |
400 <b>pixmapToByteArray</b>(<i>pixmap</i>) |
402 |
|
403 <p> |
401 <p> |
404 Module function to convert a pixmap to a byte array containing the pixmap |
402 Module function to convert a pixmap to a byte array containing the pixmap |
405 as a PNG encoded as base64. |
403 as a PNG encoded as base64. |
406 </p> |
404 </p> |
|
405 |
407 <dl> |
406 <dl> |
408 |
407 |
409 <dt><i>pixmap</i> (QPixmap)</dt> |
408 <dt><i>pixmap</i> (QPixmap)</dt> |
410 <dd> |
409 <dd> |
411 pixmap to be converted |
410 pixmap to be converted |
427 <hr /> |
426 <hr /> |
428 <hr /> |
427 <hr /> |
429 <a NAME="pixmapToDataUrl" ID="pixmapToDataUrl"></a> |
428 <a NAME="pixmapToDataUrl" ID="pixmapToDataUrl"></a> |
430 <h2>pixmapToDataUrl</h2> |
429 <h2>pixmapToDataUrl</h2> |
431 <b>pixmapToDataUrl</b>(<i>pixmap, mimetype="image/png"</i>) |
430 <b>pixmapToDataUrl</b>(<i>pixmap, mimetype="image/png"</i>) |
432 |
|
433 <p> |
431 <p> |
434 Module function to convert a pixmap to a data: URL. |
432 Module function to convert a pixmap to a data: URL. |
435 </p> |
433 </p> |
|
434 |
436 <dl> |
435 <dl> |
437 |
436 |
438 <dt><i>pixmap</i> (QPixmap)</dt> |
437 <dt><i>pixmap</i> (QPixmap)</dt> |
439 <dd> |
438 <dd> |
440 pixmap to be converted |
439 pixmap to be converted |
460 <hr /> |
459 <hr /> |
461 <hr /> |
460 <hr /> |
462 <a NAME="readAllFileContents" ID="readAllFileContents"></a> |
461 <a NAME="readAllFileContents" ID="readAllFileContents"></a> |
463 <h2>readAllFileContents</h2> |
462 <h2>readAllFileContents</h2> |
464 <b>readAllFileContents</b>(<i>filename</i>) |
463 <b>readAllFileContents</b>(<i>filename</i>) |
465 |
|
466 <p> |
464 <p> |
467 Function to read the string contents of the given file. |
465 Function to read the string contents of the given file. |
468 </p> |
466 </p> |
|
467 |
469 <dl> |
468 <dl> |
470 |
469 |
471 <dt><i>filename</i> (str)</dt> |
470 <dt><i>filename</i> (str)</dt> |
472 <dd> |
471 <dd> |
473 name of the file |
472 name of the file |