|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.WebBrowser.History.HistoryCompleter</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.History.HistoryCompleter</h1> |
|
23 <p> |
|
24 Module implementing a special completer for the history. |
|
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> |
|
33 <td><a href="#HistoryCompleter">HistoryCompleter</a></td> |
|
34 <td>Class implementing a completer for the browser history.</td> |
|
35 </tr><tr> |
|
36 <td><a href="#HistoryCompletionModel">HistoryCompletionModel</a></td> |
|
37 <td>Class implementing a special model for history based completions.</td> |
|
38 </tr><tr> |
|
39 <td><a href="#HistoryCompletionView">HistoryCompletionView</a></td> |
|
40 <td>Class implementing a special completer view for history based completions.</td> |
|
41 </tr> |
|
42 </table> |
|
43 <h3>Functions</h3> |
|
44 <table> |
|
45 <tr><td>None</td></tr> |
|
46 </table> |
|
47 <hr /><hr /> |
|
48 <a NAME="HistoryCompleter" ID="HistoryCompleter"></a> |
|
49 <h2>HistoryCompleter</h2> |
|
50 <p> |
|
51 Class implementing a completer for the browser history. |
|
52 </p> |
|
53 <h3>Derived from</h3> |
|
54 QCompleter |
|
55 <h3>Class Attributes</h3> |
|
56 <table> |
|
57 <tr><td>None</td></tr> |
|
58 </table> |
|
59 <h3>Class Methods</h3> |
|
60 <table> |
|
61 <tr><td>None</td></tr> |
|
62 </table> |
|
63 <h3>Methods</h3> |
|
64 <table> |
|
65 <tr> |
|
66 <td><a href="#HistoryCompleter.__init__">HistoryCompleter</a></td> |
|
67 <td>Constructor</td> |
|
68 </tr><tr> |
|
69 <td><a href="#HistoryCompleter.__updateFilter">__updateFilter</a></td> |
|
70 <td>Private slot to update the search string.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#HistoryCompleter.pathFromIndex">pathFromIndex</a></td> |
|
73 <td>Public method to get a path for a given index.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#HistoryCompleter.splitPath">splitPath</a></td> |
|
76 <td>Public method to split the given path into strings, that are used to match at each level in the model.</td> |
|
77 </tr> |
|
78 </table> |
|
79 <h3>Static Methods</h3> |
|
80 <table> |
|
81 <tr><td>None</td></tr> |
|
82 </table> |
|
83 <a NAME="HistoryCompleter.__init__" ID="HistoryCompleter.__init__"></a> |
|
84 <h4>HistoryCompleter (Constructor)</h4> |
|
85 <b>HistoryCompleter</b>(<i>model, parent=None</i>) |
|
86 <p> |
|
87 Constructor |
|
88 </p><dl> |
|
89 <dt><i>model</i></dt> |
|
90 <dd> |
|
91 reference to the model (QAbstractItemModel) |
|
92 </dd><dt><i>parent</i></dt> |
|
93 <dd> |
|
94 reference to the parent object (QObject) |
|
95 </dd> |
|
96 </dl><a NAME="HistoryCompleter.__updateFilter" ID="HistoryCompleter.__updateFilter"></a> |
|
97 <h4>HistoryCompleter.__updateFilter</h4> |
|
98 <b>__updateFilter</b>(<i></i>) |
|
99 <p> |
|
100 Private slot to update the search string. |
|
101 </p><a NAME="HistoryCompleter.pathFromIndex" ID="HistoryCompleter.pathFromIndex"></a> |
|
102 <h4>HistoryCompleter.pathFromIndex</h4> |
|
103 <b>pathFromIndex</b>(<i>idx</i>) |
|
104 <p> |
|
105 Public method to get a path for a given index. |
|
106 </p><dl> |
|
107 <dt><i>idx</i></dt> |
|
108 <dd> |
|
109 reference to the index (QModelIndex) |
|
110 </dd> |
|
111 </dl><dl> |
|
112 <dt>Returns:</dt> |
|
113 <dd> |
|
114 the actual URL from the history (string) |
|
115 </dd> |
|
116 </dl><a NAME="HistoryCompleter.splitPath" ID="HistoryCompleter.splitPath"></a> |
|
117 <h4>HistoryCompleter.splitPath</h4> |
|
118 <b>splitPath</b>(<i>path</i>) |
|
119 <p> |
|
120 Public method to split the given path into strings, that are used to |
|
121 match at each level in the model. |
|
122 </p><dl> |
|
123 <dt><i>path</i></dt> |
|
124 <dd> |
|
125 path to be split (string) |
|
126 </dd> |
|
127 </dl><dl> |
|
128 <dt>Returns:</dt> |
|
129 <dd> |
|
130 list of path elements (list of strings) |
|
131 </dd> |
|
132 </dl> |
|
133 <div align="right"><a href="#top">Up</a></div> |
|
134 <hr /><hr /> |
|
135 <a NAME="HistoryCompletionModel" ID="HistoryCompletionModel"></a> |
|
136 <h2>HistoryCompletionModel</h2> |
|
137 <p> |
|
138 Class implementing a special model for history based completions. |
|
139 </p> |
|
140 <h3>Derived from</h3> |
|
141 QSortFilterProxyModel |
|
142 <h3>Class Attributes</h3> |
|
143 <table> |
|
144 <tr><td>HistoryCompletionRole</td></tr> |
|
145 </table> |
|
146 <h3>Class Methods</h3> |
|
147 <table> |
|
148 <tr><td>None</td></tr> |
|
149 </table> |
|
150 <h3>Methods</h3> |
|
151 <table> |
|
152 <tr> |
|
153 <td><a href="#HistoryCompletionModel.__init__">HistoryCompletionModel</a></td> |
|
154 <td>Constructor</td> |
|
155 </tr><tr> |
|
156 <td><a href="#HistoryCompletionModel.data">data</a></td> |
|
157 <td>Public method to get data from the model.</td> |
|
158 </tr><tr> |
|
159 <td><a href="#HistoryCompletionModel.filterAcceptsRow">filterAcceptsRow</a></td> |
|
160 <td>Public method to determine, if the row is acceptable.</td> |
|
161 </tr><tr> |
|
162 <td><a href="#HistoryCompletionModel.isValid">isValid</a></td> |
|
163 <td>Public method to check the model for validity.</td> |
|
164 </tr><tr> |
|
165 <td><a href="#HistoryCompletionModel.lessThan">lessThan</a></td> |
|
166 <td>Public method used to sort the displayed items.</td> |
|
167 </tr><tr> |
|
168 <td><a href="#HistoryCompletionModel.searchString">searchString</a></td> |
|
169 <td>Public method to get the current search string.</td> |
|
170 </tr><tr> |
|
171 <td><a href="#HistoryCompletionModel.setSearchString">setSearchString</a></td> |
|
172 <td>Public method to set the current search string.</td> |
|
173 </tr><tr> |
|
174 <td><a href="#HistoryCompletionModel.setValid">setValid</a></td> |
|
175 <td>Public method to set the model's validity.</td> |
|
176 </tr> |
|
177 </table> |
|
178 <h3>Static Methods</h3> |
|
179 <table> |
|
180 <tr><td>None</td></tr> |
|
181 </table> |
|
182 <a NAME="HistoryCompletionModel.__init__" ID="HistoryCompletionModel.__init__"></a> |
|
183 <h4>HistoryCompletionModel (Constructor)</h4> |
|
184 <b>HistoryCompletionModel</b>(<i>parent=None</i>) |
|
185 <p> |
|
186 Constructor |
|
187 </p><dl> |
|
188 <dt><i>parent</i></dt> |
|
189 <dd> |
|
190 reference to the parent object (QObject) |
|
191 </dd> |
|
192 </dl><a NAME="HistoryCompletionModel.data" ID="HistoryCompletionModel.data"></a> |
|
193 <h4>HistoryCompletionModel.data</h4> |
|
194 <b>data</b>(<i>index, role=Qt.DisplayRole</i>) |
|
195 <p> |
|
196 Public method to get data from the model. |
|
197 </p><dl> |
|
198 <dt><i>index</i></dt> |
|
199 <dd> |
|
200 index of history entry to get data for (QModelIndex) |
|
201 </dd><dt><i>role</i></dt> |
|
202 <dd> |
|
203 data role (integer) |
|
204 </dd> |
|
205 </dl><dl> |
|
206 <dt>Returns:</dt> |
|
207 <dd> |
|
208 history entry data |
|
209 </dd> |
|
210 </dl><a NAME="HistoryCompletionModel.filterAcceptsRow" ID="HistoryCompletionModel.filterAcceptsRow"></a> |
|
211 <h4>HistoryCompletionModel.filterAcceptsRow</h4> |
|
212 <b>filterAcceptsRow</b>(<i>sourceRow, sourceParent</i>) |
|
213 <p> |
|
214 Public method to determine, if the row is acceptable. |
|
215 </p><dl> |
|
216 <dt><i>sourceRow</i></dt> |
|
217 <dd> |
|
218 row number in the source model (integer) |
|
219 </dd><dt><i>sourceParent</i></dt> |
|
220 <dd> |
|
221 index of the source item (QModelIndex) |
|
222 </dd> |
|
223 </dl><dl> |
|
224 <dt>Returns:</dt> |
|
225 <dd> |
|
226 flag indicating acceptance (boolean) |
|
227 </dd> |
|
228 </dl><a NAME="HistoryCompletionModel.isValid" ID="HistoryCompletionModel.isValid"></a> |
|
229 <h4>HistoryCompletionModel.isValid</h4> |
|
230 <b>isValid</b>(<i></i>) |
|
231 <p> |
|
232 Public method to check the model for validity. |
|
233 </p><dl> |
|
234 <dt>Returns:</dt> |
|
235 <dd> |
|
236 flag indicating a valid status (boolean) |
|
237 </dd> |
|
238 </dl><a NAME="HistoryCompletionModel.lessThan" ID="HistoryCompletionModel.lessThan"></a> |
|
239 <h4>HistoryCompletionModel.lessThan</h4> |
|
240 <b>lessThan</b>(<i>left, right</i>) |
|
241 <p> |
|
242 Public method used to sort the displayed items. |
|
243 </p><p> |
|
244 It implements a special sorting function based on the history entry's |
|
245 frequency giving a bonus to hits that match on a word boundary so that |
|
246 e.g. "dot.python-projects.org" is a better result for typing "dot" than |
|
247 "slashdot.org". However, it only looks for the string in the host name, |
|
248 not the entire URL, since while it makes sense to e.g. give |
|
249 "www.phoronix.com" a bonus for "ph", it does NOT make sense to give |
|
250 "www.yadda.com/foo.php" the bonus. |
|
251 </p><dl> |
|
252 <dt><i>left</i></dt> |
|
253 <dd> |
|
254 index of left item (QModelIndex) |
|
255 </dd><dt><i>right</i></dt> |
|
256 <dd> |
|
257 index of right item (QModelIndex) |
|
258 </dd> |
|
259 </dl><dl> |
|
260 <dt>Returns:</dt> |
|
261 <dd> |
|
262 true, if left is less than right (boolean) |
|
263 </dd> |
|
264 </dl><a NAME="HistoryCompletionModel.searchString" ID="HistoryCompletionModel.searchString"></a> |
|
265 <h4>HistoryCompletionModel.searchString</h4> |
|
266 <b>searchString</b>(<i></i>) |
|
267 <p> |
|
268 Public method to get the current search string. |
|
269 </p><dl> |
|
270 <dt>Returns:</dt> |
|
271 <dd> |
|
272 current search string (string) |
|
273 </dd> |
|
274 </dl><a NAME="HistoryCompletionModel.setSearchString" ID="HistoryCompletionModel.setSearchString"></a> |
|
275 <h4>HistoryCompletionModel.setSearchString</h4> |
|
276 <b>setSearchString</b>(<i>string</i>) |
|
277 <p> |
|
278 Public method to set the current search string. |
|
279 </p><dl> |
|
280 <dt><i>string</i></dt> |
|
281 <dd> |
|
282 new search string (string) |
|
283 </dd> |
|
284 </dl><a NAME="HistoryCompletionModel.setValid" ID="HistoryCompletionModel.setValid"></a> |
|
285 <h4>HistoryCompletionModel.setValid</h4> |
|
286 <b>setValid</b>(<i>valid</i>) |
|
287 <p> |
|
288 Public method to set the model's validity. |
|
289 </p><dl> |
|
290 <dt><i>valid</i></dt> |
|
291 <dd> |
|
292 flag indicating the new valid status (boolean) |
|
293 </dd> |
|
294 </dl> |
|
295 <div align="right"><a href="#top">Up</a></div> |
|
296 <hr /><hr /> |
|
297 <a NAME="HistoryCompletionView" ID="HistoryCompletionView"></a> |
|
298 <h2>HistoryCompletionView</h2> |
|
299 <p> |
|
300 Class implementing a special completer view for history based completions. |
|
301 </p> |
|
302 <h3>Derived from</h3> |
|
303 QTableView |
|
304 <h3>Class Attributes</h3> |
|
305 <table> |
|
306 <tr><td>None</td></tr> |
|
307 </table> |
|
308 <h3>Class Methods</h3> |
|
309 <table> |
|
310 <tr><td>None</td></tr> |
|
311 </table> |
|
312 <h3>Methods</h3> |
|
313 <table> |
|
314 <tr> |
|
315 <td><a href="#HistoryCompletionView.__init__">HistoryCompletionView</a></td> |
|
316 <td>Constructor</td> |
|
317 </tr><tr> |
|
318 <td><a href="#HistoryCompletionView.resizeEvent">resizeEvent</a></td> |
|
319 <td>Protected method handling resize events.</td> |
|
320 </tr><tr> |
|
321 <td><a href="#HistoryCompletionView.sizeHintForRow">sizeHintForRow</a></td> |
|
322 <td>Public method to give a size hint for rows.</td> |
|
323 </tr> |
|
324 </table> |
|
325 <h3>Static Methods</h3> |
|
326 <table> |
|
327 <tr><td>None</td></tr> |
|
328 </table> |
|
329 <a NAME="HistoryCompletionView.__init__" ID="HistoryCompletionView.__init__"></a> |
|
330 <h4>HistoryCompletionView (Constructor)</h4> |
|
331 <b>HistoryCompletionView</b>(<i>parent=None</i>) |
|
332 <p> |
|
333 Constructor |
|
334 </p><dl> |
|
335 <dt><i>parent</i></dt> |
|
336 <dd> |
|
337 reference to the parent widget (QWidget) |
|
338 </dd> |
|
339 </dl><a NAME="HistoryCompletionView.resizeEvent" ID="HistoryCompletionView.resizeEvent"></a> |
|
340 <h4>HistoryCompletionView.resizeEvent</h4> |
|
341 <b>resizeEvent</b>(<i>evt</i>) |
|
342 <p> |
|
343 Protected method handling resize events. |
|
344 </p><dl> |
|
345 <dt><i>evt</i></dt> |
|
346 <dd> |
|
347 reference to the resize event (QResizeEvent) |
|
348 </dd> |
|
349 </dl><a NAME="HistoryCompletionView.sizeHintForRow" ID="HistoryCompletionView.sizeHintForRow"></a> |
|
350 <h4>HistoryCompletionView.sizeHintForRow</h4> |
|
351 <b>sizeHintForRow</b>(<i>row</i>) |
|
352 <p> |
|
353 Public method to give a size hint for rows. |
|
354 </p><dl> |
|
355 <dt><i>row</i></dt> |
|
356 <dd> |
|
357 row number (integer) |
|
358 </dd> |
|
359 </dl><dl> |
|
360 <dt>Returns:</dt> |
|
361 <dd> |
|
362 desired row height (integer) |
|
363 </dd> |
|
364 </dl> |
|
365 <div align="right"><a href="#top">Up</a></div> |
|
366 <hr /> |
|
367 </body></html> |