|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.WebBrowser.Tools.WebBrowserTools</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.WebBrowser.Tools.WebBrowserTools</h1> |
|
23 <p> |
|
24 Module implementing tool functions for the web browser. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr><td>None</td></tr> |
|
33 </table> |
|
34 <h3>Functions</h3> |
|
35 <table> |
|
36 <tr> |
|
37 <td><a href="#containsSpace">containsSpace</a></td> |
|
38 <td>Function to check, if a string contains whitespace characters.</td> |
|
39 </tr><tr> |
|
40 <td><a href="#ensureUniqueFilename">ensureUniqueFilename</a></td> |
|
41 <td>Module function to generate an unique file name based on a pattern.</td> |
|
42 </tr><tr> |
|
43 <td><a href="#filterCharsFromFilename">filterCharsFromFilename</a></td> |
|
44 <td>Module function to filter illegal characters.</td> |
|
45 </tr><tr> |
|
46 <td><a href="#getFileNameFromUrl">getFileNameFromUrl</a></td> |
|
47 <td>Module function to generate a file name based on the given URL.</td> |
|
48 </tr><tr> |
|
49 <td><a href="#getWebEngineVersions">getWebEngineVersions</a></td> |
|
50 <td>Module function to extract the web engine version from the default user agent string.</td> |
|
51 </tr><tr> |
|
52 <td><a href="#pixmapFromByteArray">pixmapFromByteArray</a></td> |
|
53 <td>Module function to convert a byte array to a pixmap.</td> |
|
54 </tr><tr> |
|
55 <td><a href="#pixmapToByteArray">pixmapToByteArray</a></td> |
|
56 <td>Module function to convert a pixmap to a byte array containing the pixmap as a PNG encoded as base64.</td> |
|
57 </tr><tr> |
|
58 <td><a href="#pixmapToDataUrl">pixmapToDataUrl</a></td> |
|
59 <td>Module function to convert a pixmap to a data: URL.</td> |
|
60 </tr><tr> |
|
61 <td><a href="#readAllFileByteContents">readAllFileByteContents</a></td> |
|
62 <td>Function to read the bytes contents of the given file.</td> |
|
63 </tr><tr> |
|
64 <td><a href="#readAllFileContents">readAllFileContents</a></td> |
|
65 <td>Function to read the string contents of the given file.</td> |
|
66 </tr> |
|
67 </table> |
|
68 <hr /><hr /> |
|
69 <a NAME="containsSpace" ID="containsSpace"></a> |
|
70 <h2>containsSpace</h2> |
|
71 <b>containsSpace</b>(<i>string</i>) |
|
72 <p> |
|
73 Function to check, if a string contains whitespace characters. |
|
74 </p><dl> |
|
75 <dt><i>string</i> (str)</dt> |
|
76 <dd> |
|
77 string to be checked |
|
78 </dd> |
|
79 </dl><dl> |
|
80 <dt>Returns:</dt> |
|
81 <dd> |
|
82 flag indicating the presence of at least one whitespace character |
|
83 </dd> |
|
84 </dl><dl> |
|
85 <dt>Return Type:</dt> |
|
86 <dd> |
|
87 bool |
|
88 </dd> |
|
89 </dl> |
|
90 <div align="right"><a href="#top">Up</a></div> |
|
91 <hr /><hr /> |
|
92 <a NAME="ensureUniqueFilename" ID="ensureUniqueFilename"></a> |
|
93 <h2>ensureUniqueFilename</h2> |
|
94 <b>ensureUniqueFilename</b>(<i>name, appendFormat="({0})"</i>) |
|
95 <p> |
|
96 Module function to generate an unique file name based on a pattern. |
|
97 </p><dl> |
|
98 <dt><i>name</i></dt> |
|
99 <dd> |
|
100 desired file name (string) |
|
101 </dd><dt><i>appendFormat</i></dt> |
|
102 <dd> |
|
103 format pattern to be used to make the unique name |
|
104 (string) |
|
105 </dd> |
|
106 </dl><dl> |
|
107 <dt>Returns:</dt> |
|
108 <dd> |
|
109 unique file name |
|
110 </dd> |
|
111 </dl> |
|
112 <div align="right"><a href="#top">Up</a></div> |
|
113 <hr /><hr /> |
|
114 <a NAME="filterCharsFromFilename" ID="filterCharsFromFilename"></a> |
|
115 <h2>filterCharsFromFilename</h2> |
|
116 <b>filterCharsFromFilename</b>(<i>name</i>) |
|
117 <p> |
|
118 Module function to filter illegal characters. |
|
119 </p><dl> |
|
120 <dt><i>name</i></dt> |
|
121 <dd> |
|
122 name to be sanitized (string) |
|
123 </dd> |
|
124 </dl><dl> |
|
125 <dt>Returns:</dt> |
|
126 <dd> |
|
127 sanitized name (string) |
|
128 </dd> |
|
129 </dl> |
|
130 <div align="right"><a href="#top">Up</a></div> |
|
131 <hr /><hr /> |
|
132 <a NAME="getFileNameFromUrl" ID="getFileNameFromUrl"></a> |
|
133 <h2>getFileNameFromUrl</h2> |
|
134 <b>getFileNameFromUrl</b>(<i>url</i>) |
|
135 <p> |
|
136 Module function to generate a file name based on the given URL. |
|
137 </p><dl> |
|
138 <dt><i>url</i></dt> |
|
139 <dd> |
|
140 URL (QUrl) |
|
141 </dd> |
|
142 </dl><dl> |
|
143 <dt>Returns:</dt> |
|
144 <dd> |
|
145 file name (string) |
|
146 </dd> |
|
147 </dl> |
|
148 <div align="right"><a href="#top">Up</a></div> |
|
149 <hr /><hr /> |
|
150 <a NAME="getWebEngineVersions" ID="getWebEngineVersions"></a> |
|
151 <h2>getWebEngineVersions</h2> |
|
152 <b>getWebEngineVersions</b>(<i></i>) |
|
153 <p> |
|
154 Module function to extract the web engine version from the default user |
|
155 agent string. |
|
156 </p><dl> |
|
157 <dt>Returns:</dt> |
|
158 <dd> |
|
159 tuple containing the Chrome version and the QtWebEngine version |
|
160 </dd> |
|
161 </dl><dl> |
|
162 <dt>Return Type:</dt> |
|
163 <dd> |
|
164 tuple of str |
|
165 </dd> |
|
166 </dl> |
|
167 <div align="right"><a href="#top">Up</a></div> |
|
168 <hr /><hr /> |
|
169 <a NAME="pixmapFromByteArray" ID="pixmapFromByteArray"></a> |
|
170 <h2>pixmapFromByteArray</h2> |
|
171 <b>pixmapFromByteArray</b>(<i>data</i>) |
|
172 <p> |
|
173 Module function to convert a byte array to a pixmap. |
|
174 </p><dl> |
|
175 <dt><i>data</i> (bytes or QByteArray)</dt> |
|
176 <dd> |
|
177 data for the pixmap |
|
178 </dd> |
|
179 </dl><dl> |
|
180 <dt>Returns:</dt> |
|
181 <dd> |
|
182 extracted pixmap |
|
183 </dd> |
|
184 </dl><dl> |
|
185 <dt>Return Type:</dt> |
|
186 <dd> |
|
187 QPixmap |
|
188 </dd> |
|
189 </dl> |
|
190 <div align="right"><a href="#top">Up</a></div> |
|
191 <hr /><hr /> |
|
192 <a NAME="pixmapToByteArray" ID="pixmapToByteArray"></a> |
|
193 <h2>pixmapToByteArray</h2> |
|
194 <b>pixmapToByteArray</b>(<i>pixmap</i>) |
|
195 <p> |
|
196 Module function to convert a pixmap to a byte array containing the pixmap |
|
197 as a PNG encoded as base64. |
|
198 </p><dl> |
|
199 <dt><i>pixmap</i> (QPixmap)</dt> |
|
200 <dd> |
|
201 pixmap to be converted |
|
202 </dd> |
|
203 </dl><dl> |
|
204 <dt>Returns:</dt> |
|
205 <dd> |
|
206 byte array containing the pixmap |
|
207 </dd> |
|
208 </dl><dl> |
|
209 <dt>Return Type:</dt> |
|
210 <dd> |
|
211 QByteArray |
|
212 </dd> |
|
213 </dl> |
|
214 <div align="right"><a href="#top">Up</a></div> |
|
215 <hr /><hr /> |
|
216 <a NAME="pixmapToDataUrl" ID="pixmapToDataUrl"></a> |
|
217 <h2>pixmapToDataUrl</h2> |
|
218 <b>pixmapToDataUrl</b>(<i>pixmap</i>) |
|
219 <p> |
|
220 Module function to convert a pixmap to a data: URL. |
|
221 </p><dl> |
|
222 <dt><i>pixmap</i> (QPixmap)</dt> |
|
223 <dd> |
|
224 pixmap to be converted |
|
225 </dd> |
|
226 </dl><dl> |
|
227 <dt>Returns:</dt> |
|
228 <dd> |
|
229 data: URL |
|
230 </dd> |
|
231 </dl><dl> |
|
232 <dt>Return Type:</dt> |
|
233 <dd> |
|
234 QUrl |
|
235 </dd> |
|
236 </dl> |
|
237 <div align="right"><a href="#top">Up</a></div> |
|
238 <hr /><hr /> |
|
239 <a NAME="readAllFileByteContents" ID="readAllFileByteContents"></a> |
|
240 <h2>readAllFileByteContents</h2> |
|
241 <b>readAllFileByteContents</b>(<i>filename</i>) |
|
242 <p> |
|
243 Function to read the bytes contents of the given file. |
|
244 </p><dl> |
|
245 <dt><i>filename</i> (str)</dt> |
|
246 <dd> |
|
247 name of the file |
|
248 </dd> |
|
249 </dl><dl> |
|
250 <dt>Returns:</dt> |
|
251 <dd> |
|
252 contents of the file |
|
253 </dd> |
|
254 </dl><dl> |
|
255 <dt>Return Type:</dt> |
|
256 <dd> |
|
257 str |
|
258 </dd> |
|
259 </dl> |
|
260 <div align="right"><a href="#top">Up</a></div> |
|
261 <hr /><hr /> |
|
262 <a NAME="readAllFileContents" ID="readAllFileContents"></a> |
|
263 <h2>readAllFileContents</h2> |
|
264 <b>readAllFileContents</b>(<i>filename</i>) |
|
265 <p> |
|
266 Function to read the string contents of the given file. |
|
267 </p><dl> |
|
268 <dt><i>filename</i> (str)</dt> |
|
269 <dd> |
|
270 name of the file |
|
271 </dd> |
|
272 </dl><dl> |
|
273 <dt>Returns:</dt> |
|
274 <dd> |
|
275 contents of the file |
|
276 </dd> |
|
277 </dl><dl> |
|
278 <dt>Return Type:</dt> |
|
279 <dd> |
|
280 str |
|
281 </dd> |
|
282 </dl> |
|
283 <div align="right"><a href="#top">Up</a></div> |
|
284 <hr /> |
|
285 </body></html> |