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