|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.UI.FindFileDialog</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> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric7.UI.FindFileDialog</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing a dialog to search for text in files. |
|
27 </p> |
|
28 <h3>Global Attributes</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 |
|
35 <table> |
|
36 |
|
37 <tr> |
|
38 <td><a href="#FindFileDialog">FindFileDialog</a></td> |
|
39 <td>Class implementing a dialog to search for text in files.</td> |
|
40 </tr> |
|
41 </table> |
|
42 <h3>Functions</h3> |
|
43 |
|
44 <table> |
|
45 <tr><td>None</td></tr> |
|
46 </table> |
|
47 <hr /> |
|
48 <hr /> |
|
49 <a NAME="FindFileDialog" ID="FindFileDialog"></a> |
|
50 <h2>FindFileDialog</h2> |
|
51 |
|
52 <p> |
|
53 Class implementing a dialog to search for text in files. |
|
54 </p> |
|
55 <p> |
|
56 The occurrences found are displayed in a QTreeWidget showing the filename, |
|
57 the linenumber and the found text. The file will be opened upon a double |
|
58 click onto the respective entry of the list. |
|
59 </p> |
|
60 <h3>Signals</h3> |
|
61 <dl> |
|
62 |
|
63 <dt>designerFile(str)</dt> |
|
64 <dd> |
|
65 emitted to open a Qt-Designer file |
|
66 </dd> |
|
67 <dt>sourceFile(str, int, str, int, int)</dt> |
|
68 <dd> |
|
69 emitted to open a source file |
|
70 at a line |
|
71 </dd> |
|
72 </dl> |
|
73 <h3>Derived from</h3> |
|
74 QDialog, Ui_FindFileDialog |
|
75 <h3>Class Attributes</h3> |
|
76 |
|
77 <table> |
|
78 <tr><td>endRole</td></tr><tr><td>lineRole</td></tr><tr><td>md5Role</td></tr><tr><td>replaceRole</td></tr><tr><td>startRole</td></tr> |
|
79 </table> |
|
80 <h3>Class Methods</h3> |
|
81 |
|
82 <table> |
|
83 <tr><td>None</td></tr> |
|
84 </table> |
|
85 <h3>Methods</h3> |
|
86 |
|
87 <table> |
|
88 |
|
89 <tr> |
|
90 <td><a href="#FindFileDialog.__init__">FindFileDialog</a></td> |
|
91 <td>Constructor</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#FindFileDialog.__contextMenuRequested">__contextMenuRequested</a></td> |
|
95 <td>Private slot to handle the context menu request.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#FindFileDialog.__copyToClipboard">__copyToClipboard</a></td> |
|
99 <td>Private method to copy the path of an entry to the clipboard.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#FindFileDialog.__createItem">__createItem</a></td> |
|
103 <td>Private method to create an entry in the file list.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#FindFileDialog.__doSearch">__doSearch</a></td> |
|
107 <td>Private slot to handle the find button being pressed.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#FindFileDialog.__enableFindButton">__enableFindButton</a></td> |
|
111 <td>Private slot called to enable the find button.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#FindFileDialog.__getFileList">__getFileList</a></td> |
|
115 <td>Private method to get a list of files to search.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#FindFileDialog.__openFile">__openFile</a></td> |
|
119 <td>Private slot to open the currently selected entry.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#FindFileDialog.__stopSearch">__stopSearch</a></td> |
|
123 <td>Private slot to handle the stop button being pressed.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#FindFileDialog.__stripEol">__stripEol</a></td> |
|
127 <td>Private method to strip the eol part.</td> |
|
128 </tr> |
|
129 <tr> |
|
130 <td><a href="#FindFileDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> |
|
131 <td>Private slot called by a button of the button box clicked.</td> |
|
132 </tr> |
|
133 <tr> |
|
134 <td><a href="#FindFileDialog.on_dirButton_clicked">on_dirButton_clicked</a></td> |
|
135 <td>Private slot to handle the selection of the 'Directory' radio button.</td> |
|
136 </tr> |
|
137 <tr> |
|
138 <td><a href="#FindFileDialog.on_dirPicker_editTextChanged">on_dirPicker_editTextChanged</a></td> |
|
139 <td>Private slot to handle the textChanged signal of the directory picker.</td> |
|
140 </tr> |
|
141 <tr> |
|
142 <td><a href="#FindFileDialog.on_filterCheckBox_clicked">on_filterCheckBox_clicked</a></td> |
|
143 <td>Private slot to handle the selection of the file filter check box.</td> |
|
144 </tr> |
|
145 <tr> |
|
146 <td><a href="#FindFileDialog.on_filterEdit_textEdited">on_filterEdit_textEdited</a></td> |
|
147 <td>Private slot to handle the textChanged signal of the file filter edit.</td> |
|
148 </tr> |
|
149 <tr> |
|
150 <td><a href="#FindFileDialog.on_findList_itemDoubleClicked">on_findList_itemDoubleClicked</a></td> |
|
151 <td>Private slot to handle the double click on a file item.</td> |
|
152 </tr> |
|
153 <tr> |
|
154 <td><a href="#FindFileDialog.on_findtextCombo_editTextChanged">on_findtextCombo_editTextChanged</a></td> |
|
155 <td>Private slot to handle the editTextChanged signal of the find text combo.</td> |
|
156 </tr> |
|
157 <tr> |
|
158 <td><a href="#FindFileDialog.on_openFilesButton_clicked">on_openFilesButton_clicked</a></td> |
|
159 <td>Private slot to handle the selection of the 'Open Files' radio button.</td> |
|
160 </tr> |
|
161 <tr> |
|
162 <td><a href="#FindFileDialog.on_projectButton_clicked">on_projectButton_clicked</a></td> |
|
163 <td>Private slot to handle the selection of the 'Project' radio button.</td> |
|
164 </tr> |
|
165 <tr> |
|
166 <td><a href="#FindFileDialog.on_replaceButton_clicked">on_replaceButton_clicked</a></td> |
|
167 <td>Private slot to perform the requested replace actions.</td> |
|
168 </tr> |
|
169 <tr> |
|
170 <td><a href="#FindFileDialog.on_replacetextCombo_editTextChanged">on_replacetextCombo_editTextChanged</a></td> |
|
171 <td>Private slot to handle the editTextChanged signal of the replace text combo.</td> |
|
172 </tr> |
|
173 <tr> |
|
174 <td><a href="#FindFileDialog.setOpenFiles">setOpenFiles</a></td> |
|
175 <td>Public slot to set the mode to search in open files.</td> |
|
176 </tr> |
|
177 <tr> |
|
178 <td><a href="#FindFileDialog.setSearchDirectory">setSearchDirectory</a></td> |
|
179 <td>Public slot to set the name of the directory to search in.</td> |
|
180 </tr> |
|
181 <tr> |
|
182 <td><a href="#FindFileDialog.show">show</a></td> |
|
183 <td>Public method to enable/disable the project button.</td> |
|
184 </tr> |
|
185 </table> |
|
186 <h3>Static Methods</h3> |
|
187 |
|
188 <table> |
|
189 <tr><td>None</td></tr> |
|
190 </table> |
|
191 |
|
192 <a NAME="FindFileDialog.__init__" ID="FindFileDialog.__init__"></a> |
|
193 <h4>FindFileDialog (Constructor)</h4> |
|
194 <b>FindFileDialog</b>(<i>project, replaceMode=False, parent=None</i>) |
|
195 |
|
196 <p> |
|
197 Constructor |
|
198 </p> |
|
199 <dl> |
|
200 |
|
201 <dt><i>project</i></dt> |
|
202 <dd> |
|
203 reference to the project object |
|
204 </dd> |
|
205 <dt><i>replaceMode</i></dt> |
|
206 <dd> |
|
207 flag indicating the replace dialog mode (boolean) |
|
208 </dd> |
|
209 <dt><i>parent</i></dt> |
|
210 <dd> |
|
211 parent widget of this dialog (QWidget) |
|
212 </dd> |
|
213 </dl> |
|
214 <a NAME="FindFileDialog.__contextMenuRequested" ID="FindFileDialog.__contextMenuRequested"></a> |
|
215 <h4>FindFileDialog.__contextMenuRequested</h4> |
|
216 <b>__contextMenuRequested</b>(<i>pos</i>) |
|
217 |
|
218 <p> |
|
219 Private slot to handle the context menu request. |
|
220 </p> |
|
221 <dl> |
|
222 |
|
223 <dt><i>pos</i></dt> |
|
224 <dd> |
|
225 position the context menu shall be shown (QPoint) |
|
226 </dd> |
|
227 </dl> |
|
228 <a NAME="FindFileDialog.__copyToClipboard" ID="FindFileDialog.__copyToClipboard"></a> |
|
229 <h4>FindFileDialog.__copyToClipboard</h4> |
|
230 <b>__copyToClipboard</b>(<i></i>) |
|
231 |
|
232 <p> |
|
233 Private method to copy the path of an entry to the clipboard. |
|
234 </p> |
|
235 <a NAME="FindFileDialog.__createItem" ID="FindFileDialog.__createItem"></a> |
|
236 <h4>FindFileDialog.__createItem</h4> |
|
237 <b>__createItem</b>(<i>file, line, text, start, end, replTxt="", md5=""</i>) |
|
238 |
|
239 <p> |
|
240 Private method to create an entry in the file list. |
|
241 </p> |
|
242 <dl> |
|
243 |
|
244 <dt><i>file</i></dt> |
|
245 <dd> |
|
246 filename of file (string) |
|
247 </dd> |
|
248 <dt><i>line</i></dt> |
|
249 <dd> |
|
250 line number (integer) |
|
251 </dd> |
|
252 <dt><i>text</i></dt> |
|
253 <dd> |
|
254 text found (string) |
|
255 </dd> |
|
256 <dt><i>start</i></dt> |
|
257 <dd> |
|
258 start position of match (integer) |
|
259 </dd> |
|
260 <dt><i>end</i></dt> |
|
261 <dd> |
|
262 end position of match (integer) |
|
263 </dd> |
|
264 <dt><i>replTxt</i></dt> |
|
265 <dd> |
|
266 text with replacements applied (string) |
|
267 </dd> |
|
268 <dt><i>md5</i></dt> |
|
269 <dd> |
|
270 MD5 hash of the file (string) |
|
271 </dd> |
|
272 </dl> |
|
273 <a NAME="FindFileDialog.__doSearch" ID="FindFileDialog.__doSearch"></a> |
|
274 <h4>FindFileDialog.__doSearch</h4> |
|
275 <b>__doSearch</b>(<i></i>) |
|
276 |
|
277 <p> |
|
278 Private slot to handle the find button being pressed. |
|
279 </p> |
|
280 <a NAME="FindFileDialog.__enableFindButton" ID="FindFileDialog.__enableFindButton"></a> |
|
281 <h4>FindFileDialog.__enableFindButton</h4> |
|
282 <b>__enableFindButton</b>(<i></i>) |
|
283 |
|
284 <p> |
|
285 Private slot called to enable the find button. |
|
286 </p> |
|
287 <a NAME="FindFileDialog.__getFileList" ID="FindFileDialog.__getFileList"></a> |
|
288 <h4>FindFileDialog.__getFileList</h4> |
|
289 <b>__getFileList</b>(<i>path, filterRe, excludeHiddenDirs=False, excludeHiddenFiles=False</i>) |
|
290 |
|
291 <p> |
|
292 Private method to get a list of files to search. |
|
293 </p> |
|
294 <dl> |
|
295 |
|
296 <dt><i>path</i> (str)</dt> |
|
297 <dd> |
|
298 the root directory to search in |
|
299 </dd> |
|
300 <dt><i>filterRe</i> (regexp object)</dt> |
|
301 <dd> |
|
302 regular expression defining the filter |
|
303 criteria |
|
304 </dd> |
|
305 <dt><i>excludeHiddenDirs</i> (bool)</dt> |
|
306 <dd> |
|
307 flag indicating to exclude hidden directories |
|
308 </dd> |
|
309 <dt><i>excludeHiddenFiles</i> (bool)</dt> |
|
310 <dd> |
|
311 flag indicating to exclude hidden files |
|
312 </dd> |
|
313 </dl> |
|
314 <dl> |
|
315 <dt>Return:</dt> |
|
316 <dd> |
|
317 list of files to be processed |
|
318 </dd> |
|
319 </dl> |
|
320 <dl> |
|
321 <dt>Return Type:</dt> |
|
322 <dd> |
|
323 list of str |
|
324 </dd> |
|
325 </dl> |
|
326 <a NAME="FindFileDialog.__openFile" ID="FindFileDialog.__openFile"></a> |
|
327 <h4>FindFileDialog.__openFile</h4> |
|
328 <b>__openFile</b>(<i></i>) |
|
329 |
|
330 <p> |
|
331 Private slot to open the currently selected entry. |
|
332 </p> |
|
333 <a NAME="FindFileDialog.__stopSearch" ID="FindFileDialog.__stopSearch"></a> |
|
334 <h4>FindFileDialog.__stopSearch</h4> |
|
335 <b>__stopSearch</b>(<i></i>) |
|
336 |
|
337 <p> |
|
338 Private slot to handle the stop button being pressed. |
|
339 </p> |
|
340 <a NAME="FindFileDialog.__stripEol" ID="FindFileDialog.__stripEol"></a> |
|
341 <h4>FindFileDialog.__stripEol</h4> |
|
342 <b>__stripEol</b>(<i>txt</i>) |
|
343 |
|
344 <p> |
|
345 Private method to strip the eol part. |
|
346 </p> |
|
347 <dl> |
|
348 |
|
349 <dt><i>txt</i></dt> |
|
350 <dd> |
|
351 line of text that should be treated (string) |
|
352 </dd> |
|
353 </dl> |
|
354 <dl> |
|
355 <dt>Return:</dt> |
|
356 <dd> |
|
357 text with eol stripped (string) |
|
358 </dd> |
|
359 </dl> |
|
360 <a NAME="FindFileDialog.on_buttonBox_clicked" ID="FindFileDialog.on_buttonBox_clicked"></a> |
|
361 <h4>FindFileDialog.on_buttonBox_clicked</h4> |
|
362 <b>on_buttonBox_clicked</b>(<i>button</i>) |
|
363 |
|
364 <p> |
|
365 Private slot called by a button of the button box clicked. |
|
366 </p> |
|
367 <dl> |
|
368 |
|
369 <dt><i>button</i></dt> |
|
370 <dd> |
|
371 button that was clicked (QAbstractButton) |
|
372 </dd> |
|
373 </dl> |
|
374 <a NAME="FindFileDialog.on_dirButton_clicked" ID="FindFileDialog.on_dirButton_clicked"></a> |
|
375 <h4>FindFileDialog.on_dirButton_clicked</h4> |
|
376 <b>on_dirButton_clicked</b>(<i></i>) |
|
377 |
|
378 <p> |
|
379 Private slot to handle the selection of the 'Directory' radio button. |
|
380 </p> |
|
381 <a NAME="FindFileDialog.on_dirPicker_editTextChanged" ID="FindFileDialog.on_dirPicker_editTextChanged"></a> |
|
382 <h4>FindFileDialog.on_dirPicker_editTextChanged</h4> |
|
383 <b>on_dirPicker_editTextChanged</b>(<i>text</i>) |
|
384 |
|
385 <p> |
|
386 Private slot to handle the textChanged signal of the directory |
|
387 picker. |
|
388 </p> |
|
389 <dl> |
|
390 |
|
391 <dt><i>text</i></dt> |
|
392 <dd> |
|
393 (ignored) |
|
394 </dd> |
|
395 </dl> |
|
396 <a NAME="FindFileDialog.on_filterCheckBox_clicked" ID="FindFileDialog.on_filterCheckBox_clicked"></a> |
|
397 <h4>FindFileDialog.on_filterCheckBox_clicked</h4> |
|
398 <b>on_filterCheckBox_clicked</b>(<i></i>) |
|
399 |
|
400 <p> |
|
401 Private slot to handle the selection of the file filter check box. |
|
402 </p> |
|
403 <a NAME="FindFileDialog.on_filterEdit_textEdited" ID="FindFileDialog.on_filterEdit_textEdited"></a> |
|
404 <h4>FindFileDialog.on_filterEdit_textEdited</h4> |
|
405 <b>on_filterEdit_textEdited</b>(<i>text</i>) |
|
406 |
|
407 <p> |
|
408 Private slot to handle the textChanged signal of the file filter edit. |
|
409 </p> |
|
410 <dl> |
|
411 |
|
412 <dt><i>text</i></dt> |
|
413 <dd> |
|
414 (ignored) |
|
415 </dd> |
|
416 </dl> |
|
417 <a NAME="FindFileDialog.on_findList_itemDoubleClicked" ID="FindFileDialog.on_findList_itemDoubleClicked"></a> |
|
418 <h4>FindFileDialog.on_findList_itemDoubleClicked</h4> |
|
419 <b>on_findList_itemDoubleClicked</b>(<i>itm, column</i>) |
|
420 |
|
421 <p> |
|
422 Private slot to handle the double click on a file item. |
|
423 </p> |
|
424 <p> |
|
425 It emits the signal |
|
426 sourceFile or designerFile depending on the file extension. |
|
427 </p> |
|
428 <dl> |
|
429 |
|
430 <dt><i>itm</i></dt> |
|
431 <dd> |
|
432 the double clicked tree item (QTreeWidgetItem) |
|
433 </dd> |
|
434 <dt><i>column</i></dt> |
|
435 <dd> |
|
436 column that was double clicked (integer) (ignored) |
|
437 </dd> |
|
438 </dl> |
|
439 <a NAME="FindFileDialog.on_findtextCombo_editTextChanged" ID="FindFileDialog.on_findtextCombo_editTextChanged"></a> |
|
440 <h4>FindFileDialog.on_findtextCombo_editTextChanged</h4> |
|
441 <b>on_findtextCombo_editTextChanged</b>(<i>text</i>) |
|
442 |
|
443 <p> |
|
444 Private slot to handle the editTextChanged signal of the find |
|
445 text combo. |
|
446 </p> |
|
447 <dl> |
|
448 |
|
449 <dt><i>text</i></dt> |
|
450 <dd> |
|
451 (ignored) |
|
452 </dd> |
|
453 </dl> |
|
454 <a NAME="FindFileDialog.on_openFilesButton_clicked" ID="FindFileDialog.on_openFilesButton_clicked"></a> |
|
455 <h4>FindFileDialog.on_openFilesButton_clicked</h4> |
|
456 <b>on_openFilesButton_clicked</b>(<i></i>) |
|
457 |
|
458 <p> |
|
459 Private slot to handle the selection of the 'Open Files' radio button. |
|
460 </p> |
|
461 <a NAME="FindFileDialog.on_projectButton_clicked" ID="FindFileDialog.on_projectButton_clicked"></a> |
|
462 <h4>FindFileDialog.on_projectButton_clicked</h4> |
|
463 <b>on_projectButton_clicked</b>(<i></i>) |
|
464 |
|
465 <p> |
|
466 Private slot to handle the selection of the 'Project' radio button. |
|
467 </p> |
|
468 <a NAME="FindFileDialog.on_replaceButton_clicked" ID="FindFileDialog.on_replaceButton_clicked"></a> |
|
469 <h4>FindFileDialog.on_replaceButton_clicked</h4> |
|
470 <b>on_replaceButton_clicked</b>(<i></i>) |
|
471 |
|
472 <p> |
|
473 Private slot to perform the requested replace actions. |
|
474 </p> |
|
475 <a NAME="FindFileDialog.on_replacetextCombo_editTextChanged" ID="FindFileDialog.on_replacetextCombo_editTextChanged"></a> |
|
476 <h4>FindFileDialog.on_replacetextCombo_editTextChanged</h4> |
|
477 <b>on_replacetextCombo_editTextChanged</b>(<i>text</i>) |
|
478 |
|
479 <p> |
|
480 Private slot to handle the editTextChanged signal of the replace |
|
481 text combo. |
|
482 </p> |
|
483 <dl> |
|
484 |
|
485 <dt><i>text</i></dt> |
|
486 <dd> |
|
487 (ignored) |
|
488 </dd> |
|
489 </dl> |
|
490 <a NAME="FindFileDialog.setOpenFiles" ID="FindFileDialog.setOpenFiles"></a> |
|
491 <h4>FindFileDialog.setOpenFiles</h4> |
|
492 <b>setOpenFiles</b>(<i></i>) |
|
493 |
|
494 <p> |
|
495 Public slot to set the mode to search in open files. |
|
496 </p> |
|
497 <a NAME="FindFileDialog.setSearchDirectory" ID="FindFileDialog.setSearchDirectory"></a> |
|
498 <h4>FindFileDialog.setSearchDirectory</h4> |
|
499 <b>setSearchDirectory</b>(<i>searchDir</i>) |
|
500 |
|
501 <p> |
|
502 Public slot to set the name of the directory to search in. |
|
503 </p> |
|
504 <dl> |
|
505 |
|
506 <dt><i>searchDir</i></dt> |
|
507 <dd> |
|
508 name of the directory to search in (string) |
|
509 </dd> |
|
510 </dl> |
|
511 <a NAME="FindFileDialog.show" ID="FindFileDialog.show"></a> |
|
512 <h4>FindFileDialog.show</h4> |
|
513 <b>show</b>(<i>txt=""</i>) |
|
514 |
|
515 <p> |
|
516 Public method to enable/disable the project button. |
|
517 </p> |
|
518 <dl> |
|
519 |
|
520 <dt><i>txt</i></dt> |
|
521 <dd> |
|
522 text to be shown in the searchtext combo (string) |
|
523 </dd> |
|
524 </dl> |
|
525 <div align="right"><a href="#top">Up</a></div> |
|
526 <hr /> |
|
527 </body></html> |